Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Phpstan: fixed return types (docs only) #2636

Merged
merged 32 commits into from
Oct 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
a07e1ac
Fixed "should return string but returns false"
sreichel Sep 26, 2022
7721bce
Fixed "should return XYZ but returns false"
sreichel Sep 26, 2022
e7c9855
Fixed "should return array but returns null"
sreichel Sep 26, 2022
228667f
Fixed "should return string but returns null"
sreichel Sep 26, 2022
076c936
Fixed "should return int but returns null"
sreichel Sep 26, 2022
37359a5
Fixed "should return bool but returns"
sreichel Sep 26, 2022
cb79328
Merge branch '1.9.4.x' into phpstan/l3-1
sreichel Oct 1, 2022
e88b76c
Fixed docs (see comments)
sreichel Oct 1, 2022
43dda90
Fixed "should return array"
sreichel Oct 2, 2022
fd1f974
Update app/code/core/Mage/Adminhtml/Block/Widget/Grid/Massaction/Abst…
sreichel Oct 5, 2022
e7ad47e
Update app/code/core/Mage/Catalog/Model/Product/Attribute/Tierprice/A…
sreichel Oct 5, 2022
a5458b4
Update app/code/core/Mage/Tag/Model/Resource/Tag.php
sreichel Oct 8, 2022
21f2477
Update app/code/core/Mage/Customer/Block/Form/Register.php
sreichel Oct 8, 2022
df83d31
Added module names to helper(#2617)
sreichel Oct 1, 2022
4c37719
Get catalog search result collection from engine (#2634)
elidrissidev Oct 1, 2022
08199f0
Add PHP dependencies security check workflow (#2639)
elidrissidev Oct 2, 2022
21edb9d
[security-workflow] Fixed cron syntax (#2640)
sreichel Oct 2, 2022
1c8a814
Added OpenMage Contributors Copyright (#2295)
justinbeaty Oct 3, 2022
82fa9c8
Added ddev snippets to docs (#2575)
sreichel Oct 3, 2022
f0928c4
Improve dev/openmage/install.sh script for newer versions of Docker -…
colinmollenhour Oct 3, 2022
d14d250
Only run workflows when relevant files change (#2641)
elidrissidev Oct 3, 2022
b5b81b3
Add back notification popup severity icons URL (#2633)
elidrissidev Oct 4, 2022
3234f93
Reduce reprocessed jpeg file size by defaulting quality to 85% (#2629)
kiatng Oct 5, 2022
b98a549
Prevented editing of a non-editable order (#2632)
elidrissidev Oct 5, 2022
afe8e06
Fix dev/openmage/install.sh script setting permissions on var directory.
colinmollenhour Oct 5, 2022
f22c9cd
Allowed automatic full invoice from API (#2393)
luigifab Oct 5, 2022
df72c2b
Add check if array key isset before using it (#2649)
przemyslaw-p Oct 7, 2022
185fb12
Merge branch '1.9.4.x' into phpstan/l3-1
sreichel Oct 11, 2022
3c82e76
Fixed phpstan-baseline.neon
sreichel Oct 11, 2022
a8dfa5c
Fixed phpstan-baseline.neon (updated dev tools)
sreichel Oct 11, 2022
66e1aa0
Revert "Fixed phpstan-baseline.neon"
sreichel Oct 13, 2022
d804da9
Fixed getRegion()
sreichel Oct 13, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
424 changes: 7 additions & 417 deletions .github/phpstan-baseline.neon

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
*/
class Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Super_Config_Grid_Filter_Inventory extends Mage_Adminhtml_Block_Widget_Grid_Column_Filter_Select
{
/**
* @return array
*/
protected function _getOptions()
{
return [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,19 @@
*/
class Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Price extends Varien_Data_Form_Element_Text
{
/**
* @param array $attributes
*/
public function __construct($attributes= [])
{
parent::__construct($attributes);
$this->addClass('validate-zero-or-greater');
}

/**
* @return string
* @throws Mage_Core_Model_Store_Exception
*/
public function getAfterElementHtml()
{
$html = parent::getAfterElementHtml();
Expand Down Expand Up @@ -61,13 +68,21 @@ public function getAfterElementHtml()
return $html;
}

/**
* @param $attribute
* @return string
*/
protected function _getTaxObservingCode($attribute)
{
$spanId = "dynamic-tax-{$attribute->getAttributeCode()}";

return "<script type='text/javascript'>if (dynamicTaxes == undefined) var dynamicTaxes = new Array(); dynamicTaxes[dynamicTaxes.length]='{$attribute->getAttributeCode()}'</script>";
}

/**
* @param null $index
elidrissidev marked this conversation as resolved.
Show resolved Hide resolved
* @return string|null
*/
public function getEscapedValue($index=null)
{
$value = $this->getValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public function __construct()
parent::__construct();
}

/**
* @return array
*/
protected function _getOptions()
{
$result = [];
Expand All @@ -53,9 +56,12 @@ protected function _getOptions()
return $result;
}

/**
* @return array|null
*/
public function getCondition()
{
if(is_null($this->getValue())) {
if (is_null($this->getValue())) {
return null;
}

Expand Down
62 changes: 52 additions & 10 deletions app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,18 @@
* @package Mage_Adminhtml
* @author Magento Core Team <core@magentocommerce.com>
*/
class Mage_Adminhtml_Block_Customer_Edit_Tab_View
extends Mage_Adminhtml_Block_Template
implements Mage_Adminhtml_Block_Widget_Tab_Interface
class Mage_Adminhtml_Block_Customer_Edit_Tab_View extends Mage_Adminhtml_Block_Template implements Mage_Adminhtml_Block_Widget_Tab_Interface
{
/**
* @var Mage_Customer_Model_Customer
*/
protected $_customer;

protected $_customerLog;

/**
* @return Mage_Customer_Model_Customer
*/
public function getCustomer()
{
if (!$this->_customer) {
Expand All @@ -42,6 +46,9 @@ public function getCustomer()
return $this->_customer;
}

/**
* @return string|void
*/
public function getGroupName()
{
if ($groupId = $this->getCustomer()->getGroupId()) {
Expand All @@ -68,20 +75,26 @@ public function getCustomerLog()
/**
* Get customer creation date
*
* @return string
* @return string|null
*/
public function getCreateDate()
{
if ( ! $this->getCustomer()->getCreatedAt()) {
if (! $this->getCustomer()->getCreatedAt()) {
return null;
}
return $this->_getCoreHelper()->formatDate($this->getCustomer()->getCreatedAt(),
Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true);
return $this->_getCoreHelper()->formatDate(
$this->getCustomer()->getCreatedAt(),
Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM,
true
);
}

/**
* @return string|null
*/
public function getStoreCreateDate()
{
if ( ! $this->getCustomer()->getCreatedAt()) {
if (! $this->getCustomer()->getCreatedAt()) {
return null;
}
$date = Mage::app()->getLocale()->storeDate(
Expand Down Expand Up @@ -112,6 +125,9 @@ public function getLastLoginDate()
return Mage::helper('customer')->__('Never');
}

/**
* @return string
*/
public function getStoreLastLoginDate()
{
if ($date = $this->getCustomerLog()->getLoginAtTimestamp()) {
Expand All @@ -131,6 +147,9 @@ public function getStoreLastLoginDateTimezone()
->getConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_TIMEZONE);
}

/**
* @return string
*/
public function getCurrentStatus()
{
$log = $this->getCustomerLog();
Expand All @@ -142,6 +161,9 @@ public function getCurrentStatus()
return Mage::helper('customer')->__('Online');
}

/**
* @return string
*/
public function getIsConfirmedStatus()
{
$this->getCustomer();
Expand All @@ -164,38 +186,55 @@ public function getStoreId()
return $this->getCustomer()->getStoreId();
}

/**
* @return string
*/
public function getBillingAddressHtml()
{
$html = '';
if ($address = $this->getCustomer()->getPrimaryBillingAddress()) {
$html = $address->format('html');
}
else {
} else {
$html = Mage::helper('customer')->__('The customer does not have default billing address.');
}
return $html;
}

/**
* @return string
*/
public function getAccordionHtml()
{
return $this->getChildHtml('accordion');
}

/**
* @return string
*/
public function getSalesHtml()
{
return $this->getChildHtml('sales');
}

/**
* @return string
*/
public function getTabLabel()
{
return Mage::helper('customer')->__('Customer View');
}

/**
* @return string
*/
public function getTabTitle()
{
return Mage::helper('customer')->__('Customer View');
}

/**
* @return bool
*/
public function canShowTab()
{
if (Mage::registry('current_customer')->getId()) {
Expand All @@ -204,6 +243,9 @@ public function canShowTab()
return false;
}

/**
* @return bool
*/
public function isHidden()
{
if (Mage::registry('current_customer')->getId()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ protected function _drawElementHtml($element, array $attributes, $closed = true)
/**
* Return escaped value
*
* @param int $index
* @return string
* @param string|null $index
* @return false|string
*/
public function getEscapedValue($index = null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ protected function _getPreviewHtml()

/**
* Return Image URL
* @return string
* @return string|false
*/
protected function _getPreviewUrl()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,28 @@
*/
class Mage_Adminhtml_Block_Newsletter_Subscriber_Grid_Filter_Website extends Mage_Adminhtml_Block_Widget_Grid_Column_Filter_Select
{
/**
* @var Mage_Core_Model_Resource_Website_Collection
*/
protected $_websiteCollection = null;

/**
* @return array[]
*/
protected function _getOptions()
{
$result = $this->getCollection()->toOptionArray();
array_unshift($result, ['label'=>null, 'value'=>null]);
return $result;
}

/**
* @return Mage_Core_Model_Resource_Website_Collection
* @throws Mage_Core_Exception
*/
public function getCollection()
{
if(is_null($this->_websiteCollection)) {
if (is_null($this->_websiteCollection)) {
$this->_websiteCollection = Mage::getResourceModel('core/website_collection')
->load();
}
Expand All @@ -49,11 +59,14 @@ public function getCollection()
return $this->_websiteCollection;
}

/**
* @return array|null
* @throws Mage_Core_Exception
*/
public function getCondition()
{

$id = $this->getValue();
if(!$id) {
if (!$id) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
*/
class Mage_Adminhtml_Block_Review_Grid_Filter_Type extends Mage_Adminhtml_Block_Widget_Grid_Column_Filter_Select
{
/**
* @return array
*/
protected function _getOptions()
{
return [
Expand All @@ -38,6 +41,9 @@ protected function _getOptions()
];
}

/**
* @return int
*/
public function getCondition()
{
if ($this->getValue() == 1) {
Expand Down
Loading