Skip to content

Commit

Permalink
PHPStan: fixes "Call to function is_null ..." (#2831)
Browse files Browse the repository at this point in the history
  • Loading branch information
sreichel authored Dec 22, 2022
1 parent 622681a commit 3b1dac7
Show file tree
Hide file tree
Showing 187 changed files with 403 additions and 1,960 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Attributes_Create extends Ma
/**
* Config of create new attribute
*
* @var Varien_Object
* @var Varien_Object|null
*/
protected $_config = null;

Expand All @@ -49,6 +49,9 @@ public function getConfig()
return $this->_config;
}

/**
* @inheritDoc
*/
protected function _beforeToHtml()
{
$this->setId('create_attribute_' . $this->getConfig()->getGroupId())
Expand All @@ -74,6 +77,9 @@ protected function _beforeToHtml()
return parent::_beforeToHtml();
}

/**
* @return string
*/
protected function _toHtml()
{
$this->setCanShow(true);
Expand All @@ -91,6 +97,9 @@ protected function _toHtml()
return $html;
}

/**
* @return string
*/
public function getJsObjectName()
{
return $this->getId() . 'JsObject';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ abstract class Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Price_Group_Abstrac
/**
* Websites cache
*
* @var array
* @var array|null
*/
protected $_websites;

Expand Down Expand Up @@ -75,7 +75,7 @@ public function render(Varien_Data_Form_Element_Abstract $element)
* Set form element instance
*
* @param Varien_Data_Form_Element_Abstract $element
* @return Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Price_Group_Abstract
* @return $this
*/
public function setElement(Varien_Data_Form_Element_Abstract $element)
{
Expand Down Expand Up @@ -271,9 +271,8 @@ public function getPriceColumnHeader($default)
{
if ($this->hasData('price_column_header')) {
return $this->getData('price_column_header');
} else {
return $default;
}
return $default;
}

/**
Expand All @@ -286,9 +285,8 @@ public function getPriceValidation($default)
{
if ($this->hasData('price_validation')) {
return $this->getData('price_validation');
} else {
return $default;
}
return $default;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public function getProduct()
/**
* Getting attribute block name for tabs
*
* @return string
* @return string|null
*/
public function getAttributeTabBlock()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Mage_Adminhtml_Block_Customer_Edit_Renderer_Region extends Mage_Adminhtml_
/**
* Factory instance
*
* @var Mage_Core_Model_Abstract
* @var Mage_Core_Model_Factory
*/
protected $_factory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,12 @@ protected function _drawElementHtml($element, array $attributes, $closed = true)
*/
public function getEscapedValue($index = null)
{
if (is_array($this->getValue())) {
$value = $this->getValue();
if (is_array($value)) {
return false;
}
$value = $this->getValue();
if (is_array($value) && is_null($index)) {

if (is_null($index)) {
$index = 'value';
}

Expand Down
4 changes: 3 additions & 1 deletion app/code/core/Mage/Adminhtml/Block/Media/Editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
*/
class Mage_Adminhtml_Block_Media_Editor extends Mage_Adminhtml_Block_Widget
{
/** @var Varien_Object */
/**
* @var Varien_Object|null
*/
protected $_config;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
class Mage_Adminhtml_Block_Newsletter_Subscriber extends Mage_Adminhtml_Block_Template
{
/**
* @var Mage_Newsletter_Model_Resource_Queue_Collection
* @var Mage_Newsletter_Model_Resource_Queue_Collection|null
*/
protected $_queueCollection = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
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
* @var Mage_Core_Model_Resource_Website_Collection|null
*/
protected $_websiteCollection = null;

Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Adminhtml/Block/Notification/Window.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ class Mage_Adminhtml_Block_Notification_Window extends Mage_Adminhtml_Block_Noti
/**
* Severity icons url
*
* @var string
* @var string|null
*/
protected $_severityIconsUrl;

/**
* Is available flag
*
* @var bool
* @var bool|null
*/
protected $_available = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function getCustomer()
/**
* Retrieve customer identifier
*
* @return int
* @return int|null
*/
public function getCustomerId()
{
Expand All @@ -91,7 +91,7 @@ public function getStore()
/**
* Retrieve store identifier
*
* @return int
* @return int|null
*/
public function getStoreId()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ public function getSaveUrl()
return $this->getUrl('*/*/save');
}

/**
* @return string
*/
public function getCustomerSelectorDisplay()
{
$customerId = $this->getCustomerId();
Expand All @@ -61,6 +64,9 @@ public function getCustomerSelectorDisplay()
return 'none';
}

/**
* @return string
*/
public function getStoreSelectorDisplay()
{
$storeId = $this->getStoreId();
Expand All @@ -71,6 +77,9 @@ public function getStoreSelectorDisplay()
return 'none';
}

/**
* @return string
*/
public function getDataSelectorDisplay()
{
$storeId = $this->getStoreId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ abstract class Mage_Adminhtml_Block_Sales_Order_Create_Form_Abstract extends Mag
/**
* Data Form object
*
* @var Varien_Data_Form
* @var Varien_Data_Form|null
*/
protected $_form;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Mage_Adminhtml_Block_Sales_Order_Create_Form_Address extends Mage_Adminhtm
/**
* Customer Address Form instance
*
* @var Mage_Customer_Model_Form
* @var Mage_Customer_Model_Form|null
*/
protected $_addressForm;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Mage_Adminhtml_Block_Sales_Order_Create_Giftmessage_Form extends Mage_Admi
/**
* Giftmessage object
*
* @var Mage_GiftMessage_Model_Message
* @var Mage_GiftMessage_Model_Message|null
*/
protected $_giftMessage;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Mage_Adminhtml_Block_Sales_Order_View_Giftmessage extends Mage_Adminhtml_B
/**
* Entity for editing of gift message
*
* @var Mage_Sales_Model_Order
* @var Mage_Sales_Model_Order|null
*/
protected $_entity;

Expand All @@ -48,7 +48,7 @@ public function getOrder()
/**
* Giftmessage object
*
* @var Mage_GiftMessage_Model_Message
* @var Mage_GiftMessage_Model_Message|null
*/
protected $_giftMessage;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Mage_Adminhtml_Block_Shipping_Carrier_Tablerate_Grid extends Mage_Adminhtm
/**
* Website filter
*
* @var int
* @var int|null
*/
protected $_websiteId;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ protected function _getOptions()
* Render an option with selected value
*
* @param array $option
* @param string $value
* @param string|null $value
* @return string
*/
protected function _renderOption($option, $value)
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Adminhtml/Helper/Catalog.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Mage_Adminhtml_Helper_Catalog extends Mage_Core_Helper_Abstract
/**
* Attribute Tab block name for product edit
*
* @var string
* @var string|null
*/
protected $_attributeTabBlock = null;

Expand All @@ -49,7 +49,7 @@ class Mage_Adminhtml_Helper_Catalog extends Mage_Core_Helper_Abstract
/**
* Retrieve Attribute Tab Block Name for Product Edit
*
* @return string
* @return string|null
*/
public function getAttributeTabBlock()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ class Mage_Adminhtml_Helper_Catalog_Product_Edit_Action_Attribute extends Mage_C
/**
* Selected products for mass-update
*
* @var Mage_Catalog_Model_Resource_Product_Collection
* @var Mage_Catalog_Model_Resource_Product_Collection|null
*/
protected $_products;

/**
* Array of same attributes for selected products
*
* @var Mage_Eav_Model_Resource_Entity_Attribute_Collection
* @var Mage_Eav_Model_Resource_Entity_Attribute_Collection|null
*/
protected $_attributes;

Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Adminhtml/Helper/Dashboard/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ abstract class Mage_Adminhtml_Helper_Dashboard_Abstract extends Mage_Core_Helper
/**
* Helper collection
*
* @var Mage_Core_Model_Resource_Db_Collection_Abstract|Mage_Eav_Model_Entity_Collection_Abstract|array
* @var Mage_Core_Model_Resource_Db_Collection_Abstract|Mage_Eav_Model_Entity_Collection_Abstract|array|null
*/
protected $_collection;

Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Adminhtml/Model/Config/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ class Mage_Adminhtml_Model_Config_Data extends Varien_Object
/**
* Config data for sections
*
* @var array
* @var array|null
*/
protected $_configData;

/**
* Root config node
*
* @var Mage_Core_Model_Config_Element
* @var Mage_Core_Model_Config_Element|null
*/
protected $_configRoot;

Expand Down
10 changes: 5 additions & 5 deletions app/code/core/Mage/Adminhtml/Model/Sales/Order/Create.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,21 @@ class Mage_Adminhtml_Model_Sales_Order_Create extends Varien_Object implements M
/**
* Quote customer wishlist model object
*
* @var Mage_Wishlist_Model_Wishlist
* @var Mage_Wishlist_Model_Wishlist|false|null
*/
protected $_wishlist;

/**
* Sales Quote instance
*
* @var Mage_Sales_Model_Quote
* @var Mage_Sales_Model_Quote|null
*/
protected $_cart;

/**
* Catalog Compare List instance
*
* @var Mage_Catalog_Model_Product_Compare_List
* @var Mage_Catalog_Model_Product_Compare_List|false|null
*/
protected $_compareList;

Expand Down Expand Up @@ -89,14 +89,14 @@ class Mage_Adminhtml_Model_Sales_Order_Create extends Varien_Object implements M
/**
* Customer Address Form instance
*
* @var Mage_Customer_Model_Form
* @var Mage_Customer_Model_Form|null
*/
protected $_customerAddressForm;

/**
* Customer Form instance
*
* @var Mage_Customer_Model_Form
* @var Mage_Customer_Model_Form|null
*/
protected $_customerForm;

Expand Down
Loading

0 comments on commit 3b1dac7

Please sign in to comment.