diff --git a/.phpstan.dist.baseline.neon b/.phpstan.dist.baseline.neon index 490e2ca5037..1022bc6b374 100644 --- a/.phpstan.dist.baseline.neon +++ b/.phpstan.dist.baseline.neon @@ -60,11 +60,6 @@ parameters: count: 1 path: app/code/core/Mage/Adminhtml/Block/Cache/Grid.php - - - message: "#^Return type \\(false\\) of method Mage_Adminhtml_Block_Cache_Grid\\:\\:getRowUrl\\(\\) should be compatible with return type \\(string\\) of method Mage_Adminhtml_Block_Widget_Grid\\:\\:getRowUrl\\(\\)$#" - count: 1 - path: app/code/core/Mage/Adminhtml/Block/Cache/Grid.php - - message: "#^Parameter \\#1 \\$renderer of method Varien_Data_Form_Element_Abstract\\:\\:setRenderer\\(\\) expects Varien_Data_Form_Element_Renderer_Interface, Mage_Core_Block_Abstract\\|false given\\.$#" count: 1 @@ -305,16 +300,6 @@ parameters: count: 1 path: app/code/core/Mage/Adminhtml/Block/Rating/Edit/Tab/Form.php - - - message: "#^Parameter \\#2 \\$min of function mktime expects int, null given\\.$#" - count: 1 - path: app/code/core/Mage/Adminhtml/Block/Report/Config/Form/Field/YtdStart.php - - - - message: "#^Parameter \\#3 \\$sec of function mktime expects int, null given\\.$#" - count: 1 - path: app/code/core/Mage/Adminhtml/Block/Report/Config/Form/Field/YtdStart.php - - message: "#^Parameter \\#1 \\$collection of method Mage_Adminhtml_Block_Widget_Grid\\:\\:setCollection\\(\\) expects Mage_Core_Model_Resource_Db_Collection_Abstract, Mage_Reports_Model_Resource_Report_Collection given\\.$#" count: 1 @@ -495,11 +480,6 @@ parameters: count: 1 path: app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Form/Abstract.php - - - message: "#^Parameter \\#1 \\$addressId of method Mage_Customer_Model_Customer\\:\\:getAddressById\\(\\) expects int, null given\\.$#" - count: 1 - path: app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Form/Address.php - - message: "#^Method Mage_Adminhtml_Block_Sales_Order_Create_Giftmessage_Form\\:\\:getEntity\\(\\) should return Varien_Object but returns Mage_Eav_Model_Entity_Abstract\\.$#" count: 1 @@ -775,11 +755,6 @@ parameters: count: 1 path: app/code/core/Mage/Adminhtml/Block/Tax/Rate/Grid/Renderer/Data.php - - - message: "#^Parameter \\#1 \\$number of function number_format expects float, string\\|null given\\.$#" - count: 1 - path: app/code/core/Mage/Adminhtml/Block/Tax/Rate/Grid/Renderer/Data.php - - message: "#^Parameter \\#1 \\$classTypeId of method Mage_Tax_Model_Resource_Class_Collection\\:\\:setClassTypeFilter\\(\\) expects int, string given\\.$#" count: 2 @@ -905,21 +880,6 @@ parameters: count: 1 path: app/code/core/Mage/Adminhtml/Model/Config.php - - - message: "#^Parameter \\#1 \\$sectionNode of method Mage_Adminhtml_Model_Config\\:\\:getAttributeModule\\(\\) expects Varien_Simplexml_Element\\|null, array\\\\|false\\|null given\\.$#" - count: 1 - path: app/code/core/Mage/Adminhtml/Model/Config.php - - - - message: "#^Parameter \\#2 \\$groupNode of method Mage_Adminhtml_Model_Config\\:\\:getAttributeModule\\(\\) expects Varien_Simplexml_Element\\|null, array\\\\|false\\|null given\\.$#" - count: 1 - path: app/code/core/Mage/Adminhtml/Model/Config.php - - - - message: "#^Parameter \\#3 \\$fieldNode of method Mage_Adminhtml_Model_Config\\:\\:getAttributeModule\\(\\) expects Varien_Simplexml_Element\\|null, array\\\\|false\\|null given\\.$#" - count: 1 - path: app/code/core/Mage/Adminhtml/Model/Config.php - - message: "#^Property Mage_Adminhtml_Model_Config\\:\\:\\$_config \\(Mage_Core_Model_Config_Base\\) does not accept Varien_Simplexml_Config\\.$#" count: 1 @@ -1005,11 +965,6 @@ parameters: count: 1 path: app/code/core/Mage/Adminhtml/Model/System/Config/Source/Country.php - - - message: "#^Method Mage_Adminhtml_Model_System_Store\\:\\:__construct\\(\\) with return type void returns \\$this\\(Mage_Adminhtml_Model_System_Store\\) but should not return anything\\.$#" - count: 1 - path: app/code/core/Mage/Adminhtml/Model/System/Store.php - - message: "#^Variable \\$values might not be defined\\.$#" count: 1 @@ -1210,11 +1165,6 @@ parameters: count: 1 path: app/code/core/Mage/Adminhtml/controllers/Tax/RateController.php - - - message: "#^Parameter \\#1 \\$id of method Mage_Core_Model_Abstract\\:\\:load\\(\\) expects int\\|string, null given\\.$#" - count: 2 - path: app/code/core/Mage/Adminhtml/controllers/Tax/RateController.php - - message: "#^Parameter \\#1 \\$ruleModel of method Mage_Adminhtml_Tax_RuleController\\:\\:_isValidRuleRequest\\(\\) expects Mage_Tax_Model_Calculation_Rule, Mage_Core_Model_Abstract given\\.$#" count: 1 @@ -1265,11 +1215,6 @@ parameters: count: 1 path: app/code/core/Mage/Api/Model/Roles.php - - - message: "#^Parameter \\#3 \\$level of method Mage_Api_Model_Roles\\:\\:_buildResourcesArray\\(\\) expects int, null given\\.$#" - count: 2 - path: app/code/core/Mage/Api/Model/Roles.php - - message: "#^Call to an undefined method Mage_Api_Model_Resource_Rules\\:\\:update\\(\\)\\.$#" count: 1 @@ -2210,11 +2155,6 @@ parameters: count: 1 path: app/code/core/Mage/Catalog/Model/Category/Api.php - - - message: "#^Parameter \\#2 \\$store of method Mage_Catalog_Helper_Product\\:\\:getProduct\\(\\) expects int, null given\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Model/Category/Api.php - - message: "#^Method Mage_Eav_Model_Entity_Attribute_Source_Interface\\:\\:getAllOptions\\(\\) invoked with 1 parameter, 0 required\\.$#" count: 1 @@ -2470,11 +2410,6 @@ parameters: count: 1 path: app/code/core/Mage/Catalog/Model/Product/Indexer/Eav.php - - - message: "#^Parameter \\#2 \\$store of method Mage_Catalog_Helper_Product\\:\\:getProduct\\(\\) expects int, null given\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Model/Product/Link/Api.php - - message: "#^Method Mage_Catalog_Model_Product_Option\\:\\:getValuesCollection\\(\\) should return Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Option_Value_Collection but returns Mage_Catalog_Model_Resource_Product_Option_Value_Collection\\.$#" count: 1 @@ -2800,11 +2735,6 @@ parameters: count: 1 path: app/code/core/Mage/Catalog/Model/Resource/Category/Tree.php - - - message: "#^Parameter \\#1 \\$children of method Varien_Data_Tree_Dbp\\:\\:addChildNodes\\(\\) expects Varien_Data_Tree_Node, array\\\\> given\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Model/Resource/Category/Tree.php - - message: "#^Parameter \\#1 \\$connection of method Varien_Data_Tree_Dbp\\:\\:__construct\\(\\) expects Zend_Db_Adapter_Abstract, Varien_Db_Adapter_Interface\\|false given\\.$#" count: 1 @@ -2895,11 +2825,6 @@ parameters: count: 1 path: app/code/core/Mage/Catalog/Model/Resource/Product/Attribute/Backend/Urlkey.php - - - message: "#^Parameter \\#1 \\$storeId of method Mage_Catalog_Model_Url\\:\\:refreshProductRewrites\\(\\) expects int, null given\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Model/Resource/Product/Attribute/Backend/Urlkey.php - - message: "#^Parameter \\#2 \\$resourceModel of method Mage_Core_Model_Resource_Db_Collection_Abstract\\:\\:_init\\(\\) expects Mage_Core_Model_Resource_Db_Abstract\\|null, string given\\.$#" count: 1 @@ -3165,11 +3090,6 @@ parameters: count: 1 path: app/code/core/Mage/CatalogIndex/Model/Resource/Data/Grouped.php - - - message: "#^Method Mage_CatalogIndex_Model_Resource_Indexer_Abstract\\:\\:saveIndex\\(\\) with return type void returns mixed but should not return anything\\.$#" - count: 1 - path: app/code/core/Mage/CatalogIndex/Model/Resource/Indexer/Abstract.php - - message: "#^Parameter \\#3 \\$storeIds of method Mage_CatalogIndex_Model_Resource_Setup\\:\\:_setWebsiteInfo\\(\\) expects array, Mage_Core_Model_Website given\\.$#" count: 1 @@ -3195,11 +3115,6 @@ parameters: count: 1 path: app/code/core/Mage/CatalogInventory/Model/Observer.php - - - message: "#^Parameter \\#1 \\$type of method Mage_Sales_Model_Quote\\:\\:removeErrorInfosByParams\\(\\) expects string, null given\\.$#" - count: 1 - path: app/code/core/Mage/CatalogInventory/Model/Observer.php - - message: "#^Cannot call method setTypeId\\(\\) on Mage_Core_Model_Resource_Db_Collection_Abstract\\|false\\.$#" count: 1 @@ -3535,11 +3450,6 @@ parameters: count: 1 path: app/code/core/Mage/Checkout/Model/Observer.php - - - message: "#^Parameter \\#1 \\$quoteId of method Mage_Checkout_Model_Session\\:\\:setQuoteId\\(\\) expects int, null given\\.$#" - count: 2 - path: app/code/core/Mage/Checkout/Model/Session.php - - message: "#^Call to an undefined method Mage_Sales_Model_Order\\:\\:createFromQuoteAddress\\(\\)\\.$#" count: 1 @@ -3750,11 +3660,6 @@ parameters: count: 1 path: app/code/core/Mage/Core/Model/Abstract.php - - - message: "#^Method Mage_Core_Model_App\\:\\:getAnyStoreView\\(\\) should return Mage_Core_Model_Store but return statement is missing\\.$#" - count: 1 - path: app/code/core/Mage/Core/Model/App.php - - message: "#^Method Mage_Core_Model_App\\:\\:getResponse\\(\\) should return Mage_Core_Controller_Response_Http but returns Zend_Controller_Response_Http\\.$#" count: 1 @@ -3910,11 +3815,6 @@ parameters: count: 1 path: app/code/core/Mage/Core/Model/Email/Template/Filter.php - - - message: "#^Parameter \\#2 \\$name of method Mage_Core_Model_Layout\\:\\:createBlock\\(\\) expects string, null given\\.$#" - count: 1 - path: app/code/core/Mage/Core/Model/Email/Template/Filter.php - - message: "#^Call to an undefined method Varien_Crypt_Abstract\\:\\:init\\(\\)\\.$#" count: 1 @@ -4025,11 +3925,6 @@ parameters: count: 1 path: app/code/core/Mage/Core/Model/Locale.php - - - message: "#^Method Mage_Core_Model_Message_Collection\\:\\:getMessageByIdentifier\\(\\) should return Mage_Core_Model_Message_Abstract\\|null but return statement is missing\\.$#" - count: 1 - path: app/code/core/Mage/Core/Model/Message/Collection.php - - message: "#^Call to an undefined method Mage_Core_Model_Resource_Type_Abstract\\:\\:getConnection\\(\\)\\.$#" count: 1 @@ -4565,11 +4460,6 @@ parameters: count: 1 path: app/code/core/Mage/Directory/Helper/Data.php - - - message: "#^Parameter \\#1 \\$storeId of method Mage_Directory_Helper_Data\\:\\:_getRegions\\(\\) expects string, int\\|null given\\.$#" - count: 1 - path: app/code/core/Mage/Directory/Helper/Data.php - - message: "#^Property Mage_Directory_Helper_Data\\:\\:\\$_countryCollection \\(Mage_Directory_Model_Resource_Country_Collection\\) does not accept Mage_Core_Model_Resource_Db_Collection_Abstract\\.$#" count: 1 @@ -5280,16 +5170,6 @@ parameters: count: 1 path: app/code/core/Mage/Index/Model/Lock/Storage/Db.php - - - message: "#^Parameter \\#1 \\$namespace of method Mage_Index_Model_Event\\:\\:setDataNamespace\\(\\) expects string, null given\\.$#" - count: 1 - path: app/code/core/Mage/Index/Model/Process.php - - - - message: "#^Parameter \\#1 \\$process of method Mage_Index_Model_Event\\:\\:setProcess\\(\\) expects Mage_Index_Model_Process, null given\\.$#" - count: 1 - path: app/code/core/Mage/Index/Model/Process.php - - message: "#^Parameter \\#2 \\$status of method Mage_Index_Model_Event\\:\\:addProcessId\\(\\) expects string, null given\\.$#" count: 1 @@ -5475,11 +5355,6 @@ parameters: count: 2 path: app/code/core/Mage/Paygate/Model/Authorizenet.php - - - message: "#^Parameter \\#3 \\$lastTransactionId of method Mage_Paygate_Helper_Data\\:\\:getExtendedTransactionMessage\\(\\) expects string, null given\\.$#" - count: 1 - path: app/code/core/Mage/Paygate/Model/Authorizenet.php - - message: "#^Variable \\$defaultExceptionMessage might not be defined\\.$#" count: 2 @@ -6815,31 +6690,6 @@ parameters: count: 1 path: app/code/core/Mage/Sales/Model/Quote/Item.php - - - message: "#^Method Mage_Sales_Model_Quote_Item\\:\\:__clone\\(\\) with return type void returns \\$this\\(Mage_Sales_Model_Quote_Item\\) but should not return anything\\.$#" - count: 1 - path: app/code/core/Mage/Sales/Model/Quote/Item.php - - - - message: "#^Return type \\(void\\) of method Mage_Sales_Model_Quote_Item\\:\\:__clone\\(\\) should be compatible with return type \\(\\$this\\(Mage_Sales_Model_Quote_Item_Abstract\\)\\) of method Mage_Sales_Model_Quote_Item_Abstract\\:\\:__clone\\(\\)$#" - count: 1 - path: app/code/core/Mage/Sales/Model/Quote/Item.php - - - - message: "#^Method Mage_Sales_Model_Quote_Item_Abstract\\:\\:__clone\\(\\) with return type void returns \\$this\\(Mage_Sales_Model_Quote_Item_Abstract\\) but should not return anything\\.$#" - count: 1 - path: app/code/core/Mage/Sales/Model/Quote/Item/Abstract.php - - - - message: "#^Parameter \\#1 \\$value of method Mage_Sales_Model_Quote_Item_Abstract\\:\\:setConvertedPrice\\(\\) expects float, null given\\.$#" - count: 1 - path: app/code/core/Mage/Sales/Model/Quote/Item/Abstract.php - - - - message: "#^Method Mage_Sales_Model_Quote_Item_Option\\:\\:__clone\\(\\) with return type void returns \\$this\\(Mage_Sales_Model_Quote_Item_Option\\) but should not return anything\\.$#" - count: 1 - path: app/code/core/Mage/Sales/Model/Quote/Item/Option.php - - message: "#^Call to Exception\\:\\:__construct\\(\\) on a separate line has no effect\\.$#" count: 1 @@ -7950,11 +7800,6 @@ parameters: count: 1 path: app/code/core/Mage/Wishlist/Model/Item.php - - - message: "#^Method Mage_Wishlist_Model_Item_Option\\:\\:__clone\\(\\) with return type void returns \\$this\\(Mage_Wishlist_Model_Item_Option\\) but should not return anything\\.$#" - count: 1 - path: app/code/core/Mage/Wishlist/Model/Item/Option.php - - message: "#^Parameter \\#1 \\$collection of method Mage_Adminhtml_Helper_Sales\\:\\:applySalableProductTypesFilter\\(\\) expects Mage_Core_Model_Resource_Db_Collection_Abstract, Mage_Catalog_Model_Resource_Product_Collection given\\.$#" count: 1 @@ -7965,16 +7810,6 @@ parameters: count: 1 path: app/code/core/Mage/Wishlist/Model/Wishlist.php - - - message: "#^Method Mage_Wishlist_IndexController\\:\\:_addItemToWishList\\(\\) with return type void returns mixed but should not return anything\\.$#" - count: 1 - path: app/code/core/Mage/Wishlist/controllers/IndexController.php - - - - message: "#^Method Mage_Wishlist_IndexController\\:\\:downloadCustomOptionAction\\(\\) with return type void returns mixed but should not return anything\\.$#" - count: 3 - path: app/code/core/Mage/Wishlist/controllers/IndexController.php - - message: "#^Parameter \\#1 \\$qty of method Mage_Wishlist_Model_Item\\:\\:setQty\\(\\) expects int, float given\\.$#" count: 1 @@ -8175,16 +8010,6 @@ parameters: count: 1 path: lib/Varien/Data/Tree.php - - - message: "#^Parameter \\#1 \\$children of method Varien_Data_Tree_Dbp\\:\\:_addChildNodes\\(\\) expects Varien_Data_Tree_Node, array\\\\> given\\.$#" - count: 1 - path: lib/Varien/Data/Tree/Dbp.php - - - - message: "#^Parameter \\#1 \\$children of method Varien_Data_Tree_Dbp\\:\\:addChildNodes\\(\\) expects Varien_Data_Tree_Node, array\\\\> given\\.$#" - count: 1 - path: lib/Varien/Data/Tree/Dbp.php - - message: "#^Method Varien_Data_Tree\\:\\:load\\(\\) invoked with 2 parameters, 0\\-1 required\\.$#" count: 1 @@ -8359,8 +8184,3 @@ parameters: message: "#^Parameter \\#2 \\$timestamp of function gmdate expects int, float given\\.$#" count: 1 path: shell/indexer.php - - - - message: "#^Parameter \\#1 \\$id of method Mage_Cms_Model_Page\\:\\:load\\(\\) expects int\\|string, null given\\.$#" - count: 1 - path: tests/unit/Mage/Cms/Model/PageTest.php diff --git a/app/code/core/Mage/Adminhtml/Block/Cache/Grid.php b/app/code/core/Mage/Adminhtml/Block/Cache/Grid.php index 5fc53be1dc9..5b62a360d7c 100644 --- a/app/code/core/Mage/Adminhtml/Block/Cache/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Cache/Grid.php @@ -52,17 +52,15 @@ protected function _prepareCollection() */ protected function _afterLoadCollection() { - foreach ($this->_collection as $item) { - } return $this; } /** * @inheritDoc + * @throws Exception */ protected function _prepareColumns() { - $baseUrl = $this->getUrl(); $this->addColumn('cache_type', [ 'header' => $this->__('Cache Type'), 'width' => '180', @@ -104,6 +102,7 @@ protected function _prepareColumns() * * @return string */ + // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassAfterLastUsed public function decorateStatus($value, $row, $column, $isExport) { $class = ''; @@ -122,11 +121,12 @@ public function decorateStatus($value, $row, $column, $isExport) /** * Get row edit url * - * @return false + * @return string */ + // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass public function getRowUrl($row) { - return false; + return ''; } /** diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Config/Form/Field/YtdStart.php b/app/code/core/Mage/Adminhtml/Block/Report/Config/Form/Field/YtdStart.php index bda4888dec4..7d6e6a69c36 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Config/Form/Field/YtdStart.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Config/Form/Field/YtdStart.php @@ -26,7 +26,7 @@ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) $_months = []; for ($i = 1; $i <= 12; $i++) { $_months[$i] = Mage::app()->getLocale() - ->date(mktime(0, null, null, $i)) + ->date(mktime(0, 0, 0, $i)) ->get(Zend_Date::MONTH_NAME); } diff --git a/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Grid/Renderer/Data.php b/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Grid/Renderer/Data.php index 8cabdffacb9..b7fac64f4b6 100644 --- a/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Grid/Renderer/Data.php +++ b/app/code/core/Mage/Adminhtml/Block/Tax/Rate/Grid/Renderer/Data.php @@ -25,7 +25,7 @@ protected function _getValue(Varien_Object $row) { $data = parent::_getValue($row); if ((int) $data == $data) { - return (string) number_format($data, 2); + return (string) number_format((float)$data, 2); } if (!is_null($data)) { return $data * 1; diff --git a/app/code/core/Mage/Adminhtml/Model/Config.php b/app/code/core/Mage/Adminhtml/Model/Config.php index fc1d71c3dc1..0bc549a88c0 100644 --- a/app/code/core/Mage/Adminhtml/Model/Config.php +++ b/app/code/core/Mage/Adminhtml/Model/Config.php @@ -199,9 +199,9 @@ public function hasChildren($node, $websiteCode = null, $storeCode = null, $isFi /** * Get translate module name * - * @param Varien_Simplexml_Element $sectionNode - * @param Varien_Simplexml_Element $groupNode - * @param Varien_Simplexml_Element $fieldNode + * @param Varien_Simplexml_Element|false|null $sectionNode + * @param Varien_Simplexml_Element|false|null $groupNode + * @param Varien_Simplexml_Element|false|null $fieldNode * @return string */ public function getAttributeModule($sectionNode = null, $groupNode = null, $fieldNode = null) diff --git a/app/code/core/Mage/Adminhtml/Model/System/Store.php b/app/code/core/Mage/Adminhtml/Model/System/Store.php index 428a8b7a6a2..651bcb45c2d 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Store.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Store.php @@ -54,12 +54,10 @@ class Mage_Adminhtml_Model_System_Store extends Varien_Object /** * Init model * Load Website, Group and Store collections - * - * @return $this */ public function __construct() { - return $this->reload(); + $this->reload(); } /** diff --git a/app/code/core/Mage/Api/Model/Roles.php b/app/code/core/Mage/Api/Model/Roles.php index bc4b5712aa1..43708b6048f 100644 --- a/app/code/core/Mage/Api/Model/Roles.php +++ b/app/code/core/Mage/Api/Model/Roles.php @@ -71,7 +71,7 @@ public function getUsersCollection() */ public function getResourcesTree() { - return $this->_buildResourcesArray(null, null, null, null, true); + return $this->_buildResourcesArray(null, null, 0, null, true); } /** @@ -87,7 +87,7 @@ public function getResourcesList() */ public function getResourcesList2D() { - return $this->_buildResourcesArray(null, null, null, true); + return $this->_buildResourcesArray(null, null, 0, true); } /** diff --git a/app/code/core/Mage/Catalog/Helper/Product.php b/app/code/core/Mage/Catalog/Helper/Product.php index 09aacc9e8f6..53f81912664 100644 --- a/app/code/core/Mage/Catalog/Helper/Product.php +++ b/app/code/core/Mage/Catalog/Helper/Product.php @@ -439,7 +439,7 @@ public function addParamsToBuyRequest($buyRequest, $params) * Return loaded product instance * * @param int|string $productId (SKU or ID) - * @param int $store + * @param int|null $store * @param string $identifierType * @return Mage_Catalog_Model_Product */ diff --git a/app/code/core/Mage/Catalog/Model/Product.php b/app/code/core/Mage/Catalog/Model/Product.php index 241385c7d4f..758762bb9dc 100644 --- a/app/code/core/Mage/Catalog/Model/Product.php +++ b/app/code/core/Mage/Catalog/Model/Product.php @@ -219,8 +219,8 @@ * * @method string getTaxClassId() * @method string getThumbnail() - * @method float getTaxPercent() - * @method $this setTaxPercent(float $value) + * @method float|null getTaxPercent() + * @method $this setTaxPercent(float|null $value) * @method $this setTypeId(int $value) * @method bool getTypeHasOptions() * @method $this setTypeHasOptions(bool $value) @@ -944,7 +944,7 @@ public function getFormatedPrice() * products it's called very often in Item->getProduct(). So removing chain of magic with more cpu consuming * algorithms gives nice optimization boost. * - * @param float $price Price amount + * @param float|null $price Price amount * @return $this */ public function setFinalPrice($price) diff --git a/app/code/core/Mage/Catalog/Model/Url.php b/app/code/core/Mage/Catalog/Model/Url.php index e84dd4f53d7..ffdabca39ad 100644 --- a/app/code/core/Mage/Catalog/Model/Url.php +++ b/app/code/core/Mage/Catalog/Model/Url.php @@ -134,7 +134,7 @@ protected function _addCategoryUrlPath($category) /** * Retrieve stores array or store model * - * @param int $storeId + * @param int|null $storeId * @return Mage_Core_Model_Store|Mage_Core_Model_Store[] */ public function getStores($storeId = null) @@ -312,6 +312,7 @@ protected function _refreshCategoryRewrites(Varien_Object $category, $parentPath * Refresh product rewrite * * @return $this + * @throws Mage_Core_Exception */ protected function _refreshProductRewrite(Varien_Object $product, Varien_Object $category) { @@ -502,7 +503,7 @@ public function refreshProductRewrite($productId, $storeId = null) /** * Refresh all product rewrites for designated store * - * @param int $storeId + * @param int|null $storeId * @return $this */ public function refreshProductRewrites($storeId) diff --git a/app/code/core/Mage/CatalogIndex/Model/Resource/Indexer/Abstract.php b/app/code/core/Mage/CatalogIndex/Model/Resource/Indexer/Abstract.php index ce13be66eaa..e51345d0110 100644 --- a/app/code/core/Mage/CatalogIndex/Model/Resource/Indexer/Abstract.php +++ b/app/code/core/Mage/CatalogIndex/Model/Resource/Indexer/Abstract.php @@ -52,7 +52,7 @@ protected function _construct() */ public function saveIndex($data, $storeId, $productId) { - return $this->saveIndices([$data], $storeId, $productId); + $this->saveIndices([$data], $storeId, $productId); } /** @@ -70,6 +70,7 @@ public function saveIndices(array $data, $storeId, $productId) * @param int $productId * @return $this */ + // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed protected function _executeReplace($data, $storeId, $productId) { $this->beginTransaction(); @@ -118,6 +119,7 @@ public function loadAttributeCodesByCondition($conditions) $select = $this->_getReadAdapter()->select(); $select->from(['main_table' => $table], 'attribute_id') ->join(['additional_table' => $this->getTable('catalog/eav_attribute')], 'additional_table.attribute_id=main_table.attribute_id'); + // phpcs:ignore Ecg.Sql.SlowQuery.SlowSql $select->distinct(true); if (is_array($conditions)) { diff --git a/app/code/core/Mage/CatalogInventory/Model/Observer.php b/app/code/core/Mage/CatalogInventory/Model/Observer.php index 2ec5cc30c7b..51347cdbdb1 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Observer.php +++ b/app/code/core/Mage/CatalogInventory/Model/Observer.php @@ -57,7 +57,7 @@ class Mage_CatalogInventory_Model_Observer * Add stock information to product * * @param Varien_Event_Observer $observer - * @return Mage_CatalogInventory_Model_Observer + * @return $this */ public function addInventoryData($observer) { @@ -77,7 +77,7 @@ public function addInventoryData($observer) * Remove stock information from static variable * * @param Varien_Event_Observer $observer - * @return Mage_CatalogInventory_Model_Observer + * @return $this */ public function removeInventoryData($observer) { @@ -96,7 +96,7 @@ public function removeInventoryData($observer) * Used in for product collection after load * * @param Varien_Event_Observer $observer - * @return Mage_CatalogInventory_Model_Observer + * @return $this */ public function addStockStatusToCollection($observer) { @@ -117,7 +117,7 @@ public function addStockStatusToCollection($observer) * Add Stock items to product collection * * @param Varien_Event_Observer $observer - * @return Mage_CatalogInventory_Model_Observer + * @return $this */ public function addInventoryDataToCollection($observer) { @@ -130,7 +130,7 @@ public function addInventoryDataToCollection($observer) * Saving product inventory data. Product qty calculated dynamically. * * @param Varien_Event_Observer $observer - * @return Mage_CatalogInventory_Model_Observer + * @return $this */ public function saveInventoryData($observer) { @@ -158,7 +158,7 @@ public function saveInventoryData($observer) * Copy product inventory data (used for product duplicate functionality) * * @param Varien_Event_Observer $observer - * @return Mage_CatalogInventory_Model_Observer + * @return $this */ public function copyInventoryData($observer) { @@ -300,6 +300,7 @@ protected function _removeErrorsFromQuoteAndItem($item, $code) * * @param Varien_Event_Observer $observer * @return $this + * @throws Mage_Core_Exception */ public function checkQuoteItemQty($observer) { @@ -729,7 +730,7 @@ protected function _getProductsQty($relatedItems) * Refresh stock index for specific stock items after successful order placement * * @param Varien_Event_Observer $observer - * @return Mage_CatalogInventory_Model_Observer + * @return $this */ public function reindexQuoteInventory($observer) { @@ -771,6 +772,7 @@ public function reindexQuoteInventory($observer) // Reindex previously remembered items $productIds = []; foreach ($this->_itemsForReindex as $item) { + // phpcs:ignore Ecg.Performance.Loop.ModelLSD $item->save(); $productIds[] = $item->getProductId(); } @@ -823,7 +825,7 @@ public function refundOrderInventory($observer) * Cancel order item * * @param Varien_Event_Observer $observer - * @return Mage_CatalogInventory_Model_Observer + * @return $this */ public function cancelOrderItem($observer) { @@ -845,8 +847,9 @@ public function cancelOrderItem($observer) * Update items stock status and low stock date. * * @param Varien_Event_Observer $observer - * @return Mage_CatalogInventory_Model_Observer + * @return $this */ + // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found public function updateItemsStockUponConfigChange($observer) { Mage::getResourceSingleton('cataloginventory/stock')->updateSetOutOfStock(); @@ -956,7 +959,7 @@ public function addStockStatusFilterToSelect(Varien_Event_Observer $observer) * some orders in one time * @deprecated after 1.4 * @param Varien_Event_Observer $observer - * @return Mage_CatalogInventory_Model_Observer + * @return $this */ public function lockOrderInventoryData($observer) { @@ -989,7 +992,7 @@ public function lockOrderInventoryData($observer) * * @deprecated after 1.4 * @param Varien_Event_Observer $observer - * @return Mage_CatalogInventory_Model_Observer + * @return $this */ public function createOrderItem($observer) { @@ -1013,7 +1016,7 @@ public function createOrderItem($observer) * * @deprecated after 1.4 * @param Varien_Event_Observer $observer - * @return Mage_CatalogInventory_Model_Observer + * @return $this */ public function refundOrderItem($observer) { @@ -1031,7 +1034,9 @@ public function refundOrderItem($observer) * Reindex all events of product-massAction type * * @param Varien_Event_Observer $observer + * @throws Exception */ + // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found public function reindexProductsMassAction($observer) { Mage::getSingleton('index/indexer')->indexEvents( diff --git a/app/code/core/Mage/Checkout/Model/Session.php b/app/code/core/Mage/Checkout/Model/Session.php index 1ada7495c71..8e54c8056c4 100644 --- a/app/code/core/Mage/Checkout/Model/Session.php +++ b/app/code/core/Mage/Checkout/Model/Session.php @@ -17,7 +17,7 @@ * @category Mage * @package Mage_Checkout * - * @method $this setAdditionalMessages(array $value) + * @method $this setAdditionalMessages(array|null $value) * * @method string getCartCouponCode() * @method $this setCartCouponCode(string $value) @@ -44,9 +44,9 @@ * @method int getLastAddedProductId() * @method $this setLastAddedProductId(int $value) * @method int getLastBillingAgreementId() - * @method $this setLastBillingAgreementId(int $value) + * @method $this setLastBillingAgreementId(int|null $value) * @method int getLastOrderId() - * @method $this setLastOrderId(int $value) + * @method $this setLastOrderId(int|null $value) * @method $this unsLastOrderId() * @method int getLastQuoteId() * @method $this setLastQuoteId(int $value) @@ -55,9 +55,9 @@ * @method $this setLastRealOrderId(string $value) * @method $this unsLastRealOrderId() * @method int getLastRecurringProfileIds() - * @method $this setLastRecurringProfileIds(array $value) + * @method $this setLastRecurringProfileIds(array|null $value) * @method int getLastSuccessQuoteId() - * @method $this setLastSuccessQuoteId(int $value) + * @method $this setLastSuccessQuoteId(int|null $value) * @method $this unsLastSuccessQuoteId() * * @method array getMethodData() @@ -257,7 +257,7 @@ protected function _getQuoteIdKey() } /** - * @param int $quoteId + * @param int|null $quoteId */ public function setQuoteId($quoteId) { @@ -461,7 +461,7 @@ public function addQuoteItemMessage($itemId, $message) } /** - * @return Mage_Core_Model_Session_Abstract|void + * @return $this */ public function clear() { @@ -469,6 +469,7 @@ public function clear() $this->_quote = null; $this->setQuoteId(null); $this->setLastSuccessQuoteId(null); + return $this; } /** diff --git a/app/code/core/Mage/Core/Model/Abstract.php b/app/code/core/Mage/Core/Model/Abstract.php index a4bad05c568..e0219c6c21e 100644 --- a/app/code/core/Mage/Core/Model/Abstract.php +++ b/app/code/core/Mage/Core/Model/Abstract.php @@ -275,7 +275,7 @@ public function getCollection() /** * Load object data * - * @param string|int $id + * @param string|null|int $id * @param string|null $field * @return $this */ diff --git a/app/code/core/Mage/Core/Model/App.php b/app/code/core/Mage/Core/Model/App.php index d26e563a6d0..d941a147598 100644 --- a/app/code/core/Mage/Core/Model/App.php +++ b/app/code/core/Mage/Core/Model/App.php @@ -1524,7 +1524,7 @@ public function getUseSessionVar() /** * Get either default or any store view * - * @return Mage_Core_Model_Store + * @return Mage_Core_Model_Store|void */ public function getAnyStoreView() { diff --git a/app/code/core/Mage/Core/Model/Layout.php b/app/code/core/Mage/Core/Model/Layout.php index 232c1cfcabc..eb46e4e4aca 100644 --- a/app/code/core/Mage/Core/Model/Layout.php +++ b/app/code/core/Mage/Core/Model/Layout.php @@ -57,7 +57,7 @@ class Mage_Core_Model_Layout extends Varien_Simplexml_Config protected $_helpers = []; /** - * Flag to have blocks' output go directly to browser as oppose to return result + * Flag to have blocks' output go directly to browser as opposed to return result * * @var bool */ @@ -139,7 +139,7 @@ public function getDirectOutput() } /** - * Loyout xml generation + * Layout xml generation * * @return $this */ @@ -313,6 +313,7 @@ protected function _generateAction($node, $parent) $helperName = implode('/', $helperName); $arg = $arg->asArray(); unset($arg['@']); + // phpcs:ignore Ecg.Security.ForbiddenFunction.Found $args[$key] = call_user_func_array([Mage::helper($helperName), $helperMethod], $arg); } else { /** @@ -343,6 +344,7 @@ protected function _generateAction($node, $parent) Mage::helper('core/security')->validateAgainstBlockMethodBlacklist($block, $method, $args); $this->_translateLayoutNode($node, $args); + // phpcs:ignore Ecg.Security.ForbiddenFunction.Found call_user_func_array([$block, $method], array_values($args)); } @@ -356,6 +358,7 @@ protected function _generateAction($node, $parent) * @param string[] $args * @throws Mage_Core_Exception */ + // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassAfterLastUsed protected function validateAgainstBlacklist(Mage_Core_Block_Abstract $block, $method, array $args) { foreach ($this->invalidActions as $action) { @@ -391,6 +394,7 @@ protected function _translateLayoutNode($node, &$args) $argumentHierarchy = explode('.', $translatableArgumentName); $argumentStack = &$args; $canTranslate = true; + // phpcs:ignore Ecg.Performance.Loop.ArraySize while (is_array($argumentStack) && count($argumentStack) > 0) { $argumentName = array_shift($argumentHierarchy); if (isset($argumentStack[$argumentName])) { @@ -443,7 +447,7 @@ public function unsetBlock($name) * Block Factory * * @param string $type - * @param string $name + * @param string|null $name * @return Mage_Core_Block_Abstract|false */ public function createBlock($type, $name = '', array $attributes = []) @@ -502,6 +506,7 @@ protected function _getBlockInstance($block, array $attributes = []) } } if (class_exists($block, false) || mageFindClassFile($block)) { + // phpcs:ignore Ecg.Classes.ObjectInstantiation.DirectInstantiation $block = new $block($attributes); } } @@ -599,6 +604,7 @@ public function getBlockSingleton($type) Mage::throwException(Mage::helper('core')->__('Invalid block type: %s', $type)); } + // phpcs:ignore Ecg.Classes.ObjectInstantiation.DirectInstantiation $helper = new $className(); if ($helper) { if ($helper instanceof Mage_Core_Block_Abstract) { diff --git a/app/code/core/Mage/Core/Model/Message/Collection.php b/app/code/core/Mage/Core/Model/Message/Collection.php index 13a08b4ff90..e18e0b72bda 100644 --- a/app/code/core/Mage/Core/Model/Message/Collection.php +++ b/app/code/core/Mage/Core/Model/Message/Collection.php @@ -32,7 +32,7 @@ class Mage_Core_Model_Message_Collection /** * Adding new message to collection * - * @return Mage_Core_Model_Message_Collection + * @return Mage_Core_Model_Message_Collection */ public function add(Mage_Core_Model_Message_Abstract $message) { @@ -88,12 +88,12 @@ public function getLastAddedMessage() * Get first even message by identifier * * @param string $identifier - * @return Mage_Core_Model_Message_Abstract|null + * @return Mage_Core_Model_Message_Abstract|void */ public function getMessageByIdentifier($identifier) { - foreach ($this->_messages as $type => $messages) { - foreach ($messages as $id => $message) { + foreach ($this->_messages as $messages) { + foreach ($messages as $message) { if ($identifier === $message->getIdentifier()) { return $message; } diff --git a/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php b/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php index fffcc4e733d..cbe6105ec4d 100644 --- a/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php +++ b/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php @@ -362,7 +362,7 @@ public function getReadConnection() * Load an object * * @param mixed $value - * @param string $field field to load by (defaults to model id) + * @param string|null $field field to load by (defaults to model id) * @return $this */ public function load(Mage_Core_Model_Abstract $object, $value, $field = null) diff --git a/app/code/core/Mage/Core/Model/Resource/Store/Collection.php b/app/code/core/Mage/Core/Model/Resource/Store/Collection.php index 25f796d84fe..56845db3418 100644 --- a/app/code/core/Mage/Core/Model/Resource/Store/Collection.php +++ b/app/code/core/Mage/Core/Model/Resource/Store/Collection.php @@ -18,6 +18,9 @@ * * @category Mage * @package Mage_Core + * + * @method Mage_Core_Model_Store getItemById(int $value) + * @method Mage_Core_Model_Store[] getItems() */ class Mage_Core_Model_Resource_Store_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract { diff --git a/app/code/core/Mage/Customer/Model/Customer.php b/app/code/core/Mage/Customer/Model/Customer.php index 9a9b1b8f242..52f0149d954 100644 --- a/app/code/core/Mage/Customer/Model/Customer.php +++ b/app/code/core/Mage/Customer/Model/Customer.php @@ -29,7 +29,7 @@ * @method $this setConfirmation(bool|null $value) * @method string getCreatedAt() * @method int getCustomerId() - * @method $this setCustomerId(int $value) + * @method $this setCustomerId(int|null $value) * * @method int getDefaultBilling() * @method $this setDefaultBilling(int $value) @@ -227,6 +227,7 @@ class Mage_Customer_Model_Customer extends Mage_Core_Model_Abstract * * @var bool */ + // phpcs:ignore Ecg.PHP.PrivateClassMember.PrivateClassMemberError private static $_isConfirmationRequired; /** @@ -333,6 +334,7 @@ public function changePassword($newPassword) public function setPasswordCreatedAt($time) { $this->setData('password_created_at', $time); + // phpcs:ignore Ecg.Security.ForbiddenFunction.Found if (session_status() === PHP_SESSION_ACTIVE) { Mage::getSingleton('checkout/session')->setValidatorSessionRenewTimestamp($time); } @@ -379,7 +381,7 @@ public function addAddress(Mage_Customer_Model_Address $address) /** * Retrieve customer address by address id * - * @param int $addressId + * @param int|null $addressId * @return Mage_Customer_Model_Address */ public function getAddressById($addressId) diff --git a/app/code/core/Mage/Directory/Helper/Data.php b/app/code/core/Mage/Directory/Helper/Data.php index 7ba984161dd..d565b26b082 100644 --- a/app/code/core/Mage/Directory/Helper/Data.php +++ b/app/code/core/Mage/Directory/Helper/Data.php @@ -173,7 +173,7 @@ public function getRegionJsonByStore($storeId = null) /** * Get Regions for specific Countries - * @param string $storeId + * @param string|int|null $storeId * @return array|null * @throws Mage_Core_Exception */ diff --git a/app/code/core/Mage/Index/Model/Event.php b/app/code/core/Mage/Index/Model/Event.php index 45a47e5d4f8..094b6db0256 100644 --- a/app/code/core/Mage/Index/Model/Event.php +++ b/app/code/core/Mage/Index/Model/Event.php @@ -26,8 +26,8 @@ * @method $this setEntityPk(int $value) * @method string getCreatedAt() * @method $this setCreatedAt(string $value) - * @method $this setOldData(string $value) - * @method $this setNewData(string $value) + * @method $this setOldData(string|array $value) + * @method $this setNewData(string|array $value) * @method Varien_Object getDataObject() * @method $this setDataObject(Varien_Object $value) * @method bool hasCreatedAt() @@ -71,7 +71,7 @@ protected function _construct() /** * Specify process object * - * @param Mage_Index_Model_Process $process + * @param Mage_Index_Model_Process|null $process * @return $this */ public function setProcess($process) @@ -83,7 +83,7 @@ public function setProcess($process) /** * Get related process object * - * @return Mage_Index_Model_Process + * @return Mage_Index_Model_Process|null */ public function getProcess() { @@ -92,7 +92,7 @@ public function getProcess() /** * Specify namespace for old and new data - * @param string $namespace + * @param string|null $namespace * @return $this */ public function setDataNamespace($namespace) @@ -231,6 +231,7 @@ public function cleanNewData() * @param bool $useNamespace * @return array */ + // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass public function getOldData($useNamespace = true) { return []; @@ -264,6 +265,7 @@ public function getNewData($useNamespace = true) * @return $this * @deprecated since 1.6.2.0 */ + // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassAfterLastUsed public function addOldData($key, $value = null) { return $this; diff --git a/app/code/core/Mage/Paygate/Helper/Data.php b/app/code/core/Mage/Paygate/Helper/Data.php index f42ad3b497b..7ee597861c9 100644 --- a/app/code/core/Mage/Paygate/Helper/Data.php +++ b/app/code/core/Mage/Paygate/Helper/Data.php @@ -68,7 +68,7 @@ public function getTransactionMessage( * * @param Mage_Payment_Model_Info $payment * @param string $requestType - * @param string $lastTransactionId + * @param string|null $lastTransactionId * @param Varien_Object $card * @param float|false $amount * @param string|false $exception diff --git a/app/code/core/Mage/Sales/Model/Quote.php b/app/code/core/Mage/Sales/Model/Quote.php index b8363814552..5e930e04ede 100644 --- a/app/code/core/Mage/Sales/Model/Quote.php +++ b/app/code/core/Mage/Sales/Model/Quote.php @@ -798,6 +798,7 @@ public function addShippingAddress(Mage_Sales_Model_Quote_Address $address) * @param bool $useCache * @return Mage_Sales_Model_Resource_Quote_Item_Collection */ + // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass public function getItemsCollection($useCache = true) { if ($this->hasItemsCollection()) { @@ -1123,6 +1124,7 @@ public function addProduct(Mage_Catalog_Model_Product $product, $request = null) * @return Mage_Sales_Model_Quote_Item * @throws Mage_Core_Model_Store_Exception */ + // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassAfterLastUsed protected function _addCatalogProduct(Mage_Catalog_Model_Product $product, $qty = 1) { $newItem = false; @@ -1646,10 +1648,10 @@ public function addErrorInfo($type = 'error', $origin = null, $code = null, $mes /** * Removes error infos, that have parameters equal to passed in $params. - * $params can have following keys (if not set - then any item is good for this key): + * $params can have the following keys (if not set - then any item is good for this key): * 'origin', 'code', 'message' * - * @param string $type An internal error type ('error', 'qty', etc.), passed then to adding messages routine + * @param string|null $type An internal error type ('error', 'qty', etc.), passed then to adding messages routine * @param array $params * @return $this */ diff --git a/app/code/core/Mage/Sales/Model/Quote/Item.php b/app/code/core/Mage/Sales/Model/Quote/Item.php index 05033f7b546..42eae346a34 100644 --- a/app/code/core/Mage/Sales/Model/Quote/Item.php +++ b/app/code/core/Mage/Sales/Model/Quote/Item.php @@ -743,10 +743,12 @@ protected function _saveItemOptions() { foreach ($this->_options as $index => $option) { if ($option->isDeleted()) { + // phpcs:ignore Ecg.Performance.Loop.ModelLSD $option->delete(); unset($this->_options[$index]); unset($this->_optionsByCode[$option->getCode()]); } else { + // phpcs:ignore Ecg.Performance.Loop.ModelLSD $option->save(); } } @@ -787,8 +789,6 @@ protected function _afterSave() /** * Clone quote item - * - * @return $this */ public function __clone() { @@ -800,7 +800,6 @@ public function __clone() foreach ($options as $option) { $this->addOption(clone $option); } - return $this; } /** diff --git a/app/code/core/Mage/Sales/Model/Quote/Item/Abstract.php b/app/code/core/Mage/Sales/Model/Quote/Item/Abstract.php index 9fca0704bcf..b680590c558 100644 --- a/app/code/core/Mage/Sales/Model/Quote/Item/Abstract.php +++ b/app/code/core/Mage/Sales/Model/Quote/Item/Abstract.php @@ -32,7 +32,7 @@ * @method $this setAppliedRuleIds(string $value) * * @method bool hasBaseCalculationPrice() - * @method $this setBaseCalculationPrice(float $value) + * @method $this setBaseCalculationPrice(float|null $value) * @method $this setBaseCustomPrice(float $value) * @method float getBaseDiscountAmount() * @method $this setBaseDiscountAmount(float $value) @@ -75,7 +75,7 @@ * @method int getBaseWeeeTaxRowDisposition() * @method $this setBaseWeeeTaxRowDisposition(int $value) * - * @method $this setCalculationPrice(float $value) + * @method $this setCalculationPrice(float|null $value) * @method bool hasCustomPrice() * @method float getCustomPrice() * @@ -676,7 +676,7 @@ public function getConvertedPrice() /** * Set new value for converted price - * @param float $value + * @param float|null $value * @return $this */ public function setConvertedPrice($value) @@ -688,8 +688,6 @@ public function setConvertedPrice($value) /** * Clone quote item - * - * @return $this */ public function __clone() { @@ -697,7 +695,6 @@ public function __clone() $this->_parentItem = null; $this->_children = []; $this->_messages = []; - return $this; } /** diff --git a/app/code/core/Mage/Sales/Model/Quote/Item/Option.php b/app/code/core/Mage/Sales/Model/Quote/Item/Option.php index 142a4e2f194..725400826c3 100644 --- a/app/code/core/Mage/Sales/Model/Quote/Item/Option.php +++ b/app/code/core/Mage/Sales/Model/Quote/Item/Option.php @@ -135,13 +135,10 @@ protected function _beforeSave() /** * Clone option object - * - * @return $this */ public function __clone() { $this->setId(null); $this->_item = null; - return $this; } } diff --git a/app/code/core/Mage/Wishlist/Model/Item/Option.php b/app/code/core/Mage/Wishlist/Model/Item/Option.php index 8db8ff60566..1a869b65eb5 100644 --- a/app/code/core/Mage/Wishlist/Model/Item/Option.php +++ b/app/code/core/Mage/Wishlist/Model/Item/Option.php @@ -25,7 +25,6 @@ * @method $this setProductId(int $value) * @method int getWishlistItemId() * @method $this setWishlistItemId(int $value) - * @method int getWishlistItemId() * @method $this setValue(string $sBuyRequest) */ class Mage_Wishlist_Model_Item_Option extends Mage_Core_Model_Abstract implements Mage_Catalog_Model_Product_Configuration_Item_Option_Interface @@ -127,13 +126,10 @@ protected function _beforeSave() /** * Clone option object - * - * @return $this */ public function __clone() { $this->setId(null); $this->_item = null; - return $this; } } diff --git a/app/code/core/Mage/Wishlist/controllers/IndexController.php b/app/code/core/Mage/Wishlist/controllers/IndexController.php index 95c8ccd49fd..7b5495b0294 100644 --- a/app/code/core/Mage/Wishlist/controllers/IndexController.php +++ b/app/code/core/Mage/Wishlist/controllers/IndexController.php @@ -120,11 +120,14 @@ protected function _getWishlist($wishlistId = null) /** * Display customer wishlist + * + * @return Mage_Core_Controller_Varien_Action|void */ public function indexAction() { if (!$this->_getWishlist()) { - return $this->norouteAction(); + $this->norouteAction(); + return; } $this->loadLayout(); @@ -170,12 +173,14 @@ public function addAction() * Add the item to wish list * * @return void + * @throws Throwable */ protected function _addItemToWishList() { $wishlist = $this->_getWishlist(); if (!$wishlist) { - return $this->norouteAction(); + $this->norouteAction(); + return; } $session = Mage::getSingleton('customer/session'); @@ -247,6 +252,8 @@ protected function _addItemToWishList() /** * Action to reconfigure wishlist item + * + * @return void */ public function configureAction() { @@ -260,7 +267,8 @@ public function configureAction() } $wishlist = $this->_getWishlist($item->getWishlistId()); if (!$wishlist) { - return $this->norouteAction(); + $this->norouteAction(); + return; } Mage::register('wishlist_item', $item); @@ -344,6 +352,8 @@ public function updateItemOptionsAction() /** * Update wishlist item comments + * + * @return Mage_Core_Controller_Varien_Action|void */ public function updateAction() { @@ -352,7 +362,8 @@ public function updateAction() } $wishlist = $this->_getWishlist(); if (!$wishlist) { - return $this->norouteAction(); + $this->norouteAction(); + return; } $post = $this->getRequest()->getPost(); @@ -360,6 +371,7 @@ public function updateAction() $updatedItems = 0; foreach ($post['description'] as $itemId => $description) { + // phpcs:ignore Ecg.Performance.Loop.ModelLSD $item = Mage::getModel('wishlist/item')->load($itemId); if ($item->getWishlistId() != $wishlist->getId()) { continue; @@ -385,6 +397,7 @@ public function updateAction() } } elseif ($qty == 0) { try { + // phpcs:ignore Ecg.Performance.Loop.ModelLSD $item->delete(); } catch (Exception $e) { Mage::logException($e); @@ -401,6 +414,7 @@ public function updateAction() try { $item->setDescription($description) ->setQty($qty) + // phpcs:ignore Ecg.Performance.Loop.ModelLSD ->save(); $updatedItems++; } catch (Exception $e) { @@ -430,6 +444,8 @@ public function updateAction() /** * Remove item + * + * @return Mage_Core_Controller_Varien_Action|void */ public function removeAction() { @@ -439,11 +455,13 @@ public function removeAction() $id = (int) $this->getRequest()->getParam('item'); $item = Mage::getModel('wishlist/item')->load($id); if (!$item->getId()) { - return $this->norouteAction(); + $this->norouteAction(); + return; } $wishlist = $this->_getWishlist($item->getWishlistId()); if (!$wishlist) { - return $this->norouteAction(); + $this->norouteAction(); + return; } try { $item->delete(); @@ -553,12 +571,15 @@ public function cartAction() /** * Add cart item to wishlist and remove from cart + * + * @return Mage_Core_Controller_Varien_Action|void */ public function fromcartAction() { $wishlist = $this->_getWishlist(); if (!$wishlist) { - return $this->norouteAction(); + $this->norouteAction(); + return; } $itemId = (int) $this->getRequest()->getParam('item'); @@ -579,7 +600,6 @@ public function fromcartAction() $wishlist->addNewItem($productId, $buyRequest); - $productIds[] = $productId; $cart->getQuote()->removeItem($itemId); $cart->save(); Mage::helper('wishlist')->calculate(); @@ -623,7 +643,8 @@ public function sendAction() $wishlist = $this->_getWishlist(); if (!$wishlist) { - return $this->norouteAction(); + $this->norouteAction(); + return; } $emails = array_filter(explode(',', $this->getRequest()->getPost('emails', ''))); @@ -717,14 +738,16 @@ public function downloadCustomOptionAction() $option = Mage::getModel('wishlist/item_option')->load($this->getRequest()->getParam('id')); if (!$option->getId()) { - return $this->_forward('noRoute'); + $this->_forward('noRoute'); + return; } $optionId = null; if (str_starts_with($option->getCode(), Mage_Catalog_Model_Product_Type_Abstract::OPTION_PREFIX)) { $optionId = str_replace(Mage_Catalog_Model_Product_Type_Abstract::OPTION_PREFIX, '', $option->getCode()); if (!is_numeric($optionId)) { - return $this->_forward('noRoute'); + $this->_forward('noRoute'); + return; } } $productOption = Mage::getModel('catalog/product_option')->load($optionId); @@ -734,7 +757,8 @@ public function downloadCustomOptionAction() || $productOption->getProductId() != $option->getProductId() || $productOption->getType() != 'file' ) { - return $this->_forward('noRoute'); + $this->_forward('noRoute'); + return; } try { @@ -751,6 +775,7 @@ public function downloadCustomOptionAction() } catch (Exception $e) { $this->_forward('noRoute'); } + // phpcs:ignore Ecg.Security.LanguageConstruct.ExitUsage exit(0); } } diff --git a/composer.json b/composer.json index aa74d674b8c..7c67affa6a3 100644 --- a/composer.json +++ b/composer.json @@ -31,7 +31,7 @@ "pelago/emogrifier": "^7.0", "phpseclib/mcrypt_compat": "^2.0.3", "phpseclib/phpseclib": "^3.0.14", - "shardj/zf1-future": "1.24.0", + "shardj/zf1-future": "^1.24.1", "symfony/polyfill-php74": "^1.31", "symfony/polyfill-php80": "^1.31", "symfony/polyfill-php81": "^1.31", @@ -103,8 +103,8 @@ "PR-72 - Fix LoopSniff": "https://patch-diff.githubusercontent.com/raw/magento-ecg/coding-standard/pull/72.patch" }, "shardj/zf1-future": { - "MAG-1.1.1": "https://raw.githubusercontent.com/OpenMage/composer-patches/74862e7a9fa29dd62c5c02d585d931ce9e3c5815/patches/MAG-1.1.1.patch", - "MAG-1.9.3.0": "https://raw.githubusercontent.com/OpenMage/composer-patches/74862e7a9fa29dd62c5c02d585d931ce9e3c5815/patches/MAG-1.9.3.0.patch", + "MAG-1.1.1": "https://raw.githubusercontent.com/OpenMage/composer-patches/2ebdd7e4d2f70b11f91bd7a1bb3c5cf995a7bf93/patches/MAG-1.1.1.patch", + "MAG-1.9.3.0": "https://raw.githubusercontent.com/OpenMage/composer-patches/0cc46b2487b2913d16fe308adbb1b0c2a336cdb4/patches/MAG-1.9.3.0.patch", "MAG-1.9.3.7 - SUPEE-10415": "https://raw.githubusercontent.com/OpenMage/composer-patches/74862e7a9fa29dd62c5c02d585d931ce9e3c5815/patches/MAG-1.9.3.7.patch", "OM-918 - Add runtime cache to Zend_Locale_Data": "https://raw.githubusercontent.com/OpenMage/composer-patches/74862e7a9fa29dd62c5c02d585d931ce9e3c5815/patches/OM-918.patch", "OM-1081 - Not detecting HTTPS behind a proxy": "https://raw.githubusercontent.com/OpenMage/composer-patches/74862e7a9fa29dd62c5c02d585d931ce9e3c5815/patches/OM-1081.patch", diff --git a/composer.lock b/composer.lock index f3f449e1270..c513c60b230 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "b0b46837fbb9629c0ea41b63b9c84c00", + "content-hash": "5c164bfdfd01cced28e1b11221d14509", "packages": [ { "name": "colinmollenhour/cache-backend-redis", @@ -1045,16 +1045,16 @@ }, { "name": "shardj/zf1-future", - "version": "1.24.0", + "version": "1.24.1", "source": { "type": "git", "url": "https://github.com/Shardj/zf1-future.git", - "reference": "b87c1507cd10c01d9b3b1bc4a0cae32f6a9c6d6c" + "reference": "f009a0db2ebab9d7fd993db825e398e517d0531c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Shardj/zf1-future/zipball/b87c1507cd10c01d9b3b1bc4a0cae32f6a9c6d6c", - "reference": "b87c1507cd10c01d9b3b1bc4a0cae32f6a9c6d6c", + "url": "https://api.github.com/repos/Shardj/zf1-future/zipball/f009a0db2ebab9d7fd993db825e398e517d0531c", + "reference": "f009a0db2ebab9d7fd993db825e398e517d0531c", "shasum": "" }, "require": { @@ -1067,10 +1067,11 @@ "zendframework/zendframework1": ">=1.12.20" }, "require-dev": { + "friendsofphp/php-cs-fixer": "^3", "php-parallel-lint/php-parallel-lint": "^1.3", "phpunit/phpunit": "^7|^8|^9", - "rector/rector": "^0.12.19", - "yoast/phpunit-polyfills": "2.0" + "rector/rector": "0.12.19 || ^1.2", + "yoast/phpunit-polyfills": "^2.0" }, "suggest": { "ext-mbstring": "Multibyte strings handling" @@ -1094,16 +1095,16 @@ "BSD-3-Clause" ], "description": "Zend Framework 1. The aim is to keep ZF1 working with the latest PHP versions", - "homepage": "http://framework.zend.com/", + "homepage": "https://github.com/Shardj/zf1-future/", "keywords": [ "ZF1", "framework" ], "support": { "issues": "https://github.com/Shardj/zf1-future/issues", - "source": "https://github.com/Shardj/zf1-future/tree/1.24.0" + "source": "https://github.com/Shardj/zf1-future/tree/release-1.24.1" }, - "time": "2024-02-05T16:48:33+00:00" + "time": "2024-10-15T16:42:29+00:00" }, { "name": "symfony/console", diff --git a/lib/Varien/Data/Tree/Dbp.php b/lib/Varien/Data/Tree/Dbp.php index 1fa289fb9d9..05b652533a8 100644 --- a/lib/Varien/Data/Tree/Dbp.php +++ b/lib/Varien/Data/Tree/Dbp.php @@ -162,6 +162,7 @@ public function load($parentNode = null, $recursionLevel = 0) $select->order($this->_table . '.' . $this->_orderField . ' ASC'); if ($parentPath) { $pathField = $this->_conn->quoteIdentifier([$this->_table, $this->_pathField]); + // phpcs:ignore Ecg.Sql.SlowQuery.SlowRawSql $select->where("{$pathField} LIKE ?", "{$parentPath}/%"); } if ($recursionLevel != 0) { @@ -169,6 +170,7 @@ public function load($parentNode = null, $recursionLevel = 0) $select->where("{$levelField} <= ?", $startLevel + $recursionLevel); } + // phpcs:ignore Ecg.Performance.FetchAll.Found $arrNodes = $this->_conn->fetchAll($select); $childrenItems = []; @@ -189,7 +191,7 @@ public function load($parentNode = null, $recursionLevel = 0) } /** - * @param Varien_Data_Tree_Node $children + * @param Varien_Data_Tree_Node|array $children * @param string $path * @param Varien_Data_Tree_Node $parentNode * @param int $level @@ -198,7 +200,7 @@ public function addChildNodes($children, $path, $parentNode, $level = 0) { if (isset($children[$path])) { foreach ($children[$path] as $child) { - $nodeId = isset($child[$this->_idField]) ? $child[$this->_idField] : false; + $nodeId = $child[$this->_idField] ?? false; if ($parentNode && $nodeId && $node = $parentNode->getChildren()->searchById($nodeId)) { $node->addData($child); } else { @@ -344,6 +346,7 @@ public function loadEnsuredNodes($category, $rootNode) $select->where($condition); } + // phpcs:ignore Ecg.Performance.FetchAll.Found $arrNodes = $this->_conn->fetchAll($select); if ($arrNodes) { @@ -365,7 +368,7 @@ public function loadEnsuredNodes($category, $rootNode) } /** - * @param Varien_Data_Tree_Node $children + * @param Varien_Data_Tree_Node|array $children * @param string $path * @param Varien_Data_Tree_Node $parentNode * @param bool $withChildren