Skip to content

Commit

Permalink
PHPStan: fixed calls on Varien_Object/Mage_Core_Model_Abstract (#2565)
Browse files Browse the repository at this point in the history
  • Loading branch information
sreichel authored Sep 7, 2022
1 parent 77cfd17 commit 116c5f6
Show file tree
Hide file tree
Showing 28 changed files with 61 additions and 210 deletions.
158 changes: 1 addition & 157 deletions .github/phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,6 @@ parameters:
count: 1
path: ../app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php

-
message: "#^Call to an undefined method Varien_Object\\:\\:isValidForSend\\(\\)\\.$#"
count: 1
path: ../app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Grid/Renderer/Action.php

-
message: "#^Variable \\$class might not be defined\\.$#"
count: 1
Expand Down Expand Up @@ -300,11 +295,6 @@ parameters:
count: 1
path: ../app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Newsletter.php

-
message: "#^Call to an undefined method Varien_Object\\:\\:canConfigure\\(\\)\\.$#"
count: 1
path: ../app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Search/Grid/Renderer/Product.php

-
message: "#^Variable \\$button might not be defined\\.$#"
count: 1
Expand Down Expand Up @@ -350,11 +340,6 @@ parameters:
count: 1
path: ../app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Packaging.php

-
message: "#^Call to an undefined method Varien_Object\\:\\:load\\(\\)\\.$#"
count: 1
path: ../app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Giftmessage.php

-
message: "#^Call to an undefined method Mage_Core_Model_Resource_Db_Collection_Abstract\\:\\:setOrderFilter\\(\\)\\.$#"
count: 1
Expand Down Expand Up @@ -715,16 +700,6 @@ parameters:
count: 1
path: ../app/code/core/Mage/Adminhtml/controllers/System/ConfigController.php

-
message: "#^Call to an undefined method Mage_Core_Model_Abstract\\:\\:clearAffectedEntityIds\\(\\)\\.$#"
count: 1
path: ../app/code/core/Mage/Adminhtml/controllers/System/Convert/ProfileController.php

-
message: "#^Cannot call method saveRow\\(\\) on Mage_Core_Model_Abstract\\|false\\.$#"
count: 1
path: ../app/code/core/Mage/Adminhtml/controllers/System/Convert/ProfileController.php

-
message: "#^Variable \\$data in isset\\(\\) always exists and is not nullable\\.$#"
count: 1
Expand Down Expand Up @@ -765,16 +740,6 @@ parameters:
count: 1
path: ../app/code/core/Mage/Adminhtml/controllers/Tax/RateController.php

-
message: "#^Call to an undefined method Mage_Core_Model_Abstract\\:\\:addError\\(\\)\\.$#"
count: 3
path: ../app/code/core/Mage/Adminhtml/controllers/Tax/RuleController.php

-
message: "#^Call to an undefined method Mage_Core_Model_Abstract\\:\\:addSuccess\\(\\)\\.$#"
count: 1
path: ../app/code/core/Mage/Adminhtml/controllers/Tax/RuleController.php

-
message: "#^Method Mage_Adminhtml_Tax_RuleController\\:\\:saveAction\\(\\) should return Mage_Core_Controller_Response_Http\\|Mage_Core_Controller_Varien_Action but return statement is missing\\.$#"
count: 1
Expand Down Expand Up @@ -1090,11 +1055,6 @@ parameters:
count: 2
path: ../app/code/core/Mage/Bundle/Model/Product/Type.php

-
message: "#^Call to an undefined method Varien_Object\\:\\:isMultiSelection\\(\\)\\.$#"
count: 2
path: ../app/code/core/Mage/Bundle/Model/Product/Type.php

-
message: "#^Method Mage_Bundle_Model_Product_Type\\:\\:beforeSave\\(\\) should return Mage_Catalog_Model_Product_Type_Abstract but return statement is missing\\.$#"
count: 1
Expand All @@ -1105,11 +1065,6 @@ parameters:
count: 1
path: ../app/code/core/Mage/Bundle/Model/Product/Type.php

-
message: "#^Call to an undefined method Varien_Object\\:\\:addSelection\\(\\)\\.$#"
count: 1
path: ../app/code/core/Mage/Bundle/Model/Resource/Option/Collection.php

-
message: "#^Variable \\$basePrice might not be defined\\.$#"
count: 2
Expand Down Expand Up @@ -1445,18 +1400,13 @@ parameters:
count: 1
path: ../app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Media.php

-
message: "#^Call to an undefined method Varien_Object\\:\\:isRecurring\\(\\)\\.$#"
count: 1
path: ../app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Recurring.php

-
message: "#^Method Mage_Catalog_Model_Product_Attribute_Backend_Recurring\\:\\:beforeSave\\(\\) should return \\$this\\(Mage_Catalog_Model_Product_Attribute_Backend_Recurring\\) but return statement is missing\\.$#"
count: 1
path: ../app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Recurring.php

-
message: "#^Cannot call method getBackend\\(\\) on bool\\|Mage_Catalog_Model_Resource_Eav_Mysql4_Attribute\\.$#"
message: "#^Cannot call method getBackend\\(\\) on bool\\|Mage_Catalog_Model_Resource_Attribute\\.$#"
count: 11
path: ../app/code/core/Mage/Catalog/Model/Product/Attribute/Media/Api.php

Expand Down Expand Up @@ -1545,11 +1495,6 @@ parameters:
count: 1
path: ../app/code/core/Mage/Catalog/Model/Resource/Abstract.php

-
message: "#^Call to an undefined method Mage_Core_Model_Abstract\\:\\:isScopeGlobal\\(\\)\\.$#"
count: 1
path: ../app/code/core/Mage/Catalog/Model/Resource/Attribute.php

-
message: "#^Variable \\$ids in empty\\(\\) always exists and is not falsy\\.$#"
count: 1
Expand Down Expand Up @@ -1710,16 +1655,6 @@ parameters:
count: 1
path: ../app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Price.php

-
message: "#^Call to an undefined method Varien_Object\\:\\:addValue\\(\\)\\.$#"
count: 1
path: ../app/code/core/Mage/Catalog/Model/Resource/Product/Option/Collection.php

-
message: "#^Cannot call method addTitleToResult\\(\\) on Mage_Core_Model_Resource_Db_Collection_Abstract\\|false\\.$#"
count: 1
path: ../app/code/core/Mage/Catalog/Model/Resource/Product/Option/Collection.php

-
message: "#^Call to an undefined method Mage_Catalog_Model_Product_Type_Abstract\\:\\:getUsedProductIds\\(\\)\\.$#"
count: 1
Expand Down Expand Up @@ -1815,11 +1750,6 @@ parameters:
count: 1
path: ../app/code/core/Mage/CatalogInventory/Model/Resource/Indexer/Stock.php

-
message: "#^Call to an undefined method Varien_Object\\:\\:isObjectNew\\(\\)\\.$#"
count: 1
path: ../app/code/core/Mage/CatalogInventory/Model/Resource/Stock/Item.php

-
message: "#^Variable \\$parentItem in empty\\(\\) always exists and is not falsy\\.$#"
count: 1
Expand Down Expand Up @@ -1995,16 +1925,6 @@ parameters:
count: 2
path: ../app/code/core/Mage/ConfigurableSwatches/Model/Resource/Catalog/Product/Type/Configurable/Product/Collection.php

-
message: "#^Call to an undefined method Mage_Core_Model_Abstract\\:\\:sessionUrlVar\\(\\)\\.$#"
count: 1
path: ../app/code/core/Mage/Core/Block/Abstract.php

-
message: "#^Static method Mage\\:\\:log\\(\\) invoked with 5 parameters, 1\\-4 required\\.$#"
count: 1
path: ../app/code/core/Mage/Core/Block/Template.php

-
message: "#^Call to an undefined method Zend_Controller_Router_Interface\\:\\:addRoute\\(\\)\\.$#"
count: 1
Expand Down Expand Up @@ -2265,16 +2185,6 @@ parameters:
count: 1
path: ../app/code/core/Mage/Customer/Model/Customer/Attribute/Backend/Password.php

-
message: "#^Call to an undefined method Varien_Object\\:\\:implodeStreetAddress\\(\\)\\.$#"
count: 1
path: ../app/code/core/Mage/Customer/Model/Resource/Address/Attribute/Backend/Street.php

-
message: "#^Call to an undefined method Varien_Object\\:\\:isConfirmationRequired\\(\\)\\.$#"
count: 1
path: ../app/code/core/Mage/Customer/Model/Resource/Customer.php

-
message: "#^Cannot call method addAttributeToSelect\\(\\) on Mage_Core_Model_Resource_Db_Collection_Abstract\\|false\\.$#"
count: 1
Expand Down Expand Up @@ -2875,32 +2785,16 @@ parameters:
count: 1
path: ../app/code/core/Mage/Index/Model/Resource/Setup.php

-
message: "#^Call to an undefined method Varien_Object\\:\\:addError\\(\\)\\.$#"
count: 2
path: ../app/code/core/Mage/Install/Model/Installer.php

-
message: "#^Constant data not found\\.$#"
count: 1
path: ../app/code/core/Mage/Install/Model/Installer.php

-
message: "#^Call to an undefined method Varien_Object\\:\\:addError\\(\\)\\.$#"
count: 2
path: ../app/code/core/Mage/Install/Model/Installer/Config.php

-
message: "#^Call to an undefined method Mage_Install_Model_Installer_Db_Abstract\\:\\:getVersion\\(\\)\\.$#"
count: 1
path: ../app/code/core/Mage/Install/Model/Installer/Db.php


-
message: "#^Call to an undefined method Varien_Object\\:\\:addError\\(\\)\\.$#"
count: 1
path: ../app/code/core/Mage/Install/Model/Installer/Filesystem.php

-
message: "#^Result of method Mage_Core_Controller_Varien_Action\\:\\:preDispatch\\(\\) \\(void\\) is used\\.$#"
count: 1
Expand Down Expand Up @@ -3401,11 +3295,6 @@ parameters:
count: 1
path: ../app/code/core/Mage/Paypal/Model/Pro.php

-
message: "#^Call to an undefined method Mage_Core_Model_Abstract\\:\\:isFailsafe\\(\\)\\.$#"
count: 1
path: ../app/code/core/Mage/Paypal/Model/Resource/Payment/Transaction.php

-
message: "#^Access to an undefined property Mage_Paypal_Model_Config\\:\\:\\$lineItemsEnabled\\.$#"
count: 1
Expand Down Expand Up @@ -3646,26 +3535,6 @@ parameters:
count: 1
path: ../app/code/core/Mage/Sales/Model/Order/Api.php

-
message: "#^Call to an undefined method Mage_Core_Model_Abstract\\:\\:addComment\\(\\)\\.$#"
count: 1
path: ../app/code/core/Mage/Sales/Model/Order/Creditmemo/Api.php

-
message: "#^Call to an undefined method Mage_Core_Model_Abstract\\:\\:canCancel\\(\\)\\.$#"
count: 1
path: ../app/code/core/Mage/Sales/Model/Order/Creditmemo/Api.php

-
message: "#^Call to an undefined method Mage_Core_Model_Abstract\\:\\:cancel\\(\\)\\.$#"
count: 1
path: ../app/code/core/Mage/Sales/Model/Order/Creditmemo/Api.php

-
message: "#^Call to an undefined method Mage_Core_Model_Abstract\\:\\:sendUpdateEmail\\(\\)\\.$#"
count: 1
path: ../app/code/core/Mage/Sales/Model/Order/Creditmemo/Api.php

-
message: "#^Variable \\$data in isset\\(\\) always exists and is not nullable\\.$#"
count: 1
Expand Down Expand Up @@ -3891,11 +3760,6 @@ parameters:
count: 1
path: ../app/code/core/Mage/Shipping/Model/Carrier/Pickup.php

-
message: "#^Call to an undefined method Mage_Core_Model_Abstract\\:\\:append\\(\\)\\.$#"
count: 3
path: ../app/code/core/Mage/Shipping/Model/Carrier/Tablerate.php

-
message: "#^Variable \\$rate in empty\\(\\) always exists and is not falsy\\.$#"
count: 3
Expand Down Expand Up @@ -3961,21 +3825,6 @@ parameters:
count: 1
path: ../app/code/core/Mage/Tag/Model/Tag.php

-
message: "#^Call to an undefined method Mage_Core_Model_Abstract\\:\\:checkDiscountSettings\\(\\)\\.$#"
count: 2
path: ../app/code/core/Mage/Tax/Block/Adminhtml/Notifications.php

-
message: "#^Call to an undefined method Mage_Core_Model_Abstract\\:\\:checkDisplaySettings\\(\\)\\.$#"
count: 2
path: ../app/code/core/Mage/Tax/Block/Adminhtml/Notifications.php

-
message: "#^Call to an undefined method Mage_Core_Model_Abstract\\:\\:isAllowed\\(\\)\\.$#"
count: 1
path: ../app/code/core/Mage/Tax/Block/Adminhtml/Notifications.php

-
message: "#^Call to an undefined method Mage_Tax_Block_Sales_Order_Tax\\:\\:addTotal\\(\\)\\.$#"
count: 7
Expand Down Expand Up @@ -4106,11 +3955,6 @@ parameters:
count: 2
path: ../app/code/core/Mage/Wishlist/Model/Item.php

-
message: "#^Call to an undefined method Varien_Object\\:\\:isInStock\\(\\)\\.$#"
count: 1
path: ../app/code/core/Mage/Wishlist/Model/Resource/Item/Collection.php

-
message: "#^Variable \\$item might not be defined\\.$#"
count: 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Mage_Adminhtml_Block_Newsletter_Template_Grid_Renderer_Action extends Mage
/**
* Renderer for "Action" column in Newsletter templates grid
*
* @param Mage_Newsletter_Model_Template|Varien_Object $row
* @param Mage_Newsletter_Model_Template $row
* @return string
*/
public function render(Varien_Object $row)
Expand Down
12 changes: 2 additions & 10 deletions app/code/core/Mage/Adminhtml/Block/Page/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ protected function _buildMenuArray(Varien_Simplexml_Element $parent, $path='', $
/**
* Sort menu comparison function
*
* @param int $a
* @param int $b
* @param array $a
* @param array $b
* @return int
*/
protected function _sortMenu($a, $b)
Expand Down Expand Up @@ -220,14 +220,6 @@ protected function _checkDepends(Varien_Simplexml_Element $depends)
return true;
}

/*protected function _checkAcl(Varien_Simplexml_Element $acl)
{
return true;
$resource = (string)$acl->resource;
$privilege = (string)$acl->privilege;
return Mage::getSingleton('admin/session')->isAllowed($resource, $privilege);
}*/

/**
* Check is Allow menu item for admin user
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Mage_Adminhtml_Block_Sales_Order_Create_Search_Grid_Renderer_Product exten
/**
* Render product name to add Configure link
*
* @param Varien_Object $row
* @param Mage_Catalog_Model_Product $row
* @return string
*/
public function render(Varien_Object $row)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Mage_Adminhtml_Block_Sales_Order_View_Giftmessage extends Mage_Adminhtml_B
/**
* Entity for editing of gift message
*
* @var Mage_Eav_Model_Entity_Abstract
* @var Mage_Sales_Model_Order
*/
protected $_entity;

Expand Down Expand Up @@ -99,7 +99,7 @@ public function getSaveButtonHtml()
/**
* Set entity for form
*
* @param Varien_Object $entity
* @param Mage_Sales_Model_Order $entity
* @return $this
*/
public function setEntity(Varien_Object $entity)
Expand All @@ -111,7 +111,7 @@ public function setEntity(Varien_Object $entity)
/**
* Retrieve entity for form
*
* @return Varien_Object
* @return Mage_Sales_Model_Order
* @throws Exception
*/
public function getEntity()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ public function batchRunAction()
$batchImportModel = $batchModel->getBatchImportModel();
$importIds = $batchImportModel->getIdCollection();

/** @var Mage_Catalog_Model_Convert_Adapter_Product $adapter */
$adapter = Mage::getModel($batchModel->getAdapter());
$adapter->setBatchParams($batchModel->getParams());

Expand Down
Loading

0 comments on commit 116c5f6

Please sign in to comment.