From 4b6ad3938d25caf35ea11e7ab7a0b272bc69cb5a Mon Sep 17 00:00:00 2001 From: Sven Reichel Date: Thu, 28 Nov 2024 18:34:05 +0100 Subject: [PATCH 1/2] PhpStan: some fixes (#4363) * phpstan * No new/modified lines in baseline * add "methods" --------- Co-authored-by: Ng Kiat Siong --- .phpstan.dist.baseline.neon | 582 +----------------- .../Sales/Order/Address/Form/Renderer/Vat.php | 5 +- .../Sales/Order/Create/Shipping/Address.php | 2 +- .../Block/System/Config/Form/Fieldset.php | 2 +- .../core/Mage/Adminhtml/Block/Widget/Grid.php | 2 +- .../Mage/Authorizenet/Model/Directpost.php | 6 +- .../Authorizenet/Model/Directpost/Request.php | 2 +- .../Model/Sales/Order/Pdf/Items/Abstract.php | 6 +- .../core/Mage/Catalog/Block/Navigation.php | 4 +- .../Mage/Catalog/Block/Product/Abstract.php | 6 +- .../Catalog/Block/Product/List/Toolbar.php | 8 +- .../core/Mage/Catalog/Block/Product/New.php | 2 +- .../Block/Product/Widget/Html/Pager.php | 2 +- .../Catalog/Block/Seo/Sitemap/Product.php | 2 +- app/code/core/Mage/Catalog/Helper/Data.php | 4 +- app/code/core/Mage/Catalog/Helper/Product.php | 2 +- .../Mage/Catalog/Model/Api2/Product/Rest.php | 2 +- .../Model/Api2/Product/Rest/Admin/V1.php | 2 +- .../core/Mage/Catalog/Model/Category/Url.php | 4 +- app/code/core/Mage/Catalog/Model/Design.php | 2 +- app/code/core/Mage/Catalog/Model/Factory.php | 16 +- app/code/core/Mage/Catalog/Model/Product.php | 6 +- .../core/Mage/Catalog/Model/Product/Api.php | 4 +- .../Model/Product/Type/Configurable/Price.php | 2 +- .../Mage/Catalog/Model/Resource/Attribute.php | 2 +- .../Model/Resource/Category/Collection.php | 2 +- .../Mage/Catalog/Model/Resource/Product.php | 2 +- .../Model/Resource/Product/Compare/Item.php | 2 +- .../Mage/Catalog/Model/Resource/Setup.php | 2 +- .../core/Mage/Catalog/Model/Resource/Url.php | 4 +- .../Mage/CatalogIndex/Model/Data/Abstract.php | 4 +- .../Model/Resource/Data/Abstract.php | 2 +- .../CatalogInventory/Model/Stock/Item/Api.php | 2 +- .../Model/Stock/Item/Api/V2.php | 2 +- .../Model/Action/Index/Refresh.php | 8 +- .../CatalogSearch/Block/Advanced/Result.php | 2 +- app/code/core/Mage/Core/Model/Cache.php | 2 +- app/code/core/Mage/Core/Model/Cookie.php | 2 +- app/code/core/Mage/Core/Model/Store.php | 4 +- .../core/Mage/Customer/Model/Customer.php | 2 + .../core/Mage/Directory/Model/Currency.php | 2 +- .../Model/Resource/Entity/Attribute/Group.php | 2 +- .../Mage/Eav/Model/Resource/Form/Type.php | 4 +- .../Block/Adminhtml/Export/Filter.php | 7 +- .../Model/Export/Entity/Product.php | 3 +- .../ImportExport/Model/Import/Adapter/Csv.php | 8 +- .../Model/Import/Entity/Product.php | 2 +- app/code/core/Mage/Index/Model/Event.php | 4 +- .../core/Mage/Index/Model/Lock/Storage/Db.php | 2 +- app/code/core/Mage/Index/Model/Process.php | 2 +- app/code/core/Mage/Oauth/Helper/Data.php | 2 +- app/code/core/Mage/Page/Block/Html/Pager.php | 2 +- .../core/Mage/Paygate/Model/Authorizenet.php | 29 +- app/code/core/Mage/Payment/Helper/Data.php | 1 + .../System/Config/Fieldset/Group.php | 2 +- app/code/core/Mage/Paypal/Model/Api/Nvp.php | 2 +- .../controllers/HostedproController.php | 5 +- .../Paypal/controllers/PayflowController.php | 5 +- .../controllers/PayflowadvancedController.php | 5 +- app/code/core/Mage/PaypalUk/Model/Api/Nvp.php | 2 +- .../Model/Resource/Rating/Collection.php | 2 +- .../Resource/Product/Lowstock/Collection.php | 2 +- .../Model/Resource/Wishlist/Collection.php | 2 +- .../core/Mage/Sales/Block/Order/Recent.php | 2 +- .../Mage/Usa/Model/Shipping/Carrier/Usps.php | 14 +- lib/Varien/Data/Collection.php | 8 +- 66 files changed, 145 insertions(+), 695 deletions(-) diff --git a/.phpstan.dist.baseline.neon b/.phpstan.dist.baseline.neon index 00de356bd16..95570fa970a 100644 --- a/.phpstan.dist.baseline.neon +++ b/.phpstan.dist.baseline.neon @@ -130,16 +130,6 @@ parameters: count: 1 path: app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Wishlist.php - - - message: "#^Method Mage_Adminhtml_Block_Customer_Sales_Order_Address_Form_Renderer_Vat\\:\\:getValidateButton\\(\\) should return Mage_Adminhtml_Block_Widget_Button but returns Mage_Core_Block_Abstract\\.$#" - count: 1 - path: app/code/core/Mage/Adminhtml/Block/Customer/Sales/Order/Address/Form/Renderer/Vat.php - - - - message: "#^Property Mage_Adminhtml_Block_Customer_Sales_Order_Address_Form_Renderer_Vat\\:\\:\\$_validateButton \\(Mage_Adminhtml_Block_Widget_Button\\|null\\) does not accept Mage_Core_Block_Abstract\\.$#" - count: 1 - path: app/code/core/Mage/Adminhtml/Block/Customer/Sales/Order/Address/Form/Renderer/Vat.php - - message: "#^Access to an undefined property Mage_Adminhtml_Block_Notification_Window\\:\\:\\$_aclResourcePath\\.$#" count: 1 @@ -245,11 +235,6 @@ parameters: count: 1 path: app/code/core/Mage/Adminhtml/Block/Report/Product/Grid.php - - - message: "#^Parameter \\#1 \\$fields of method Mage_Reports_Model_Resource_Product_Lowstock_Collection\\:\\:joinInventoryItem\\(\\) expects array, string given\\.$#" - count: 1 - path: app/code/core/Mage/Adminhtml/Block/Report/Product/Lowstock/Grid.php - - message: "#^Parameter \\#1 \\$collection of method Mage_Adminhtml_Block_Widget_Grid\\:\\:setCollection\\(\\) expects Varien_Data_Collection_Db, Varien_Data_Collection given\\.$#" count: 1 @@ -270,21 +255,11 @@ parameters: count: 1 path: app/code/core/Mage/Adminhtml/Block/Review/Grid/Filter/Type.php - - - message: "#^Parameter \\#1 \\$storeId of method Mage_Rating_Model_Resource_Rating_Collection\\:\\:setStoreFilter\\(\\) expects int, array given\\.$#" - count: 1 - path: app/code/core/Mage/Adminhtml/Block/Review/Rating/Detailed.php - - message: "#^Method Mage_Adminhtml_Block_Sales_Order_Create_Billing_Address\\:\\:getAddress\\(\\) should return Mage_Customer_Model_Address but returns Mage_Sales_Model_Quote_Address\\.$#" count: 1 path: app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Billing/Address.php - - - message: "#^Parameter \\#1 \\$currency of method Mage_Directory_Model_Currency\\:\\:getCurrencyRates\\(\\) expects string, Mage_Directory_Model_Currency given\\.$#" - count: 1 - path: app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Data.php - - message: "#^Parameter \\#1 \\$renderer of static method Varien_Data_Form\\:\\:setElementRenderer\\(\\) expects Varien_Data_Form_Element_Renderer_Interface, Mage_Core_Block_Abstract\\|false given\\.$#" count: 1 @@ -310,21 +285,11 @@ parameters: count: 1 path: app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Giftmessage/Form.php - - - message: "#^Parameter \\#1 \\$optionId of method Mage_Catalog_Model_Product\\:\\:getOptionById\\(\\) expects int, string given\\.$#" - count: 1 - path: app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Items/Grid.php - - message: "#^Call to method getIsOldCustomer\\(\\) on an unknown class Mage_Adminhtml_Model_Quote\\.$#" count: 1 path: app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Newsletter.php - - - message: "#^Method Mage_Adminhtml_Block_Sales_Order_Create_Shipping_Address\\:\\:getAddress\\(\\) should return Mage_Customer_Model_Address but returns Mage_Sales_Model_Quote_Address\\.$#" - count: 1 - path: app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Shipping/Address.php - - message: "#^Method Mage_Catalog_Model_Resource_Product_Compare_Item_Collection\\:\\:useProductItem\\(\\) invoked with 1 parameter, 0 required\\.$#" count: 1 @@ -495,11 +460,6 @@ parameters: count: 1 path: app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tab/Wizard.php - - - message: "#^Parameter \\#1 \\$currency of method Mage_Directory_Model_Currency\\:\\:getCurrencyRates\\(\\) expects string, array given\\.$#" - count: 1 - path: app/code/core/Mage/Adminhtml/Block/System/Currency/Rate/Matrix.php - - message: "#^Parameter \\#2 \\$character_mask of function rtrim expects string, int given\\.$#" count: 1 @@ -660,11 +620,6 @@ parameters: count: 1 path: app/code/core/Mage/Adminhtml/Model/Giftmessage/Save.php - - - message: "#^Parameter \\#1 \\$optionId of method Mage_Catalog_Model_Product\\:\\:getOptionById\\(\\) expects int, string given\\.$#" - count: 1 - path: app/code/core/Mage/Adminhtml/Model/Sales/Order/Create.php - - message: "#^Variable \\$billingAddress might not be defined\\.$#" count: 2 @@ -1200,36 +1155,11 @@ parameters: count: 1 path: app/code/core/Mage/Api2/Model/Route/ApiType.php - - - message: "#^Call to an undefined method Varien_Object\\:\\:decrypt\\(\\)\\.$#" - count: 1 - path: app/code/core/Mage/Authorizenet/Model/Directpost.php - - message: "#^Call to an undefined method Varien_Object\\:\\:encrypt\\(\\)\\.$#" count: 1 path: app/code/core/Mage/Authorizenet/Model/Directpost.php - - - message: "#^Parameter \\#1 \\$payment of method Mage_Authorizenet_Model_Directpost\\:\\:_getRealParentTransactionId\\(\\) expects Mage_Sales_Model_Order_Payment, Mage_Payment_Model_Info given\\.$#" - count: 2 - path: app/code/core/Mage/Authorizenet/Model/Directpost.php - - - - message: "#^Parameter \\#1 \\$payment of method Mage_Authorizenet_Model_Directpost\\:\\:_getRealParentTransactionId\\(\\) expects Mage_Sales_Model_Order_Payment, Varien_Object given\\.$#" - count: 1 - path: app/code/core/Mage/Authorizenet/Model/Directpost.php - - - - message: "#^Parameter \\#1 \\$payment of method Mage_Authorizenet_Model_Directpost\\:\\:authorize\\(\\) expects Mage_Payment_Model_Info, true given\\.$#" - count: 1 - path: app/code/core/Mage/Authorizenet/Model/Directpost.php - - - - message: "#^Parameter \\#1 \\$payment of method Mage_Paygate_Model_Authorizenet\\:\\:_buildRequest\\(\\) expects Mage_Payment_Model_Info, Varien_Object given\\.$#" - count: 1 - path: app/code/core/Mage/Authorizenet/Model/Directpost.php - - message: "#^Parameter \\#2 \\$amount of method Mage_Authorizenet_Model_Directpost\\:\\:_refund\\(\\) expects string, float given\\.$#" count: 1 @@ -1255,16 +1185,6 @@ parameters: count: 1 path: app/code/core/Mage/Authorizenet/Model/Directpost/Observer.php - - - message: "#^Parameter \\#6 \\$fpTimestamp of method Mage_Authorizenet_Model_Directpost_Request\\:\\:_generateSha2RequestSign\\(\\) expects string, int\\<1, max\\> given\\.$#" - count: 1 - path: app/code/core/Mage/Authorizenet/Model/Directpost/Request.php - - - - message: "#^Parameter \\#6 \\$fpTimestamp of method Mage_Authorizenet_Model_Directpost_Request\\:\\:generateRequestSign\\(\\) expects string, int\\<1, max\\> given\\.$#" - count: 1 - path: app/code/core/Mage/Authorizenet/Model/Directpost/Request.php - - message: "#^Call to an undefined method Mage_Payment_Model_Method_Abstract\\:\\:generateRequestFromOrder\\(\\)\\.$#" count: 1 @@ -1400,16 +1320,6 @@ parameters: count: 1 path: app/code/core/Mage/Bundle/Model/Resource/Price/Index.php - - - message: "#^Parameter \\#1 \\$item of method Mage_Bundle_Model_Sales_Order_Pdf_Items_Abstract\\:\\:canShowPriceInfo\\(\\) expects Mage_Sales_Model_Order_Item, Mage_Sales_Model_Order_Invoice_Item given\\.$#" - count: 1 - path: app/code/core/Mage/Bundle/Model/Sales/Order/Pdf/Items/Invoice.php - - - - message: "#^Parameter \\#1 \\$item of method Mage_Bundle_Model_Sales_Order_Pdf_Items_Abstract\\:\\:getValueHtml\\(\\) expects Mage_Sales_Model_Order_Item, Mage_Sales_Model_Order_Invoice_Item given\\.$#" - count: 1 - path: app/code/core/Mage/Bundle/Model/Sales/Order/Pdf/Items/Invoice.php - - message: "#^Property Mage_Captcha_Model_Zend\\:\\:\\$_helper \\(Mage_Captcha_Helper_Data\\) in empty\\(\\) is not falsy\\.$#" count: 1 @@ -1420,11 +1330,6 @@ parameters: count: 1 path: app/code/core/Mage/Captcha/Model/Zend.php - - - message: "#^Argument of an invalid type string supplied for foreach, only iterables are supported\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Block/Breadcrumbs.php - - message: "#^Argument of an invalid type string supplied for foreach, only iterables are supported\\.$#" count: 1 @@ -1435,11 +1340,6 @@ parameters: count: 2 path: app/code/core/Mage/Catalog/Block/Navigation.php - - - message: "#^Property Mage_Catalog_Block_Navigation\\:\\:\\$_currentCategoryKey \\(string\\) does not accept int\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Block/Navigation.php - - message: "#^If condition is always true\\.$#" count: 1 @@ -1450,11 +1350,6 @@ parameters: count: 1 path: app/code/core/Mage/Catalog/Block/Product.php - - - message: "#^Property Mage_Catalog_Block_Product_Abstract\\:\\:\\$_reviewsHelperBlock \\(Mage_Review_Block_Helper\\|null\\) does not accept Mage_Core_Block_Abstract\\|false\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Block/Product/Abstract.php - - message: "#^Method Mage_Catalog_Model_Resource_Product_Compare_Item_Collection\\:\\:useProductItem\\(\\) invoked with 1 parameter, 0 required\\.$#" count: 1 @@ -1465,51 +1360,11 @@ parameters: count: 1 path: app/code/core/Mage/Catalog/Block/Product/List/Crosssell.php - - - message: "#^Method Mage_Catalog_Block_Product_List_Toolbar\\:\\:getDefaultPerPageValue\\(\\) should return string but returns int\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php - - - - message: "#^Parameter \\#1 \\$array_arg of function current expects array\\|object, null given\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php - - - - message: "#^Parameter \\#1 \\$input of function array_keys expects array, string given\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php - - - - message: "#^Property Mage_Catalog_Block_Product_List_Toolbar\\:\\:\\$_availableMode \\(string\\) does not accept array\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php - - - - message: "#^Property Mage_Catalog_Block_Product_List_Toolbar\\:\\:\\$_availableMode \\(string\\) does not accept array\\\\.$#" - count: 4 - path: app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php - - - - message: "#^Property Mage_Catalog_Block_Product_List_Toolbar\\:\\:\\$_availableMode \\(string\\) does not accept default value of type array\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php - - - - message: "#^Property Mage_Catalog_Block_Product_List_Toolbar\\:\\:\\$_availableMode \\(string\\) in isset\\(\\) is not nullable\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php - - message: "#^Property Mage_Catalog_Block_Product_List_Toolbar\\:\\:\\$_collection \\(Mage_Core_Model_Resource_Db_Collection_Abstract\\) does not accept Varien_Data_Collection\\.$#" count: 1 path: app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php - - - message: "#^Property Mage_Catalog_Block_Product_New\\:\\:\\$_productsCount \\(null\\) does not accept int\\.$#" - count: 2 - path: app/code/core/Mage/Catalog/Block/Product/New.php - - message: "#^Parameter \\#1 \\$price of method Mage_Core_Model_Store\\:\\:convertPrice\\(\\) expects float, string given\\.$#" count: 1 @@ -1525,21 +1380,6 @@ parameters: count: 1 path: app/code/core/Mage/Catalog/Block/Product/View/Type/Configurable.php - - - message: "#^Parameter \\#1 \\$page of method Varien_Data_Collection\\:\\:setCurPage\\(\\) expects int, null given\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Block/Product/Widget/Html/Pager.php - - - - message: "#^Parameter \\#1 \\$size of method Varien_Data_Collection\\:\\:setPageSize\\(\\) expects int, null given\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Block/Product/Widget/Html/Pager.php - - - - message: "#^Property Mage_Catalog_Block_Product_Widget_Html_Pager\\:\\:\\$_lastPage \\(int\\) does not accept float\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Block/Product/Widget/Html/Pager.php - - message: "#^Variable \\$finish might not be defined\\.$#" count: 1 @@ -1555,11 +1395,6 @@ parameters: count: 1 path: app/code/core/Mage/Catalog/Block/Product/Widget/New.php - - - message: "#^Parameter \\#1 \\$varName of method Mage_Page_Block_Html_Pager\\:\\:setShowPerPage\\(\\) expects string, false given\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Block/Seo/Sitemap/Abstract.php - - message: "#^Parameter \\#1 \\$category \\(Mage_Catalog_Model_Category\\) of method Mage_Catalog_Block_Seo_Sitemap_Category\\:\\:getItemUrl\\(\\) should be compatible with parameter \\$item \\(Mage_Catalog_Block_Seo_Sitemap_Abstract\\) of method Mage_Catalog_Block_Seo_Sitemap_Abstract\\:\\:getItemUrl\\(\\)$#" count: 1 @@ -1570,11 +1405,6 @@ parameters: count: 1 path: app/code/core/Mage/Catalog/Block/Seo/Sitemap/Product.php - - - message: "#^Parameter \\#1 \\$varName of method Mage_Page_Block_Html_Pager\\:\\:setShowPerPage\\(\\) expects string, false given\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Block/Seo/Sitemap/Tree/Category.php - - message: "#^Variable \\$finish might not be defined\\.$#" count: 1 @@ -1625,11 +1455,6 @@ parameters: count: 3 path: app/code/core/Mage/Catalog/Helper/Product.php - - - message: "#^Method Mage_Catalog_Helper_Product\\:\\:getMinimalQty\\(\\) should return int\\|null but returns float\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Helper/Product.php - - message: "#^Ternary operator condition is always true\\.$#" count: 1 @@ -1645,11 +1470,6 @@ parameters: count: 1 path: app/code/core/Mage/Catalog/Helper/Product/Compare.php - - - message: "#^Parameter \\#1 \\$optionId of method Mage_Catalog_Model_Product\\:\\:getOptionById\\(\\) expects int, string given\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Helper/Product/Configuration.php - - message: "#^Parameter \\#3 \\$subject of function str_replace expects array\\|string, float given\\.$#" count: 1 @@ -1690,26 +1510,6 @@ parameters: count: 1 path: app/code/core/Mage/Catalog/Model/Api2/Product/Rest.php - - - message: "#^Argument of an invalid type string supplied for foreach, only iterables are supported\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Model/Api2/Product/Rest/Admin/V1.php - - - - message: "#^Parameter \\#2 \\$fields of method Mage_Catalog_Model_Api2_Product_Rest_Admin_V1\\:\\:_filterConfigValueUsed\\(\\) expects string, array\\ given\\.$#" - count: 2 - path: app/code/core/Mage/Catalog/Model/Api2/Product/Rest/Admin/V1.php - - - - message: "#^Return type \\(int\\) of method Mage_Catalog_Model_Api2_Product_Rest_Customer_V1\\:\\:_getCustomerGroupId\\(\\) should be compatible with return type \\(null\\) of method Mage_Catalog_Model_Api2_Product_Rest\\:\\:_getCustomerGroupId\\(\\)$#" - count: 1 - path: app/code/core/Mage/Catalog/Model/Api2/Product/Rest/Customer/V1.php - - - - message: "#^Return type \\(int\\) of method Mage_Catalog_Model_Api2_Product_Rest_Guest_V1\\:\\:_getCustomerGroupId\\(\\) should be compatible with return type \\(null\\) of method Mage_Catalog_Model_Api2_Product_Rest\\:\\:_getCustomerGroupId\\(\\)$#" - count: 1 - path: app/code/core/Mage/Catalog/Model/Api2/Product/Rest/Guest/V1.php - - message: "#^Call to an undefined method Mage_Core_Model_Abstract\\:\\:toOptionArray\\(\\)\\.$#" count: 1 @@ -1750,11 +1550,6 @@ parameters: count: 1 path: app/code/core/Mage/Catalog/Model/Category/Attribute/Api.php - - - message: "#^Property Mage_Catalog_Model_Category_Url\\:\\:\\$_url \\(Mage_Core_Model_Url\\) does not accept bool\\|Mage_Core_Model_Abstract\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Model/Category/Url.php - - message: "#^Call to an undefined method Mage_Catalog_Model_Config\\:\\:_init\\(\\)\\.$#" count: 1 @@ -1800,11 +1595,6 @@ parameters: count: 1 path: app/code/core/Mage/Catalog/Model/Design.php - - - message: "#^Method Mage_Catalog_Model_Design\\:\\:applyCustomDesign\\(\\) should return false\\|null but return statement is missing\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Model/Design.php - - message: "#^Variable \\$_category might not be defined\\.$#" count: 1 @@ -1815,26 +1605,6 @@ parameters: count: 1 path: app/code/core/Mage/Catalog/Model/Entity/Product/Attribute/Design/Options/Container.php - - - message: "#^Method Mage_Catalog_Model_Factory\\:\\:getCategoryUrlInstance\\(\\) should return Mage_Catalog_Model_Category_Url but returns bool\\|Mage_Core_Model_Abstract\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Model/Factory.php - - - - message: "#^Method Mage_Catalog_Model_Factory\\:\\:getCategoryUrlRewriteHelper\\(\\) should return Mage_Catalog_Helper_Category_Url_Rewrite_Interface but returns Mage_Core_Helper_Abstract\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Model/Factory.php - - - - message: "#^Method Mage_Catalog_Model_Factory\\:\\:getProductUrlInstance\\(\\) should return Mage_Catalog_Model_Product_Url but returns bool\\|Mage_Core_Model_Abstract\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Model/Factory.php - - - - message: "#^Method Mage_Catalog_Model_Factory\\:\\:getProductUrlRewriteHelper\\(\\) should return Mage_Catalog_Helper_Product_Url_Rewrite_Interface but returns Mage_Core_Helper_Abstract\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Model/Factory.php - - message: "#^Parameter \\#1 \\$attribute of method Mage_Catalog_Model_Layer\\:\\:_filterFilterableAttributes\\(\\) expects Mage_Catalog_Model_Resource_Eav_Attribute, Mage_Eav_Model_Entity_Attribute_Abstract\\|false given\\.$#" count: 1 @@ -1910,11 +1680,6 @@ parameters: count: 1 path: app/code/core/Mage/Catalog/Model/Product.php - - - message: "#^Method Mage_Catalog_Model_Product\\:\\:canBeShowInCategory\\(\\) should return bool but returns string\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Model/Product.php - - message: "#^Method Mage_Catalog_Model_Product\\:\\:getPriceModel\\(\\) should return Mage_Bundle_Model_Product_Price but returns Mage_Catalog_Model_Product_Type_Price\\.$#" count: 1 @@ -1925,16 +1690,6 @@ parameters: count: 1 path: app/code/core/Mage/Catalog/Model/Product.php - - - message: "#^Parameter \\#1 \\$productType of method Mage_Catalog_Model_Product_Api\\:\\:_checkProductTypeExists\\(\\) expects int, string given\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Model/Product/Api.php - - - - message: "#^Parameter \\#1 \\$productType of method Mage_Catalog_Model_Product_Api\\:\\:_checkProductTypeExists\\(\\) expects int, string given\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Model/Product/Api/V2.php - - message: "#^Parameter \\#2 \\$attributes of method Mage_Catalog_Model_Api_Resource\\:\\:_isAllowedAttribute\\(\\) expects array\\|null, stdClass\\|null given\\.$#" count: 1 @@ -1995,16 +1750,6 @@ parameters: count: 1 path: app/code/core/Mage/Catalog/Model/Product/Indexer/Eav.php - - - message: "#^Parameter \\#1 \\$optionId of method Mage_Catalog_Model_Product\\:\\:getOptionById\\(\\) expects int, string given\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Model/Product/Option/Api.php - - - - message: "#^Parameter \\#1 \\$optionId of method Mage_Catalog_Model_Product\\:\\:getOptionById\\(\\) expects int, string given\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Model/Product/Option/Observer.php - - message: "#^Call to an undefined method Mage_Catalog_Model_Product_Configuration_Item_Option_Interface\\:\\:getId\\(\\)\\.$#" count: 2 @@ -2030,11 +1775,6 @@ parameters: count: 1 path: app/code/core/Mage/Catalog/Model/Product/Type.php - - - message: "#^Parameter \\#1 \\$optionId of method Mage_Catalog_Model_Product\\:\\:getOptionById\\(\\) expects int, string given\\.$#" - count: 2 - path: app/code/core/Mage/Catalog/Model/Product/Type/Abstract.php - - message: "#^Call to function is_array\\(\\) with string will always evaluate to false\\.$#" count: 1 @@ -2055,16 +1795,6 @@ parameters: count: 2 path: app/code/core/Mage/Catalog/Model/Product/Type/Configurable.php - - - message: "#^Cannot access offset 'pricing_value' on true\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Model/Product/Type/Configurable/Price.php - - - - message: "#^Parameter \\#1 \\$priceInfo of method Mage_Catalog_Model_Product_Type_Configurable_Price\\:\\:_calcSelectionPrice\\(\\) expects array, true given\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Model/Product/Type/Configurable/Price.php - - message: "#^Parameter \\#2 \\$qty of method Mage_Catalog_Model_Product_Type_Price\\:\\:_applyOptionsPrice\\(\\) expects int, float\\|null given\\.$#" count: 1 @@ -2085,11 +1815,6 @@ parameters: count: 1 path: app/code/core/Mage/Catalog/Model/Product/Type/Grouped.php - - - message: "#^Parameter \\#1 \\$optionId of method Mage_Catalog_Model_Product\\:\\:getOptionById\\(\\) expects int, string given\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Model/Product/Type/Price.php - - message: "#^Parameter \\#2 \\$qty of method Mage_Catalog_Model_Product_Type_Price\\:\\:_applyOptionsPrice\\(\\) expects int, float\\|null given\\.$#" count: 1 @@ -2135,11 +1860,6 @@ parameters: count: 1 path: app/code/core/Mage/Catalog/Model/Resource/Abstract.php - - - message: "#^Method Mage_Catalog_Model_Resource_Attribute\\:\\:isUsedBySuperProducts\\(\\) should return int but returns string\\|false\\|null\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Model/Resource/Attribute.php - - message: "#^Parameter \\#1 \\$object of method Mage_Catalog_Model_Resource_Attribute\\:\\:_clearUselessAttributeValues\\(\\) expects Mage_Catalog_Model_Resource_Eav_Attribute, Mage_Eav_Model_Entity_Attribute given\\.$#" count: 1 @@ -2330,11 +2050,6 @@ parameters: count: 3 path: app/code/core/Mage/Catalog/Model/Resource/Product/Collection.php - - - message: "#^Method Mage_Catalog_Model_Resource_Product_Compare_Item\\:\\:getCount\\(\\) should return int but returns string\\|false\\|null\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Model/Resource/Product/Compare/Item.php - - message: "#^Parameter \\#1 \\$object of method Mage_Eav_Model_Entity_Collection_Abstract\\:\\:setObject\\(\\) expects Varien_Object\\|null, string given\\.$#" count: 1 @@ -2400,31 +2115,11 @@ parameters: count: 1 path: app/code/core/Mage/Catalog/Model/Resource/Product/Option.php - - - message: "#^Parameter \\#2 \\$product of method Mage_Catalog_Model_Resource_Product\\:\\:refreshEnabledIndex\\(\\) expects Mage_Catalog_Model_Product\\|null, array given\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Model/Resource/Product/Website.php - - - - message: "#^Parameter \\#1 \\$input of function array_reverse expects array, string given\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Model/Resource/Setup.php - - - - message: "#^Parameter \\#2 \\$pieces of function implode expects array, null given\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Model/Resource/Setup.php - - message: "#^Parameter \\#3 \\$default of method Mage_Eav_Model_Entity_Setup\\:\\:_getValue\\(\\) expects string\\|null, int given\\.$#" count: 15 path: app/code/core/Mage/Catalog/Model/Resource/Setup.php - - - message: "#^Parameter \\#3 \\$storeId of method Mage_Catalog_Model_Resource_Url\\:\\:_getProductAttribute\\(\\) expects string, int given\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Model/Resource/Url.php - - message: "#^Variable \\$category might not be defined\\.$#" count: 1 @@ -2435,16 +2130,6 @@ parameters: count: 2 path: app/code/core/Mage/Catalog/Model/Url.php - - - message: "#^Parameter \\#2 \\$categoryIds of method Mage_Catalog_Model_Resource_Url\\:\\:prepareRewrites\\(\\) expects array\\|int\\|null, false given\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Model/Url.php - - - - message: "#^Parameter \\#2 \\$categoryIds of method Mage_Catalog_Model_Resource_Url\\:\\:prepareRewrites\\(\\) expects array\\|int\\|null, string given\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Model/Url.php - - message: "#^Property Mage_Catalog_Model_Url\\:\\:\\$_saveRewritesHistory \\(bool\\) on left side of \\?\\? is not nullable\\.$#" count: 1 @@ -2456,7 +2141,7 @@ parameters: path: app/code/core/Mage/CatalogIndex/Model/Attribute.php - - message: "#^Parameter \\#1 \\$products of method Mage_CatalogIndex_Model_Data_Abstract\\:\\:getAttributeData\\(\\) expects array, int given\\.$#" + message: "#^Parameter \\#8 \\$productId of method Mage_Catalog_Model_Product_Type_Price\\:\\:calculatePrice\\(\\) expects int\\|null, array given\\.$#" count: 1 path: app/code/core/Mage/CatalogIndex/Model/Data/Abstract.php @@ -2470,11 +2155,6 @@ parameters: count: 1 path: app/code/core/Mage/CatalogIndex/Model/Data/Abstract.php - - - message: "#^Parameter \\#1 \\$product \\(array\\) of method Mage_CatalogIndex_Model_Data_Grouped\\:\\:getFinalPrice\\(\\) should be compatible with parameter \\$product \\(int\\) of method Mage_CatalogIndex_Model_Data_Abstract\\:\\:getFinalPrice\\(\\)$#" - count: 1 - path: app/code/core/Mage/CatalogIndex/Model/Data/Grouped.php - - message: "#^Return type \\(false\\) of method Mage_CatalogIndex_Model_Data_Grouped\\:\\:getFinalPrice\\(\\) should be compatible with return type \\(float\\) of method Mage_CatalogIndex_Model_Data_Abstract\\:\\:getFinalPrice\\(\\)$#" count: 1 @@ -2570,21 +2250,6 @@ parameters: count: 1 path: app/code/core/Mage/CatalogInventory/Model/Stock/Item.php - - - message: "#^Parameter \\#1 \\$sku of method Mage_Catalog_Model_Product\\:\\:getIdBySku\\(\\) expects string, int given\\.$#" - count: 1 - path: app/code/core/Mage/CatalogInventory/Model/Stock/Item/Api.php - - - - message: "#^Parameter \\#1 \\$sku of method Mage_Catalog_Model_Product\\:\\:getIdBySku\\(\\) expects string, int given\\.$#" - count: 1 - path: app/code/core/Mage/CatalogInventory/Model/Stock/Item/Api/V2.php - - - - message: "#^Parameter \\#1 \\$expression of class Zend_Db_Expr constructor expects string, int given\\.$#" - count: 4 - path: app/code/core/Mage/CatalogRule/Model/Action/Index/Refresh.php - - message: "#^Return type \\(int\\) of method Mage_CatalogRule_Model_Action_Index_Refresh_Row\\:\\:_getProduct\\(\\) should be compatible with return type \\(null\\) of method Mage_CatalogRule_Model_Action_Index_Refresh\\:\\:_getProduct\\(\\)$#" count: 1 @@ -2650,21 +2315,6 @@ parameters: count: 1 path: app/code/core/Mage/CatalogSearch/Block/Advanced/Form.php - - - message: "#^Parameter \\#1 \\$currency of method Mage_Directory_Model_Currency\\:\\:getCurrencyRates\\(\\) expects string, Mage_Directory_Model_Currency given\\.$#" - count: 1 - path: app/code/core/Mage/CatalogSearch/Block/Advanced/Form.php - - - - message: "#^Parameter \\#2 \\$offset of function array_slice expects int, float given\\.$#" - count: 1 - path: app/code/core/Mage/CatalogSearch/Block/Advanced/Result.php - - - - message: "#^Parameter \\#3 \\$length of function array_slice expects int\\|null, float given\\.$#" - count: 1 - path: app/code/core/Mage/CatalogSearch/Block/Advanced/Result.php - - message: "#^Variable \\$temp might not be defined\\.$#" count: 1 @@ -3080,11 +2730,6 @@ parameters: count: 1 path: app/code/core/Mage/Core/Model/Config.php - - - message: "#^Method Mage_Core_Model_Cookie\\:\\:getHttponly\\(\\) should return bool but returns null\\.$#" - count: 1 - path: app/code/core/Mage/Core/Model/Cookie.php - - message: "#^Binary operation \"\\+\" between string and string results in an error\\.$#" count: 1 @@ -3750,11 +3395,6 @@ parameters: count: 2 path: app/code/core/Mage/Dataflow/Model/Profile.php - - - message: "#^Parameter \\#1 \\$currency of method Mage_Directory_Model_Currency\\:\\:getCurrencyRates\\(\\) expects string, Mage_Directory_Model_Currency given\\.$#" - count: 1 - path: app/code/core/Mage/Directory/Block/Currency.php - - message: "#^Method Mage_Directory_Helper_Data\\:\\:getCountryCollection\\(\\) should return Mage_Directory_Model_Resource_Country_Collection but returns Mage_Core_Model_Resource_Db_Collection_Abstract\\.$#" count: 1 @@ -4210,11 +3850,6 @@ parameters: count: 1 path: app/code/core/Mage/Eav/Model/Resource/Entity/Attribute.php - - - message: "#^Method Mage_Eav_Model_Resource_Entity_Attribute_Group\\:\\:_getMaxSortOrder\\(\\) should return int but returns string\\|false\\|null\\.$#" - count: 1 - path: app/code/core/Mage/Eav/Model/Resource/Entity/Attribute/Group.php - - message: "#^Call to an undefined method Mage_Eav_Model_Entity_Collection_Abstract\\:\\:getStoreId\\(\\)\\.$#" count: 1 @@ -4230,16 +3865,6 @@ parameters: count: 2 path: app/code/core/Mage/Eav/Model/Resource/Form/Attribute/Collection.php - - - message: "#^PHPDoc tag @param for parameter \\$object with type Mage_Eav_Model_Resource_Form_Type is incompatible with native type Mage_Core_Model_Abstract\\.$#" - count: 2 - path: app/code/core/Mage/Eav/Model/Resource/Form/Type.php - - - - message: "#^Parameter \\#1 \\$object of method Mage_Eav_Model_Resource_Form_Type\\:\\:getEntityTypes\\(\\) expects Mage_Eav_Model_Form_Type, Mage_Core_Model_Abstract given\\.$#" - count: 1 - path: app/code/core/Mage/Eav/Model/Resource/Form/Type.php - - message: "#^Return type \\(stdClass\\) of method Mage_GiftMessage_Model_Api_V2\\:\\:_setGiftMessage\\(\\) should be compatible with return type \\(array\\) of method Mage_GiftMessage_Model_Api\\:\\:_setGiftMessage\\(\\)$#" count: 1 @@ -4295,11 +3920,6 @@ parameters: count: 4 path: app/code/core/Mage/ImportExport/Block/Adminhtml/Export/Filter.php - - - message: "#^Method Mage_ImportExport_Block_Adminhtml_Export_Filter\\:\\:prepareCollection\\(\\) should return Mage_Core_Model_Resource_Db_Collection_Abstract\\|null but returns Varien_Data_Collection_Db\\|null\\.$#" - count: 1 - path: app/code/core/Mage/ImportExport/Block/Adminhtml/Export/Filter.php - - message: "#^Parameter \\#1 \\$limit of method Mage_Adminhtml_Block_Widget_Grid\\:\\:setDefaultLimit\\(\\) expects int, null given\\.$#" count: 1 @@ -4320,31 +3940,11 @@ parameters: count: 1 path: app/code/core/Mage/ImportExport/Model/Export/Entity/Customer.php - - - message: "#^Call to an undefined method Mage_Eav_Model_Entity_Collection_Abstract\\:\\:addCategoryIds\\(\\)\\.$#" - count: 1 - path: app/code/core/Mage/ImportExport/Model/Export/Entity/Product.php - - - - message: "#^Call to an undefined method Mage_Eav_Model_Entity_Collection_Abstract\\:\\:setStoreId\\(\\)\\.$#" - count: 1 - path: app/code/core/Mage/ImportExport/Model/Export/Entity/Product.php - - message: "#^If condition is always true\\.$#" count: 1 path: app/code/core/Mage/ImportExport/Model/Export/Entity/Product.php - - - message: "#^Parameter \\#1 \\$value of method Mage_Catalog_Model_Resource_Category_Collection\\:\\:getItemById\\(\\) expects int, string given\\.$#" - count: 1 - path: app/code/core/Mage/ImportExport/Model/Export/Entity/Product.php - - - - message: "#^Variable \\$collection might not be defined\\.$#" - count: 1 - path: app/code/core/Mage/ImportExport/Model/Export/Entity/Product.php - - message: "#^Method Mage_Eav_Model_Entity_Attribute_Source_Interface\\:\\:getAllOptions\\(\\) invoked with 1 parameter, 0 required\\.$#" count: 1 @@ -4360,31 +3960,16 @@ parameters: count: 1 path: app/code/core/Mage/ImportExport/Model/Import/Entity/Product.php - - - message: "#^Parameter \\#1 \\$value of method Mage_Catalog_Model_Resource_Category_Collection\\:\\:getItemById\\(\\) expects int, string given\\.$#" - count: 1 - path: app/code/core/Mage/ImportExport/Model/Import/Entity/Product.php - - message: "#^Parameter \\#2 \\$callback of function array_filter expects \\(callable\\(mixed\\)\\: bool\\)\\|null, Closure\\(mixed\\)\\: int\\<0, max\\> given\\.$#" count: 1 path: app/code/core/Mage/ImportExport/Model/Import/Entity/Product.php - - - message: "#^Parameter \\#2 \\$increment of method Varien_Db_Adapter_Interface\\:\\:changeTableAutoIncrement\\(\\) expects string, int given\\.$#" - count: 1 - path: app/code/core/Mage/ImportExport/Model/Import/Entity/Product.php - - message: "#^Result of \\|\\| is always true\\.$#" count: 1 path: app/code/core/Mage/ImportExport/Model/Import/Entity/Product.php - - - message: "#^Parameter \\#1 \\$collection of method Mage_ImportExport_Model_Export\\:\\:filterAttributeCollection\\(\\) expects Mage_Eav_Model_Resource_Entity_Attribute_Collection, Mage_Core_Model_Resource_Db_Collection_Abstract\\|null given\\.$#" - count: 1 - path: app/code/core/Mage/ImportExport/controllers/Adminhtml/ExportController.php - - message: "#^Parameter \\#3 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, array\\\\|null given\\.$#" count: 1 @@ -4405,26 +3990,11 @@ parameters: count: 1 path: app/code/core/Mage/Index/Model/Lock/Storage/Db.php - - - message: "#^Method Mage_Index_Model_Lock_Storage_Db\\:\\:releaseLock\\(\\) should return int\\|null but returns bool\\.$#" - count: 1 - path: app/code/core/Mage/Index/Model/Lock/Storage/Db.php - - message: "#^Property Mage_Index_Model_Lock_Storage_Db\\:\\:\\$_helper \\(Mage_Index_Model_Resource_Helper_Mysql4\\) does not accept Mage_Core_Model_Resource_Helper_Abstract\\.$#" count: 1 path: app/code/core/Mage/Index/Model/Lock/Storage/Db.php - - - message: "#^Return type \\(int\\|null\\) of method Mage_Index_Model_Lock_Storage_Db\\:\\:releaseLock\\(\\) should be compatible with return type \\(bool\\) of method Mage_Index_Model_Lock_Storage_Interface\\:\\:releaseLock\\(\\)$#" - count: 1 - path: app/code/core/Mage/Index/Model/Lock/Storage/Db.php - - - - message: "#^Parameter \\#2 \\$status of method Mage_Index_Model_Event\\:\\:addProcessId\\(\\) expects string, null given\\.$#" - count: 1 - path: app/code/core/Mage/Index/Model/Process.php - - message: "#^Call to function is_array\\(\\) with '' will always evaluate to false\\.$#" count: 1 @@ -4525,11 +4095,6 @@ parameters: count: 1 path: app/code/core/Mage/Newsletter/Model/Subscriber.php - - - message: "#^Parameter \\#1 \\$length of function openssl_random_pseudo_bytes expects int, float given\\.$#" - count: 1 - path: app/code/core/Mage/Oauth/Helper/Data.php - - message: "#^Parameter \\#2 \\$idFieldName of method Mage_Core_Model_Resource_Db_Abstract\\:\\:_init\\(\\) expects string, null given\\.$#" count: 1 @@ -4555,61 +4120,6 @@ parameters: count: 2 path: app/code/core/Mage/Paygate/Block/Authorizenet/Form/Cc.php - - - message: "#^Cannot assign new offset to string\\.$#" - count: 1 - path: app/code/core/Mage/Paygate/Model/Authorizenet.php - - - - message: "#^Parameter \\#1 \\$payment of method Mage_Paygate_Model_Authorizenet\\:\\:_addTransaction\\(\\) expects Mage_Sales_Model_Order_Payment, Mage_Payment_Model_Info given\\.$#" - count: 7 - path: app/code/core/Mage/Paygate/Model/Authorizenet.php - - - - message: "#^Parameter \\#1 \\$payment of method Mage_Paygate_Model_Authorizenet\\:\\:_processFailureMultitransactionAction\\(\\) expects Mage_Payment_Model_Info, Varien_Object given\\.$#" - count: 1 - path: app/code/core/Mage/Paygate/Model/Authorizenet.php - - - - message: "#^Parameter \\#1 \\$payment of method Mage_Paygate_Model_Authorizenet\\:\\:_refundCardTransaction\\(\\) expects Mage_Payment_Model_Info, Varien_Object given\\.$#" - count: 1 - path: app/code/core/Mage/Paygate/Model/Authorizenet.php - - - - message: "#^Parameter \\#1 \\$payment of method Mage_Paygate_Model_Authorizenet\\:\\:getCardsStorage\\(\\) expects Mage_Payment_Model_Info\\|null, Varien_Object given\\.$#" - count: 1 - path: app/code/core/Mage/Paygate/Model/Authorizenet.php - - - - message: "#^Parameter \\#1 \\$response of method Mage_Paygate_Model_Authorizenet\\:\\:_registerCard\\(\\) expects Mage_Paygate_Model_Authorizenet_Result, Varien_Object given\\.$#" - count: 2 - path: app/code/core/Mage/Paygate/Model/Authorizenet.php - - - - message: "#^Parameter \\#2 \\$messages of method Mage_Paygate_Model_Authorizenet\\:\\:_processFailureMultitransactionAction\\(\\) expects string, array\\ given\\.$#" - count: 3 - path: app/code/core/Mage/Paygate/Model/Authorizenet.php - - - - message: "#^Parameter \\#2 \\$orderPayment of method Mage_Paygate_Model_Authorizenet\\:\\:_processPartialAuthorizationResponse\\(\\) expects Mage_Sales_Model_Order_Payment, Mage_Payment_Model_Info given\\.$#" - count: 2 - path: app/code/core/Mage/Paygate/Model/Authorizenet.php - - - - message: "#^Parameter \\#2 \\$payment of method Mage_Paygate_Model_Authorizenet\\:\\:_registerCard\\(\\) expects Mage_Sales_Model_Order_Payment, Mage_Payment_Model_Info given\\.$#" - count: 2 - path: app/code/core/Mage/Paygate/Model/Authorizenet.php - - - - message: "#^Variable \\$defaultExceptionMessage might not be defined\\.$#" - count: 2 - path: app/code/core/Mage/Paygate/Model/Authorizenet.php - - - - message: "#^Variable \\$newTransactionType might not be defined\\.$#" - count: 3 - path: app/code/core/Mage/Paygate/Model/Authorizenet.php - - message: "#^Call to an undefined method Mage_Payment_Model_Method_Abstract\\:\\:cancelPartialAuthorization\\(\\)\\.$#" count: 1 @@ -4625,21 +4135,11 @@ parameters: count: 1 path: app/code/core/Mage/Payment/Block/Catalog/Product/View/Profile.php - - - message: "#^Call to an undefined method Mage_Core_Model_Abstract\\:\\:isAvailable\\(\\)\\.$#" - count: 1 - path: app/code/core/Mage/Payment/Helper/Data.php - - message: "#^Cannot call method setInfo\\(\\) on object\\|false\\.$#" count: 1 path: app/code/core/Mage/Payment/Helper/Data.php - - - message: "#^Method Mage_Payment_Helper_Data\\:\\:getStoreMethods\\(\\) should return array\\ but returns array\\\\.$#" - count: 1 - path: app/code/core/Mage/Payment/Helper/Data.php - - message: "#^Method Mage_Payment_Model_Config\\:\\:_getMethod\\(\\) should return Mage_Payment_Model_Method_Abstract\\|false but returns Mage_Core_Model_Abstract\\.$#" count: 1 @@ -4665,11 +4165,6 @@ parameters: count: 1 path: app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Deprecated.php - - - message: "#^Method Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Group\\:\\:_getCollapseState\\(\\) should return bool but returns int\\.$#" - count: 1 - path: app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Group.php - - message: "#^Method Mage_Paypal_Block_Express_Review\\:\\:_formatPrice\\(\\) should return string but returns float\\.$#" count: 1 @@ -4710,16 +4205,6 @@ parameters: count: 1 path: app/code/core/Mage/Paypal/Model/Api/Nvp.php - - - message: "#^Method Mage_Paypal_Model_Api_Nvp\\:\\:_exportLineItems\\(\\) should return true\\|null but empty return statement found\\.$#" - count: 1 - path: app/code/core/Mage/Paypal/Model/Api/Nvp.php - - - - message: "#^Method Mage_Paypal_Model_Api_Nvp\\:\\:_exportLineItems\\(\\) should return true\\|null but returns bool\\.$#" - count: 1 - path: app/code/core/Mage/Paypal/Model/Api/Nvp.php - - message: "#^Parameter \\#1 \\$array \\(non\\-empty\\-list\\\\) of array_values is already a list, call has no effect\\.$#" count: 1 @@ -4895,21 +4380,6 @@ parameters: count: 1 path: app/code/core/Mage/Paypal/Model/System/Config/Source/MerchantCountry.php - - - message: "#^Method Mage_Paypal_HostedproController\\:\\:_getIframeBlock\\(\\) should return Mage_Paypal_Block_Hosted_Pro_Iframe but returns Mage_Core_Block_Abstract\\|false\\.$#" - count: 1 - path: app/code/core/Mage/Paypal/controllers/HostedproController.php - - - - message: "#^Method Mage_Paypal_PayflowController\\:\\:_getIframeBlock\\(\\) should return Mage_Paypal_Block_Payflow_Link_Iframe but returns Mage_Core_Block_Abstract\\|false\\.$#" - count: 1 - path: app/code/core/Mage/Paypal/controllers/PayflowController.php - - - - message: "#^Method Mage_Paypal_PayflowadvancedController\\:\\:_getIframeBlock\\(\\) should return Mage_Paypal_Block_Payflow_Advanced_Iframe but returns Mage_Core_Block_Abstract\\|false\\.$#" - count: 1 - path: app/code/core/Mage/Paypal/controllers/PayflowadvancedController.php - - message: "#^Return type \\(void\\) of method Mage_PaypalUk_Model_Pro\\:\\:fetchTransactionInfo\\(\\) should be compatible with return type \\(array\\) of method Mage_Paypal_Model_Pro\\:\\:fetchTransactionInfo\\(\\)$#" count: 1 @@ -5110,11 +4580,6 @@ parameters: count: 1 path: app/code/core/Mage/Reports/Model/Resource/Review/Collection.php - - - message: "#^Method Mage_Reports_Model_Resource_Wishlist_Collection\\:\\:getSharedCount\\(\\) should return int but returns string\\|false\\|null\\.$#" - count: 1 - path: app/code/core/Mage/Reports/Model/Resource/Wishlist/Collection.php - - message: "#^Call to an undefined method Mage_Eav_Model_Entity_Abstract\\:\\:setStore\\(\\)\\.$#" count: 1 @@ -5260,11 +4725,6 @@ parameters: count: 1 path: app/code/core/Mage/Sales/Block/Order/Details.php - - - message: "#^Parameter \\#1 \\$size of method Varien_Data_Collection\\:\\:setPageSize\\(\\) expects int, string given\\.$#" - count: 1 - path: app/code/core/Mage/Sales/Block/Order/Recent.php - - message: "#^Property Mage_Sales_Block_Recurring_Profiles\\:\\:\\$_profiles \\(Mage_Sales_Model_Resource_Recurring_Profile_Collection\\) does not accept Mage_Core_Model_Resource_Db_Collection_Abstract\\.$#" count: 1 @@ -6260,26 +5720,6 @@ parameters: count: 1 path: app/code/core/Mage/Usa/Model/Shipping/Carrier/Usps.php - - - message: "#^Parameter \\#2 \\$value of method SimpleXMLElement\\:\\:addAttribute\\(\\) expects string, int given\\.$#" - count: 2 - path: app/code/core/Mage/Usa/Model/Shipping/Carrier/Usps.php - - - - message: "#^Parameter \\#2 \\$value of method SimpleXMLElement\\:\\:addChild\\(\\) expects string\\|null, \\(float\\|int\\) given\\.$#" - count: 1 - path: app/code/core/Mage/Usa/Model/Shipping/Carrier/Usps.php - - - - message: "#^Parameter \\#2 \\$value of method SimpleXMLElement\\:\\:addChild\\(\\) expects string\\|null, float\\|int given\\.$#" - count: 1 - path: app/code/core/Mage/Usa/Model/Shipping/Carrier/Usps.php - - - - message: "#^Parameter \\#2 \\$value of method SimpleXMLElement\\:\\:addChild\\(\\) expects string\\|null, int given\\.$#" - count: 3 - path: app/code/core/Mage/Usa/Model/Shipping/Carrier/Usps.php - - message: "#^Call to an undefined method Mage_Core_Helper_Abstract\\:\\:priceIncludesTax\\(\\)\\.$#" count: 1 @@ -7500,21 +6940,11 @@ parameters: count: 24 path: app/design/frontend/base/default/template/catalog/product/gallery.phtml - - - message: "#^Argument of an invalid type string supplied for foreach, only iterables are supported\\.$#" - count: 1 - path: app/design/frontend/base/default/template/catalog/product/list/toolbar.phtml - - message: "#^Parameter \\#1 \\$order of method Mage_Catalog_Block_Product_List_Toolbar\\:\\:getOrderUrl\\(\\) expects string, null given\\.$#" count: 2 path: app/design/frontend/base/default/template/catalog/product/list/toolbar.phtml - - - message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, string given\\.$#" - count: 1 - path: app/design/frontend/base/default/template/catalog/product/list/toolbar.phtml - - message: "#^Variable \\$this might not be defined\\.$#" count: 21 @@ -8515,21 +7945,11 @@ parameters: count: 2 path: app/design/frontend/rwd/default/template/catalog/product/compare/list.phtml - - - message: "#^Argument of an invalid type string supplied for foreach, only iterables are supported\\.$#" - count: 1 - path: app/design/frontend/rwd/default/template/catalog/product/list/toolbar.phtml - - message: "#^Parameter \\#1 \\$order of method Mage_Catalog_Block_Product_List_Toolbar\\:\\:getOrderUrl\\(\\) expects string, null given\\.$#" count: 2 path: app/design/frontend/rwd/default/template/catalog/product/list/toolbar.phtml - - - message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, string given\\.$#" - count: 1 - path: app/design/frontend/rwd/default/template/catalog/product/list/toolbar.phtml - - message: "#^Left side of && is always true\\.$#" count: 1 diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Sales/Order/Address/Form/Renderer/Vat.php b/app/code/core/Mage/Adminhtml/Block/Customer/Sales/Order/Address/Form/Renderer/Vat.php index da304a36f83..abfb6ff0265 100644 --- a/app/code/core/Mage/Adminhtml/Block/Customer/Sales/Order/Address/Form/Renderer/Vat.php +++ b/app/code/core/Mage/Adminhtml/Block/Customer/Sales/Order/Address/Form/Renderer/Vat.php @@ -75,7 +75,10 @@ public function getValidateButton() $optionsVarName = $this->getJsVariablePrefix() . 'VatParameters'; $beforeHtml = ''; - $this->_validateButton = $this->getLayout()->createBlock('adminhtml/widget_button')->setData([ + + /** @var Mage_Adminhtml_Block_Widget_Button $block */ + $block = $this->getLayout()->createBlock('adminhtml/widget_button'); + $this->_validateButton = $block->setData([ 'label' => Mage::helper('customer')->__('Validate VAT Number'), 'before_html' => $beforeHtml, 'onclick' => 'order.validateVat(' . $optionsVarName . ')' diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Shipping/Address.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Shipping/Address.php index be5707c32ff..b3ffbe8db35 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Shipping/Address.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Shipping/Address.php @@ -112,7 +112,7 @@ public function getAddressId() /** * Return address object * - * @return Mage_Customer_Model_Address + * @return Mage_Sales_Model_Quote_Address */ public function getAddress() { diff --git a/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Fieldset.php b/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Fieldset.php index 4f087802160..3b87985434a 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Fieldset.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Config/Form/Fieldset.php @@ -183,7 +183,7 @@ protected function _getExtraJs($element, $tooltipsExist = false) * Collapsed or expanded fieldset when page loaded? * * @param Varien_Data_Form_Element_Abstract $element - * @return int|bool + * @return int|false */ protected function _getCollapseState($element) { diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php index 83e32c17302..a8f3aa67c6d 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php @@ -46,7 +46,7 @@ class Mage_Adminhtml_Block_Widget_Grid extends Mage_Adminhtml_Block_Widget /** * Collection object * - * @var Mage_Core_Model_Resource_Db_Collection_Abstract|Varien_Data_Collection_Db|null + * @var Varien_Data_Collection_Db|null */ protected $_collection = null; diff --git a/app/code/core/Mage/Authorizenet/Model/Directpost.php b/app/code/core/Mage/Authorizenet/Model/Directpost.php index 4134f889185..3f7d5226d85 100644 --- a/app/code/core/Mage/Authorizenet/Model/Directpost.php +++ b/app/code/core/Mage/Authorizenet/Model/Directpost.php @@ -67,6 +67,7 @@ public function authorize(Varien_Object $payment, $amount) /** * Send capture request to gateway * + * @param Mage_Sales_Model_Order_Payment $payment * @param float $amount * @return $this * @throws Mage_Core_Exception @@ -221,6 +222,7 @@ public function refund(Varien_Object $payment, $amount) /** * refund the amount with transaction id * + * @param Mage_Sales_Model_Order_Payment $payment * @param string $amount * @return $this * @throws Mage_Core_Exception @@ -324,7 +326,7 @@ public function initialize($paymentAction, $stateObject) switch ($paymentAction) { case self::ACTION_AUTHORIZE: case self::ACTION_AUTHORIZE_CAPTURE: - /** @var Mage_Authorizenet_Model_Directpost $payment */ + /** @var Mage_Sales_Model_Order_Payment|Mage_Sales_Model_Quote_Payment $payment */ $payment = $this->getInfoInstance(); $order = $payment->getOrder(); $order->setCanSendNewEmailFlag(false); @@ -639,7 +641,7 @@ protected function _captureOrder(Mage_Sales_Model_Order $order) /** * Return additional information`s transaction_id value of parent transaction model * - * @param Mage_Sales_Model_Order_Payment $payment + * @param Mage_Sales_Model_Order_Payment|Varien_Object $payment * @return string */ protected function _getRealParentTransactionId($payment) diff --git a/app/code/core/Mage/Authorizenet/Model/Directpost/Request.php b/app/code/core/Mage/Authorizenet/Model/Directpost/Request.php index 96413b3c113..e92ff788464 100644 --- a/app/code/core/Mage/Authorizenet/Model/Directpost/Request.php +++ b/app/code/core/Mage/Authorizenet/Model/Directpost/Request.php @@ -163,7 +163,7 @@ public function setDataFromOrder(Mage_Sales_Model_Order $order, Mage_Authorizene */ public function signRequestData() { - $fpTimestamp = time(); + $fpTimestamp = (string) time(); $signatureKey = $this->_getSignatureKey(); if (!empty($signatureKey)) { $hash = $this->_generateSha2RequestSign( diff --git a/app/code/core/Mage/Bundle/Model/Sales/Order/Pdf/Items/Abstract.php b/app/code/core/Mage/Bundle/Model/Sales/Order/Pdf/Items/Abstract.php index ddfd5350b10..0a49779b723 100644 --- a/app/code/core/Mage/Bundle/Model/Sales/Order/Pdf/Items/Abstract.php +++ b/app/code/core/Mage/Bundle/Model/Sales/Order/Pdf/Items/Abstract.php @@ -230,7 +230,7 @@ public function getOrderItem() /** * Retrieve Value HTML * - * @param Mage_Sales_Model_Order_Item $item + * @param Mage_Sales_Model_Order_Invoice_Item $item * @return string */ public function getValueHtml($item) @@ -254,13 +254,13 @@ public function getValueHtml($item) /** * Can show price info for item * - * @param Mage_Sales_Model_Order_Item $item + * @param Mage_Sales_Model_Order_Invoice_Item $item * @return bool */ public function canShowPriceInfo($item) { if (($item->getOrderItem()->getParentItem() && $this->isChildCalculated()) - || (!$item->getOrderItem()->getParentItem() && !$this->isChildCalculated()) + || (!$item->getOrderItem()->getParentItem() && !$this->isChildCalculated()) ) { return true; } diff --git a/app/code/core/Mage/Catalog/Block/Navigation.php b/app/code/core/Mage/Catalog/Block/Navigation.php index ed81da4ead4..8b5fce9dbd5 100644 --- a/app/code/core/Mage/Catalog/Block/Navigation.php +++ b/app/code/core/Mage/Catalog/Block/Navigation.php @@ -32,7 +32,7 @@ class Mage_Catalog_Block_Navigation extends Mage_Core_Block_Template /** * Current category key * - * @var string + * @var int|string */ protected $_currentCategoryKey; @@ -94,7 +94,7 @@ public function getCacheKeyInfo() /** * Get current category key * - * @return mixed + * @return int|string */ public function getCurrenCategoryKey() { diff --git a/app/code/core/Mage/Catalog/Block/Product/Abstract.php b/app/code/core/Mage/Catalog/Block/Product/Abstract.php index 5e912d9e87b..7c3321b5d94 100644 --- a/app/code/core/Mage/Catalog/Block/Product/Abstract.php +++ b/app/code/core/Mage/Catalog/Block/Product/Abstract.php @@ -167,7 +167,7 @@ public function getAddToCompareUrl($product) * Gets minimal sales quantity * * @param Mage_Catalog_Model_Product $product - * @return int|null + * @return float|null */ public function getMinimalQty($product) { @@ -317,7 +317,9 @@ protected function _initReviewsHelperBlock() return false; } - $this->_reviewsHelperBlock = $this->getLayout()->createBlock('review/helper'); + /** @var Mage_Review_Block_Helper $block */ + $block = $this->getLayout()->createBlock('review/helper'); + $this->_reviewsHelperBlock = $block; } return true; diff --git a/app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php b/app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php index bd02143259f..292442e793a 100644 --- a/app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php +++ b/app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php @@ -77,7 +77,7 @@ class Mage_Catalog_Block_Product_List_Toolbar extends Mage_Core_Block_Template /** * List of available view types * - * @var string + * @var array */ protected $_availableMode = []; @@ -536,7 +536,7 @@ public function isModeActive($mode) /** * Retrieve availables view modes * - * @return string + * @return array */ public function getModes() { @@ -551,7 +551,7 @@ public function getModes() */ public function setModes($modes) { - if (!isset($this->_availableMode)) { + if (!$this->_availableMode) { $this->_availableMode = $modes; } return $this; @@ -650,7 +650,7 @@ public function getDefaultPerPageValue() } return Mage::getStoreConfig('catalog/frontend/grid_per_page'); } - return 0; + return '0'; } /** diff --git a/app/code/core/Mage/Catalog/Block/Product/New.php b/app/code/core/Mage/Catalog/Block/Product/New.php index 87e5b8ce080..1ae46966b18 100644 --- a/app/code/core/Mage/Catalog/Block/Product/New.php +++ b/app/code/core/Mage/Catalog/Block/Product/New.php @@ -30,7 +30,7 @@ class Mage_Catalog_Block_Product_New extends Mage_Catalog_Block_Product_Abstract /** * Products count * - * @var null + * @var int */ protected $_productsCount; diff --git a/app/code/core/Mage/Catalog/Block/Product/Widget/Html/Pager.php b/app/code/core/Mage/Catalog/Block/Product/Widget/Html/Pager.php index 08362123d33..474be27625a 100644 --- a/app/code/core/Mage/Catalog/Block/Product/Widget/Html/Pager.php +++ b/app/code/core/Mage/Catalog/Block/Product/Widget/Html/Pager.php @@ -168,7 +168,7 @@ public function getTotalNum() public function getLastPageNum() { if ($this->_lastPage === null) { - $this->_lastPage = ceil($this->getCollectionSize() / $this->getLimit()); + $this->_lastPage = (int) ceil($this->getCollectionSize() / $this->getLimit()); if ($this->_lastPage <= 0) { $this->_lastPage = 1; } diff --git a/app/code/core/Mage/Catalog/Block/Seo/Sitemap/Product.php b/app/code/core/Mage/Catalog/Block/Seo/Sitemap/Product.php index 2d41cd0d27c..3c087dcc085 100644 --- a/app/code/core/Mage/Catalog/Block/Seo/Sitemap/Product.php +++ b/app/code/core/Mage/Catalog/Block/Seo/Sitemap/Product.php @@ -54,8 +54,8 @@ protected function _prepareLayout() */ public function getItemUrl($product) { - $helper = Mage::helper('catalog/product'); /** @var Mage_Catalog_Helper_Product $helper */ + $helper = Mage::helper('catalog/product'); return $helper->getProductUrl($product); } } diff --git a/app/code/core/Mage/Catalog/Helper/Data.php b/app/code/core/Mage/Catalog/Helper/Data.php index c4cbeef2cab..69ba46ca7e7 100644 --- a/app/code/core/Mage/Catalog/Helper/Data.php +++ b/app/code/core/Mage/Catalog/Helper/Data.php @@ -45,7 +45,7 @@ class Mage_Catalog_Helper_Data extends Mage_Core_Helper_Abstract /** * Breadcrumb Path cache * - * @var string|array> + * @var array> */ protected $_categoryPath; @@ -79,7 +79,7 @@ public function setStoreId($store) * Return current category path or get it from current category * and creating array of categories|product paths for breadcrumbs * - * @return string + * @return array */ public function getBreadcrumbPath() { diff --git a/app/code/core/Mage/Catalog/Helper/Product.php b/app/code/core/Mage/Catalog/Helper/Product.php index 5e4680a24d6..adad423f8de 100644 --- a/app/code/core/Mage/Catalog/Helper/Product.php +++ b/app/code/core/Mage/Catalog/Helper/Product.php @@ -501,7 +501,7 @@ public function getSkipSaleableCheck() * Gets minimal sales quantity * * @param Mage_Catalog_Model_Product $product - * @return int|null + * @return float|null */ public function getMinimalQty($product) { diff --git a/app/code/core/Mage/Catalog/Model/Api2/Product/Rest.php b/app/code/core/Mage/Catalog/Model/Api2/Product/Rest.php index df5ddf76d5b..1217be5ac42 100644 --- a/app/code/core/Mage/Catalog/Model/Api2/Product/Rest.php +++ b/app/code/core/Mage/Catalog/Model/Api2/Product/Rest.php @@ -375,7 +375,7 @@ protected function _getTierPrices() /** * Default implementation. May be different for customer/guest/admin role. * - * @return null + * @return int|null */ protected function _getCustomerGroupId() { diff --git a/app/code/core/Mage/Catalog/Model/Api2/Product/Rest/Admin/V1.php b/app/code/core/Mage/Catalog/Model/Api2/Product/Rest/Admin/V1.php index e0dcc5f4c40..b49ded50523 100644 --- a/app/code/core/Mage/Catalog/Model/Api2/Product/Rest/Admin/V1.php +++ b/app/code/core/Mage/Catalog/Model/Api2/Product/Rest/Admin/V1.php @@ -355,7 +355,7 @@ protected function _filterStockData(&$stockData) * Filter out fields if Use Config Settings option used * * @param array $data - * @param string $fields + * @param array $fields */ protected function _filterConfigValueUsed(&$data, $fields) { diff --git a/app/code/core/Mage/Catalog/Model/Category/Url.php b/app/code/core/Mage/Catalog/Model/Category/Url.php index 474b15b6833..7c2994041e2 100644 --- a/app/code/core/Mage/Catalog/Model/Category/Url.php +++ b/app/code/core/Mage/Catalog/Model/Category/Url.php @@ -122,7 +122,9 @@ protected function _getRequestPath(Mage_Catalog_Model_Category $category) public function getUrlInstance() { if ($this->_url === null) { - $this->_url = $this->_factory->getModel('core/url'); + /** @var Mage_Core_Model_Url $model */ + $model = $this->_factory->getModel('core/url'); + $this->_url = $model; } return $this->_url; } diff --git a/app/code/core/Mage/Catalog/Model/Design.php b/app/code/core/Mage/Catalog/Model/Design.php index af7b111ff69..64d7d16b841 100644 --- a/app/code/core/Mage/Catalog/Model/Design.php +++ b/app/code/core/Mage/Catalog/Model/Design.php @@ -76,7 +76,7 @@ protected function _apply($package, $theme) * Apply custom design * * @param string $design - * @return null|false + * @return void|false */ public function applyCustomDesign($design) { diff --git a/app/code/core/Mage/Catalog/Model/Factory.php b/app/code/core/Mage/Catalog/Model/Factory.php index e353aad582e..da84390534b 100644 --- a/app/code/core/Mage/Catalog/Model/Factory.php +++ b/app/code/core/Mage/Catalog/Model/Factory.php @@ -47,9 +47,11 @@ class Mage_Catalog_Model_Factory extends Mage_Core_Model_Factory */ public function getCategoryUrlRewriteHelper() { - return $this->getHelper( + /** @var Mage_Catalog_Helper_Category_Url_Rewrite_Interface $model */ + $model = $this->getHelper( (string)$this->_config->getNode(self::XML_PATH_CATEGORY_URL_REWRITE_HELPER_CLASS) ); + return $model; } /** @@ -59,9 +61,11 @@ public function getCategoryUrlRewriteHelper() */ public function getProductUrlRewriteHelper() { - return $this->getHelper( + /** @var Mage_Catalog_Helper_Product_Url_Rewrite_Interface $model */ + $model = $this->getHelper( (string)$this->_config->getNode(self::XML_PATH_PRODUCT_URL_REWRITE_HELPER_CLASS) ); + return $model; } /** @@ -71,9 +75,11 @@ public function getProductUrlRewriteHelper() */ public function getProductUrlInstance() { - return $this->getModel( + /** @var Mage_Catalog_Model_Product_Url $model */ + $model = $this->getModel( (string)$this->_config->getNode(self::XML_PATH_PRODUCT_URL_MODEL) ); + return $model; } /** @@ -83,8 +89,10 @@ public function getProductUrlInstance() */ public function getCategoryUrlInstance() { - return $this->getModel( + /** @var Mage_Catalog_Model_Category_Url $model */ + $model = $this->getModel( (string)$this->_config->getNode(self::XML_PATH_CATEGORY_URL_MODEL) ); + return $model; } } diff --git a/app/code/core/Mage/Catalog/Model/Product.php b/app/code/core/Mage/Catalog/Model/Product.php index e210ca9c68f..ac1c1f4c48c 100644 --- a/app/code/core/Mage/Catalog/Model/Product.php +++ b/app/code/core/Mage/Catalog/Model/Product.php @@ -1885,8 +1885,8 @@ public function addOption(Mage_Catalog_Model_Product_Option $option) /** * Get option from options array of product by given option id * - * @param int $optionId - * @return Mage_Catalog_Model_Product_Option | null + * @param string $optionId + * @return Mage_Catalog_Model_Product_Option|null */ public function getOptionById($optionId) { @@ -1984,7 +1984,7 @@ public function hasCustomOptions() * Check availability display product in category * * @param int $categoryId - * @return bool + * @return string */ public function canBeShowInCategory($categoryId) { diff --git a/app/code/core/Mage/Catalog/Model/Product/Api.php b/app/code/core/Mage/Catalog/Model/Product/Api.php index 8f2d135cbe7..ce95dce5e9b 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Api.php +++ b/app/code/core/Mage/Catalog/Model/Product/Api.php @@ -384,7 +384,7 @@ public function delete($productId, $identifierType = null) /** * Get list of additional attributes which are not in default create/update list * - * @param int $productType + * @param string $productType * @param int $attributeSetId * @return array */ @@ -429,7 +429,7 @@ public function getAdditionalAttributes($productType, $attributeSetId) /** * Check if product type exists * - * @param int $productType + * @param string $productType * @throw Mage_Api_Exception */ protected function _checkProductTypeExists($productType) diff --git a/app/code/core/Mage/Catalog/Model/Product/Type/Configurable/Price.php b/app/code/core/Mage/Catalog/Model/Product/Type/Configurable/Price.php index a6334a683ae..266f8008a30 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Type/Configurable/Price.php +++ b/app/code/core/Mage/Catalog/Model/Product/Type/Configurable/Price.php @@ -113,7 +113,7 @@ protected function _calcSelectionPrice($priceInfo, $productPrice) /** * @param array $values * @param string $index - * @return bool + * @return array|false */ protected function _getValueByIndex($values, $index) { diff --git a/app/code/core/Mage/Catalog/Model/Resource/Attribute.php b/app/code/core/Mage/Catalog/Model/Resource/Attribute.php index a9a460e979e..2d4acc31046 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Attribute.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Attribute.php @@ -123,7 +123,7 @@ public function deleteEntity(Mage_Core_Model_Abstract $object) * Defines is Attribute used by super products * * @param int $attributeSet - * @return int + * @return false|string|null */ public function isUsedBySuperProducts(Mage_Core_Model_Abstract $object, $attributeSet = null) { diff --git a/app/code/core/Mage/Catalog/Model/Resource/Category/Collection.php b/app/code/core/Mage/Catalog/Model/Resource/Category/Collection.php index f8a28d1497b..a04a22b7d97 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Category/Collection.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Category/Collection.php @@ -21,7 +21,7 @@ * @package Mage_Catalog * * @method Mage_Catalog_Model_Category getFirstItem() - * @method Mage_Catalog_Model_Category getItemById(int $value) + * @method Mage_Catalog_Model_Category getItemById(string $value) * @method Mage_Catalog_Model_Category[] getItems() */ class Mage_Catalog_Model_Resource_Category_Collection extends Mage_Catalog_Model_Resource_Collection_Abstract diff --git a/app/code/core/Mage/Catalog/Model/Resource/Product.php b/app/code/core/Mage/Catalog/Model/Resource/Product.php index 04116e6c374..6cffd3fdf86 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Product.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Product.php @@ -361,7 +361,7 @@ public function refreshIndex($product) * if product parameter is null - idex will be refreshed for all products * * @param Mage_Core_Model_Store $store - * @param Mage_Catalog_Model_Product $product + * @param Mage_Catalog_Model_Product|array $product * @throws Mage_Core_Exception * @return $this */ diff --git a/app/code/core/Mage/Catalog/Model/Resource/Product/Compare/Item.php b/app/code/core/Mage/Catalog/Model/Resource/Product/Compare/Item.php index ff2f629718f..f21ed156b1e 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Product/Compare/Item.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Product/Compare/Item.php @@ -67,7 +67,7 @@ public function loadByProduct(Mage_Catalog_Model_Product_Compare_Item $object, $ * * @param int $customerId * @param int $visitorId - * @return int + * @return false|string|null */ public function getCount($customerId, $visitorId) { diff --git a/app/code/core/Mage/Catalog/Model/Resource/Setup.php b/app/code/core/Mage/Catalog/Model/Resource/Setup.php index 1bc6560a14d..8bb7696ef1e 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Setup.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Setup.php @@ -892,7 +892,7 @@ protected function _getCategoryEntityRow($entityId) * * @param array $category * @param array $path - * @return string + * @return array */ protected function _getCategoryPath($category, $path = []) { diff --git a/app/code/core/Mage/Catalog/Model/Resource/Url.php b/app/code/core/Mage/Catalog/Model/Resource/Url.php index 601d1ff0120..3f62a851e74 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Url.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Url.php @@ -225,7 +225,7 @@ public function checkRequestPaths($paths, $storeId) * Prepare rewrites for condition * * @param int $storeId - * @param int|array $categoryIds + * @param int|string|array|false $categoryIds * @param int|array $productIds * @return array */ @@ -561,7 +561,7 @@ public function saveProductAttribute(Varien_Object $product, $attributeCode) * * @param string $attributeCode * @param int|array $productIds - * @param string $storeId + * @param int|string $storeId * @return array */ public function _getProductAttribute($attributeCode, $productIds, $storeId) diff --git a/app/code/core/Mage/CatalogIndex/Model/Data/Abstract.php b/app/code/core/Mage/CatalogIndex/Model/Data/Abstract.php index d01d954defe..fcc096bb83c 100644 --- a/app/code/core/Mage/CatalogIndex/Model/Data/Abstract.php +++ b/app/code/core/Mage/CatalogIndex/Model/Data/Abstract.php @@ -138,7 +138,7 @@ protected function fetchLinkInformation($store, $settings, $type, $suppliedId) /** * Fetch final price for product * - * @param int $product + * @param array $product * @param Mage_Core_Model_Store $store * @param Mage_Customer_Model_Group $group * @return float @@ -233,7 +233,7 @@ public function getTierPrices($products, $store) /** * Retrieve specified attribute data for specified products from specified store * - * @param array $products + * @param array|string $products * @param array $attributes * @param Mage_Core_Model_Store $store * @return array diff --git a/app/code/core/Mage/CatalogIndex/Model/Resource/Data/Abstract.php b/app/code/core/Mage/CatalogIndex/Model/Resource/Data/Abstract.php index 9f3e906cd92..152363fe393 100644 --- a/app/code/core/Mage/CatalogIndex/Model/Resource/Data/Abstract.php +++ b/app/code/core/Mage/CatalogIndex/Model/Resource/Data/Abstract.php @@ -70,7 +70,7 @@ protected function _construct() /** * Retrieve specified attribute data for specified products from specified store * - * @param array $products + * @param array|string $products * @param array $attributes * @param int $store * @return array diff --git a/app/code/core/Mage/CatalogInventory/Model/Stock/Item/Api.php b/app/code/core/Mage/CatalogInventory/Model/Stock/Item/Api.php index ef124499b24..bac58c397da 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Stock/Item/Api.php +++ b/app/code/core/Mage/CatalogInventory/Model/Stock/Item/Api.php @@ -67,7 +67,7 @@ public function items($productIds) } /** - * @param int $productId + * @param string $productId * @param array $data * @return bool * @throws Mage_Api_Exception diff --git a/app/code/core/Mage/CatalogInventory/Model/Stock/Item/Api/V2.php b/app/code/core/Mage/CatalogInventory/Model/Stock/Item/Api/V2.php index fe80a653b4d..60a7bf03a64 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Stock/Item/Api/V2.php +++ b/app/code/core/Mage/CatalogInventory/Model/Stock/Item/Api/V2.php @@ -25,7 +25,7 @@ class Mage_CatalogInventory_Model_Stock_Item_Api_V2 extends Mage_CatalogInventor /** * Update product stock data * - * @param int $productId + * @param string $productId * @param array $data * @return bool */ diff --git a/app/code/core/Mage/CatalogRule/Model/Action/Index/Refresh.php b/app/code/core/Mage/CatalogRule/Model/Action/Index/Refresh.php index 4fc860fec95..cd847c1ae5b 100644 --- a/app/code/core/Mage/CatalogRule/Model/Action/Index/Refresh.php +++ b/app/code/core/Mage/CatalogRule/Model/Action/Index/Refresh.php @@ -421,7 +421,7 @@ protected function _calculatePrice() ) . ' = cppt.grouped_id AND ' . $this->_connection->getIfNullSql( new Zend_Db_Expr('@action_stop'), - new Zend_Db_Expr(0) + new Zend_Db_Expr('0') ) . ' = 0' => '@price := ' . $this->_connection->getCaseSql( $this->_connection->quoteIdentifier('cppt.action_operator'), [ @@ -481,7 +481,7 @@ protected function _prepareIndexSelect(Mage_Core_Model_Website $website, $time) ) . ' = cppt.grouped_id' => '@action_stop := ' . $this->_connection->getIfNullSql( new Zend_Db_Expr('@action_stop'), - new Zend_Db_Expr(0) + new Zend_Db_Expr('0') ) . ' + cppt.action_stop', ] ) @@ -535,7 +535,7 @@ protected function _prepareIndexSelect(Mage_Core_Model_Website $website, $time) ->where( $this->_connection->getCheckSql( new Zend_Db_Expr('to_time = 0'), - new Zend_Db_Expr(1), + new Zend_Db_Expr('1'), new Zend_Db_Expr($this->_connection->getUnixTimestamp('dates.rule_date') . ' <= to_time') ) ) @@ -605,7 +605,7 @@ protected function _prepareGroupWebsite($timestamp) ->where( $this->_connection->getCheckSql( new Zend_Db_Expr('to_time = 0'), - new Zend_Db_Expr(1), + new Zend_Db_Expr('1'), new Zend_Db_Expr("{$timestamp} <= to_time") ) ); diff --git a/app/code/core/Mage/CatalogSearch/Block/Advanced/Result.php b/app/code/core/Mage/CatalogSearch/Block/Advanced/Result.php index d27af3000f2..207cee71d3c 100644 --- a/app/code/core/Mage/CatalogSearch/Block/Advanced/Result.php +++ b/app/code/core/Mage/CatalogSearch/Block/Advanced/Result.php @@ -129,7 +129,7 @@ public function getFormUrl() public function getSearchCriterias() { $searchCriterias = $this->getSearchModel()->getSearchCriterias(); - $middle = ceil(count($searchCriterias) / 2); + $middle = (int) ceil(count($searchCriterias) / 2); $left = array_slice($searchCriterias, 0, $middle); $right = array_slice($searchCriterias, $middle); diff --git a/app/code/core/Mage/Core/Model/Cache.php b/app/code/core/Mage/Core/Model/Cache.php index 6ed12f2fe10..f64a36f53f1 100644 --- a/app/code/core/Mage/Core/Model/Cache.php +++ b/app/code/core/Mage/Core/Model/Cache.php @@ -405,7 +405,7 @@ public function remove($id) /** * Clean cached data by specific tag * - * @param array $tags + * @param array|string $tags * @return bool */ public function clean($tags = []) diff --git a/app/code/core/Mage/Core/Model/Cookie.php b/app/code/core/Mage/Core/Model/Cookie.php index a2801663e25..7b5a408e78a 100644 --- a/app/code/core/Mage/Core/Model/Cookie.php +++ b/app/code/core/Mage/Core/Model/Cookie.php @@ -153,7 +153,7 @@ public function setLifetime($lifetime) /** * Retrieve use HTTP only flag * - * @return bool + * @return bool|null */ public function getHttponly() { diff --git a/app/code/core/Mage/Core/Model/Store.php b/app/code/core/Mage/Core/Model/Store.php index 1621668fb71..a04bef08b39 100644 --- a/app/code/core/Mage/Core/Model/Store.php +++ b/app/code/core/Mage/Core/Model/Store.php @@ -939,10 +939,10 @@ public function getCurrentCurrencyRate() /** * Convert price from default currency to current currency * - * @param double $price + * @param float $price * @param bool $format Format price to currency format * @param bool $includeContainer Enclose into - * @return double + * @return float */ public function convertPrice($price, $format = false, $includeContainer = true) { diff --git a/app/code/core/Mage/Customer/Model/Customer.php b/app/code/core/Mage/Customer/Model/Customer.php index dd556419824..589be3e35c6 100644 --- a/app/code/core/Mage/Customer/Model/Customer.php +++ b/app/code/core/Mage/Customer/Model/Customer.php @@ -46,6 +46,7 @@ * @method $this setEmail(string $value) * * @method string getFirstname() + * @method $this setFirstname(string $value) * @method bool getForceConfirmed() * @method $this setForceConfirmed(bool $value) * @@ -67,6 +68,7 @@ * @method $this setItems(int $value) * * @method string getLastname() + * @method $this setLastname(string $value) * * @method string getMiddlename() * @method string getMode() diff --git a/app/code/core/Mage/Directory/Model/Currency.php b/app/code/core/Mage/Directory/Model/Currency.php index a80577a730f..5c3a9da496c 100644 --- a/app/code/core/Mage/Directory/Model/Currency.php +++ b/app/code/core/Mage/Directory/Model/Currency.php @@ -325,7 +325,7 @@ public function getConfigBaseCurrencies() /** * Retrieve currency rates to other currencies * - * @param string $currency + * @param array|string|Mage_Directory_Model_Currency $currency * @param array $toCurrencies * @return array */ diff --git a/app/code/core/Mage/Eav/Model/Resource/Entity/Attribute/Group.php b/app/code/core/Mage/Eav/Model/Resource/Entity/Attribute/Group.php index 22dbbe734d4..c36a2681838 100644 --- a/app/code/core/Mage/Eav/Model/Resource/Entity/Attribute/Group.php +++ b/app/code/core/Mage/Eav/Model/Resource/Entity/Attribute/Group.php @@ -82,7 +82,7 @@ protected function _afterSave(Mage_Core_Model_Abstract $object) * Retrieve max sort order * * @param Mage_Core_Model_Abstract|Mage_Eav_Model_Entity_Attribute_Group $object - * @return int + * @return false|string|null */ protected function _getMaxSortOrder($object) { diff --git a/app/code/core/Mage/Eav/Model/Resource/Form/Type.php b/app/code/core/Mage/Eav/Model/Resource/Form/Type.php index 38af400cd26..dc681261932 100644 --- a/app/code/core/Mage/Eav/Model/Resource/Form/Type.php +++ b/app/code/core/Mage/Eav/Model/Resource/Form/Type.php @@ -36,7 +36,7 @@ protected function _construct() /** * Load an object * - * @param Mage_Eav_Model_Resource_Form_Type $object + * @param Mage_Eav_Model_Form_Type $object * @inheritDoc */ public function load(Mage_Core_Model_Abstract $object, $value, $field = null) @@ -73,7 +73,7 @@ public function getEntityTypes($object) * * @see Mage_Core_Model_Resource_Db_Abstract::_afterSave() * - * @param Mage_Eav_Model_Resource_Form_Type $object + * @param Mage_Eav_Model_Form_Type $object * @inheritDoc */ protected function _afterSave(Mage_Core_Model_Abstract $object) diff --git a/app/code/core/Mage/ImportExport/Block/Adminhtml/Export/Filter.php b/app/code/core/Mage/ImportExport/Block/Adminhtml/Export/Filter.php index 6f2906cd419..c6ba5d0a4c3 100644 --- a/app/code/core/Mage/ImportExport/Block/Adminhtml/Export/Filter.php +++ b/app/code/core/Mage/ImportExport/Block/Adminhtml/Export/Filter.php @@ -24,6 +24,11 @@ */ class Mage_ImportExport_Block_Adminhtml_Export_Filter extends Mage_Adminhtml_Block_Widget_Grid { + /** + * @var Mage_Eav_Model_Resource_Entity_Attribute_Collection|null + */ + protected $_collection = null; + /** * Helper object. * @@ -433,7 +438,7 @@ public function getRowUrl($row) /** * Prepare collection by setting page number, sorting etc.. * - * @return Mage_Core_Model_Resource_Db_Collection_Abstract|null + * @return Mage_Eav_Model_Resource_Entity_Attribute_Collection */ public function prepareCollection(Mage_Eav_Model_Resource_Entity_Attribute_Collection $collection) { diff --git a/app/code/core/Mage/ImportExport/Model/Export/Entity/Product.php b/app/code/core/Mage/ImportExport/Model/Export/Entity/Product.php index dcb91f53369..e3ae59f0581 100644 --- a/app/code/core/Mage/ImportExport/Model/Export/Entity/Product.php +++ b/app/code/core/Mage/ImportExport/Model/Export/Entity/Product.php @@ -615,6 +615,7 @@ protected function _prepareExport() // prepare multi-store values and system columns values foreach ($this->_storeIdToCode as $storeId => &$storeCode) { // go through all stores + /** @var Mage_Catalog_Model_Resource_Product_Collection $collection */ $collection = $this->_prepareEntityCollection(Mage::getResourceModel('catalog/product_collection')); $collection ->setStoreId($storeId) @@ -722,7 +723,7 @@ protected function _prepareExport() $collection->clear(); } - if ($collection->getCurPage() < $offsetProducts) { + if (isset($collection) && $collection->getCurPage() < $offsetProducts) { break; } diff --git a/app/code/core/Mage/ImportExport/Model/Import/Adapter/Csv.php b/app/code/core/Mage/ImportExport/Model/Import/Adapter/Csv.php index 064221c329f..38541cecc5c 100644 --- a/app/code/core/Mage/ImportExport/Model/Import/Adapter/Csv.php +++ b/app/code/core/Mage/ImportExport/Model/Import/Adapter/Csv.php @@ -80,7 +80,7 @@ protected function _init() #[\ReturnTypeWillChange] public function next() { - $this->_currentRow = fgetcsv($this->_fileHandler, null, $this->_delimiter, $this->_enclosure, $this->_escape); + $this->_currentRow = fgetcsv($this->_fileHandler, 0, $this->_delimiter, $this->_enclosure, $this->_escape); $this->_currentKey = $this->_currentRow ? $this->_currentKey + 1 : null; } @@ -94,8 +94,8 @@ public function rewind() { // rewind resource, reset column names, read first row as current rewind($this->_fileHandler); - $this->_colNames = fgetcsv($this->_fileHandler, null, $this->_delimiter, $this->_enclosure, $this->_escape); - $this->_currentRow = fgetcsv($this->_fileHandler, null, $this->_delimiter, $this->_enclosure, $this->_escape); + $this->_colNames = fgetcsv($this->_fileHandler, 0, $this->_delimiter, $this->_enclosure, $this->_escape); + $this->_currentRow = fgetcsv($this->_fileHandler, 0, $this->_delimiter, $this->_enclosure, $this->_escape); if ($this->_currentRow) { $this->_currentKey = 0; @@ -120,7 +120,7 @@ public function seek($position) if ($position < $this->_currentKey) { $this->rewind(); } - while ($this->_currentRow = fgetcsv($this->_fileHandler, null, $this->_delimiter, $this->_enclosure, $this->_escape)) { + while ($this->_currentRow = fgetcsv($this->_fileHandler, 0, $this->_delimiter, $this->_enclosure, $this->_escape)) { if (++$this->_currentKey == $position) { return; } diff --git a/app/code/core/Mage/ImportExport/Model/Import/Entity/Product.php b/app/code/core/Mage/ImportExport/Model/Import/Entity/Product.php index 4bf31c18cdf..902a887ca53 100644 --- a/app/code/core/Mage/ImportExport/Model/Import/Entity/Product.php +++ b/app/code/core/Mage/ImportExport/Model/Import/Entity/Product.php @@ -1207,7 +1207,7 @@ protected function _saveLinks() $linkRows, ['link_id'] ); - $adapter->changeTableAutoIncrement($mainTable, $nextLinkId); + $adapter->changeTableAutoIncrement($mainTable, (string)$nextLinkId); } if ($positionRows) { // process linked product positions $adapter->insertOnDuplicate( diff --git a/app/code/core/Mage/Index/Model/Event.php b/app/code/core/Mage/Index/Model/Event.php index 2a69feaad71..7e6c3a597ee 100644 --- a/app/code/core/Mage/Index/Model/Event.php +++ b/app/code/core/Mage/Index/Model/Event.php @@ -123,8 +123,8 @@ public function resetData() * Add process id to event object * * @param int $processId - * @param string $status - * @return $this + * @param Mage_Index_Model_Process::EVENT_STATUS_* $status + * @return $this */ public function addProcessId($processId, $status = Mage_Index_Model_Process::EVENT_STATUS_NEW) { diff --git a/app/code/core/Mage/Index/Model/Lock/Storage/Db.php b/app/code/core/Mage/Index/Model/Lock/Storage/Db.php index e7ee44b5676..3c8af0ba0ec 100644 --- a/app/code/core/Mage/Index/Model/Lock/Storage/Db.php +++ b/app/code/core/Mage/Index/Model/Lock/Storage/Db.php @@ -66,7 +66,7 @@ public function setLock($lockName) * Release named lock * * @param string $lockName - * @return int|null + * @return bool */ public function releaseLock($lockName) { diff --git a/app/code/core/Mage/Index/Model/Process.php b/app/code/core/Mage/Index/Model/Process.php index 5b8e01a2878..e60a8af8429 100644 --- a/app/code/core/Mage/Index/Model/Process.php +++ b/app/code/core/Mage/Index/Model/Process.php @@ -371,7 +371,7 @@ protected function _processEventsCollection( if (!$skipUnmatched) { $eventProcessIds = $event->getProcessIds(); if (!isset($eventProcessIds[$this->getId()])) { - $event->addProcessId($this->getId(), null); + $event->addProcessId($this->getId()); } } } catch (Exception $e) { diff --git a/app/code/core/Mage/Oauth/Helper/Data.php b/app/code/core/Mage/Oauth/Helper/Data.php index 17a19603bf2..0d236de0d47 100644 --- a/app/code/core/Mage/Oauth/Helper/Data.php +++ b/app/code/core/Mage/Oauth/Helper/Data.php @@ -78,7 +78,7 @@ protected function _generateRandomString($length) { if (function_exists('openssl_random_pseudo_bytes')) { // use openssl lib if it is install. It provides a better randomness - $bytes = openssl_random_pseudo_bytes(ceil($length / 2), $strong); + $bytes = openssl_random_pseudo_bytes((int)ceil($length / 2), $strong); $hex = bin2hex($bytes); // hex() doubles the length of the string $randomString = substr($hex, 0, $length); // we truncate at most 1 char if length parameter is an odd number } else { diff --git a/app/code/core/Mage/Page/Block/Html/Pager.php b/app/code/core/Mage/Page/Block/Html/Pager.php index 62134b7950e..a38ae2d399f 100644 --- a/app/code/core/Mage/Page/Block/Html/Pager.php +++ b/app/code/core/Mage/Page/Block/Html/Pager.php @@ -163,7 +163,7 @@ public function getPageVarName() } /** - * @param string $varName + * @param bool $varName * @return $this */ public function setShowPerPage($varName) diff --git a/app/code/core/Mage/Paygate/Model/Authorizenet.php b/app/code/core/Mage/Paygate/Model/Authorizenet.php index e0f0c981080..255279504aa 100644 --- a/app/code/core/Mage/Paygate/Model/Authorizenet.php +++ b/app/code/core/Mage/Paygate/Model/Authorizenet.php @@ -312,7 +312,7 @@ public function unsetPartialAuthorizationLastActionState() /** * Send authorize request to gateway * - * @param Mage_Payment_Model_Info $payment + * @param Mage_Sales_Model_Order_Payment $payment * @param float $amount * @return $this */ @@ -338,7 +338,7 @@ public function authorize(Varien_Object $payment, $amount) /** * Send capture request to gateway * - * @param Mage_Payment_Model_Info $payment + * @param Mage_Sales_Model_Order_Payment $payment * @param float $amount * @return $this */ @@ -362,7 +362,7 @@ public function capture(Varien_Object $payment, $amount) /** * Void the payment through gateway * - * @param Mage_Payment_Model_Info $payment + * @param Mage_Sales_Model_Order_Payment $payment * @return $this */ public function void(Varien_Object $payment) @@ -396,7 +396,7 @@ public function void(Varien_Object $payment) /** * Cancel the payment through gateway * - * @param Mage_Payment_Model_Info $payment + * @param Mage_Sales_Model_Order_Payment $payment * @return $this */ public function cancel(Varien_Object $payment) @@ -407,6 +407,7 @@ public function cancel(Varien_Object $payment) /** * Refund the amount with transaction id * + * @param Mage_Sales_Model_Order_Payment $payment * @param float $requestedAmount * @return $this * @throws Mage_Core_Exception @@ -489,9 +490,9 @@ public function cancelPartialAuthorization(Mage_Payment_Model_Info $payment) /** * Send request with new payment to gateway * - * @param Mage_Payment_Model_Info $payment + * @param Mage_Sales_Model_Order_Payment $payment * @param float $amount - * @param string $requestType + * @param self::REQUEST_TYPE_AUTH_* $requestType * @return $this * @throws Mage_Core_Exception */ @@ -588,9 +589,9 @@ protected function _place($payment, $amount, $requestType) /** * Send request with new payment to gateway during partial authorization process * - * @param Mage_Payment_Model_Info $payment + * @param Mage_Sales_Model_Order_Payment $payment * @param float $amount - * @param string $requestType + * @param self::REQUEST_TYPE_AUTH_* $requestType * @return $this */ protected function _partialAuthorization($payment, $amount, $requestType) @@ -684,7 +685,7 @@ protected function _isPreauthorizeCapture($payment) /** * Send capture request to gateway for capture authorized transactions * - * @param Mage_Payment_Model_Info $payment + * @param Mage_Sales_Model_Order_Payment $payment * @param float $requestedAmount * @return $this */ @@ -738,7 +739,7 @@ protected function _preauthorizeCapture($payment, $requestedAmount) /** * Send capture request to gateway for capture authorized transactions of card * - * @param Mage_Payment_Model_Info $payment + * @param Mage_Sales_Model_Order_Payment $payment * @param float $amount * @param Varien_Object $card * @return Mage_Sales_Model_Order_Payment_Transaction @@ -805,7 +806,7 @@ protected function _preauthorizeCaptureCardTransaction($payment, $amount, $card) /** * Void the card transaction through gateway * - * @param Mage_Payment_Model_Info $payment + * @param Mage_Sales_Model_Order_Payment $payment * @param Varien_Object $card * @return Mage_Sales_Model_Order_Payment_Transaction */ @@ -906,7 +907,7 @@ protected function _isTransactionExpired($realAuthTransactionId) /** * Refund the card transaction through gateway * - * @param Mage_Payment_Model_Info $payment + * @param Mage_Sales_Model_Order_Payment $payment * @param Varien_Object $card * @return Mage_Sales_Model_Order_Payment_Transaction */ @@ -1099,7 +1100,7 @@ public function fetchTransactionInfo(Mage_Payment_Model_Info $payment, $transact /** * Set split_tender_id to quote payment if needed * - * @param Varien_Object $response + * @param Mage_Paygate_Model_Authorizenet_Result $response * @param Mage_Sales_Model_Order_Payment $orderPayment * @return bool */ @@ -1508,7 +1509,7 @@ protected function _isGatewayActionsLocked($payment) * Process exceptions for gateway action with a lot of transactions * * @param Mage_Payment_Model_Info $payment - * @param string $messages + * @param array $messages * @param bool $isSuccessfulTransactions */ protected function _processFailureMultitransactionAction($payment, $messages, $isSuccessfulTransactions) diff --git a/app/code/core/Mage/Payment/Helper/Data.php b/app/code/core/Mage/Payment/Helper/Data.php index b8d4a61232f..d8ce8a472d7 100644 --- a/app/code/core/Mage/Payment/Helper/Data.php +++ b/app/code/core/Mage/Payment/Helper/Data.php @@ -73,6 +73,7 @@ public function getStoreMethods($store = null, $quote = null) if (!$model = Mage::getStoreConfig($prefix . 'model', $store)) { continue; } + /** @var Mage_Payment_Model_Method_Abstract|false $methodInstance */ $methodInstance = Mage::getModel($model); if (!$methodInstance) { continue; diff --git a/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Group.php b/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Group.php index 2b1d591d0bc..a52b6b95ef7 100644 --- a/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Group.php +++ b/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Group.php @@ -45,7 +45,7 @@ protected function _getHeaderCommentHtml($element) * Return collapse state * * @param Varien_Data_Form_Element_Abstract $element - * @return bool + * @return int|false */ protected function _getCollapseState($element) { diff --git a/app/code/core/Mage/Paypal/Model/Api/Nvp.php b/app/code/core/Mage/Paypal/Model/Api/Nvp.php index d1421b71709..2e95da40e2e 100644 --- a/app/code/core/Mage/Paypal/Model/Api/Nvp.php +++ b/app/code/core/Mage/Paypal/Model/Api/Nvp.php @@ -1196,7 +1196,7 @@ protected function _deformatNVP($nvpstr) * NVP doesn't support passing discount total as a separate amount - add it as a line item * * @param int $i - * @return true|null + * @return bool|void */ protected function _exportLineItems(array &$request, $i = 0) { diff --git a/app/code/core/Mage/Paypal/controllers/HostedproController.php b/app/code/core/Mage/Paypal/controllers/HostedproController.php index 5c8a15fb7b8..2b411f2ab94 100644 --- a/app/code/core/Mage/Paypal/controllers/HostedproController.php +++ b/app/code/core/Mage/Paypal/controllers/HostedproController.php @@ -83,7 +83,8 @@ protected function _getCheckout() protected function _getIframeBlock() { $this->loadLayout('paypal_hosted_pro_iframe'); - return $this->getLayout() - ->getBlock('hosted.pro.iframe'); + /** @var Mage_Paypal_Block_Hosted_Pro_Iframe $block */ + $block = $this->getLayout()->getBlock('hosted.pro.iframe'); + return $block; } } diff --git a/app/code/core/Mage/Paypal/controllers/PayflowController.php b/app/code/core/Mage/Paypal/controllers/PayflowController.php index 091b8fe1db8..746cb472d75 100644 --- a/app/code/core/Mage/Paypal/controllers/PayflowController.php +++ b/app/code/core/Mage/Paypal/controllers/PayflowController.php @@ -133,7 +133,8 @@ protected function _getCheckout() protected function _getIframeBlock() { $this->loadLayout('paypal_payflow_link_iframe'); - return $this->getLayout() - ->getBlock('payflow.link.iframe'); + /** @var Mage_Paypal_Block_Payflow_Link_Iframe $block */ + $block = $this->getLayout()->getBlock('payflow.link.iframe'); + return $block; } } diff --git a/app/code/core/Mage/Paypal/controllers/PayflowadvancedController.php b/app/code/core/Mage/Paypal/controllers/PayflowadvancedController.php index ee1d7e11a37..d8107813a57 100644 --- a/app/code/core/Mage/Paypal/controllers/PayflowadvancedController.php +++ b/app/code/core/Mage/Paypal/controllers/PayflowadvancedController.php @@ -153,7 +153,8 @@ protected function _getCheckout() protected function _getIframeBlock() { $this->loadLayout('paypal_payflow_advanced_iframe'); - return $this->getLayout() - ->getBlock('payflow.advanced.iframe'); + /** @var Mage_Paypal_Block_Payflow_Advanced_Iframe $block */ + $block = $this->getLayout()->getBlock('payflow.advanced.iframe'); + return $block; } } diff --git a/app/code/core/Mage/PaypalUk/Model/Api/Nvp.php b/app/code/core/Mage/PaypalUk/Model/Api/Nvp.php index b670b8aad02..6391c9589c3 100644 --- a/app/code/core/Mage/PaypalUk/Model/Api/Nvp.php +++ b/app/code/core/Mage/PaypalUk/Model/Api/Nvp.php @@ -576,7 +576,7 @@ protected function _applyCountryWorkarounds(&$request) * Checking negative line items * * @param int $i - * @return null|true + * @return bool|void */ protected function _exportLineItems(array &$request, $i = 0) { diff --git a/app/code/core/Mage/Rating/Model/Resource/Rating/Collection.php b/app/code/core/Mage/Rating/Model/Resource/Rating/Collection.php index c062b7891a9..89afce98849 100644 --- a/app/code/core/Mage/Rating/Model/Resource/Rating/Collection.php +++ b/app/code/core/Mage/Rating/Model/Resource/Rating/Collection.php @@ -82,7 +82,7 @@ public function setPositionOrder($dir = 'ASC') /** * Set store filter * - * @param int $storeId + * @param int|array $storeId * @return $this */ public function setStoreFilter($storeId) diff --git a/app/code/core/Mage/Reports/Model/Resource/Product/Lowstock/Collection.php b/app/code/core/Mage/Reports/Model/Resource/Product/Lowstock/Collection.php index be02f03ff11..3b2cb2f34ba 100644 --- a/app/code/core/Mage/Reports/Model/Resource/Product/Lowstock/Collection.php +++ b/app/code/core/Mage/Reports/Model/Resource/Product/Lowstock/Collection.php @@ -126,7 +126,7 @@ protected function _getInventoryItemField($field) /** * Join catalog inventory stock item table for further stock_item values filters * - * @param array $fields + * @param array|string $fields * @return $this * @throws Mage_Core_Exception */ diff --git a/app/code/core/Mage/Reports/Model/Resource/Wishlist/Collection.php b/app/code/core/Mage/Reports/Model/Resource/Wishlist/Collection.php index 58409a267f0..10ee0cd531f 100644 --- a/app/code/core/Mage/Reports/Model/Resource/Wishlist/Collection.php +++ b/app/code/core/Mage/Reports/Model/Resource/Wishlist/Collection.php @@ -86,7 +86,7 @@ public function getWishlistCustomerCount() /** * Get shared items collection count * - * @return int + * @return false|string|null */ public function getSharedCount() { diff --git a/app/code/core/Mage/Sales/Block/Order/Recent.php b/app/code/core/Mage/Sales/Block/Order/Recent.php index 75527e5edae..759c8ab93ef 100644 --- a/app/code/core/Mage/Sales/Block/Order/Recent.php +++ b/app/code/core/Mage/Sales/Block/Order/Recent.php @@ -62,7 +62,7 @@ public function __construct() ['in' => Mage::getSingleton('sales/order_config')->getVisibleOnFrontStates()] ) ->addAttributeToSort('created_at', 'desc') - ->setPageSize('5') + ->setPageSize(5) ->load() ; diff --git a/app/code/core/Mage/Usa/Model/Shipping/Carrier/Usps.php b/app/code/core/Mage/Usa/Model/Shipping/Carrier/Usps.php index 3f3870316c4..65ec189f692 100644 --- a/app/code/core/Mage/Usa/Model/Shipping/Carrier/Usps.php +++ b/app/code/core/Mage/Usa/Model/Shipping/Carrier/Usps.php @@ -326,7 +326,7 @@ protected function _getXmlQuotes() $xml->addChild('Revision', '2'); $package = $xml->addChild('Package'); - $package->addAttribute('ID', 0); + $package->addAttribute('ID', '0'); $service = $this->getCode('service_to_code', $r->getService()); if (!$service) { $service = $r->getService(); @@ -370,7 +370,7 @@ protected function _getXmlQuotes() $xml->addChild('Revision', '2'); $package = $xml->addChild('Package'); - $package->addAttribute('ID', 0); + $package->addAttribute('ID', '0'); $package->addChild('Pounds', $r->getWeightPounds()); $package->addChild('Ounces', $r->getWeightOunces()); $package->addChild('MailType', 'All'); @@ -1444,7 +1444,7 @@ protected function _formUsSignatureConfirmationShipmentRequest(Varien_Object $re $xmlWrap = new SimpleXMLElement(''); $xml = $xmlWrap->addChild($rootNode); $xml->addAttribute('USERID', $this->getConfigData('userid')); - $xml->addChild('Option', 1); + $xml->addChild('Option', '1'); $xml->addChild('ImageParameters'); $xml->addChild('FromName', $request->getShipperContactPersonName()); $xml->addChild('FromFirm', $request->getShipperContactCompanyName()); @@ -1578,7 +1578,7 @@ protected function _formIntlShipmentRequest(Varien_Object $request) $xml->addAttribute('USERID', $this->getConfigData('userid')); $xml->addAttribute('PASSWORD', $this->getConfigData('password')); $xml->addChild('Option'); - $xml->addChild('Revision', self::DEFAULT_REVISION); + $xml->addChild('Revision', (string)self::DEFAULT_REVISION); $xml->addChild('ImageParameters'); $xml->addChild('FromFirstName', $request->getShipperContactPersonFirstName()); $xml->addChild('FromLastName', $request->getShipperContactPersonLastName()); @@ -1675,12 +1675,12 @@ protected function _formIntlShipmentRequest(Varien_Object $request) $ceiledQty = 1; } $individualItemWeight = $itemWeight / $ceiledQty; - $itemDetail->addChild('Quantity', $ceiledQty); - $itemDetail->addChild('Value', $item->getCustomsValue() * $item->getQty()); + $itemDetail->addChild('Quantity', (string)$ceiledQty); + $itemDetail->addChild('Value', (string)($item->getCustomsValue() * $item->getQty())); list($individualPoundsWeight, $individualOuncesWeight) = $this->_convertPoundOunces($individualItemWeight); $itemDetail->addChild('NetPounds', $individualPoundsWeight); $itemDetail->addChild('NetOunces', $individualOuncesWeight); - $itemDetail->addChild('HSTariffNumber', 0); + $itemDetail->addChild('HSTariffNumber', '0'); $itemDetail->addChild('CountryOfOrigin', $countryOfManufacture); list($itemPoundsWeight, $itemOuncesWeight) = $this->_convertPoundOunces($itemWeight); diff --git a/lib/Varien/Data/Collection.php b/lib/Varien/Data/Collection.php index c80d9ddbb5a..559ca5962e7 100644 --- a/lib/Varien/Data/Collection.php +++ b/lib/Varien/Data/Collection.php @@ -63,7 +63,7 @@ class Varien_Data_Collection implements IteratorAggregate, Countable /** * Current page number for items pager * - * @var int + * @var int|null */ protected $_curPage = 1; @@ -72,7 +72,7 @@ class Varien_Data_Collection implements IteratorAggregate, Countable * * if page size is false, then we works with all items * - * @var int | false + * @var int|false|null */ protected $_pageSize = false; @@ -486,7 +486,7 @@ public function setDataToAll($key, $value = null) /** * Set current page * - * @param int $page + * @param int|null $page * @return $this */ public function setCurPage($page) @@ -498,7 +498,7 @@ public function setCurPage($page) /** * Set collection page size * - * @param int $size + * @param int|null $size * @return $this */ public function setPageSize($size) From 0b965e92ae2e7e0532fc4bf860ed2a53914a5b28 Mon Sep 17 00:00:00 2001 From: Sven Reichel Date: Thu, 28 Nov 2024 18:34:42 +0100 Subject: [PATCH 2/2] Rector: updated UnitTests (#4391) * rector unit tests * rector phpunit * rector privatization * Revert "rector privatization" This reverts commit 0ac365a45e93c81ff84019c7696653c18453229f. --- .rector.php | 21 +++- tests/unit/Base/XmlFileLoadingTest.php | 12 +- tests/unit/Mage/Admin/Model/BlockTest.php | 4 +- tests/unit/Mage/Admin/Model/UserTest.php | 24 ++-- tests/unit/Mage/Admin/Model/VariableTest.php | 4 +- .../Block/Customer/Edit/Tab/AddressesTest.php | 4 +- .../Customer/Edit/Tab/NewsletterTest.php | 2 +- .../System/Convert/Gui/Edit/Tab/ViewTest.php | 2 +- .../Convert/Profile/Edit/Tab/EditTest.php | 2 +- .../Mage/Catalog/Helper/Product/UrlTest.php | 2 +- .../unit/Mage/Catalog/Helper/ProductTest.php | 2 +- tests/unit/Mage/Cms/Block/BlockTest.php | 2 +- tests/unit/Mage/Cms/Block/PageTest.php | 2 +- .../unit/Mage/Cms/Block/Widget/BlockTest.php | 2 +- .../Helper/EnvironmentConfigLoaderTest.php | 4 +- tests/unit/Mage/Core/Helper/SecurityTest.php | 104 ++++++++---------- tests/unit/Mage/Log/Model/CustomerTest.php | 2 +- tests/unit/Mage/Sitemap/Model/SitemapTest.php | 4 +- tests/unit/Mage/Tax/Helper/DataTest.php | 6 +- .../unit/Varien/Db/Adapter/Pdo/MysqlTest.php | 20 ++-- tests/unit/Varien/ObjectTest.php | 2 +- 21 files changed, 116 insertions(+), 111 deletions(-) diff --git a/.rector.php b/.rector.php index a132cabf00e..9ec431be384 100644 --- a/.rector.php +++ b/.rector.php @@ -39,4 +39,23 @@ DeadCode\ClassMethod\RemoveUselessReturnTagRector::class, DeadCode\Property\RemoveUselessVarTagRector::class, TypeDeclaration\ClassMethod\ReturnNeverTypeRector::class, - ]); \ No newline at end of file + ]) + ->withPreparedSets( + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + true, + false, + false, + false, + false, + true, + ); \ No newline at end of file diff --git a/tests/unit/Base/XmlFileLoadingTest.php b/tests/unit/Base/XmlFileLoadingTest.php index 5131a5ddca1..0d2d941adf9 100644 --- a/tests/unit/Base/XmlFileLoadingTest.php +++ b/tests/unit/Base/XmlFileLoadingTest.php @@ -17,6 +17,7 @@ namespace OpenMage\Tests\Unit\Base; +use Generator; use PHPUnit\Framework\TestCase; use SimpleXMLElement; use XMLReader; @@ -50,17 +51,12 @@ public function testXmlReaderIsValid(string $filepath): void $this->assertTrue($xml->isValid()); } - /** - * @return string[][] - */ - public function provideXmlFiles(): array + public function provideXmlFiles(): Generator { $root = realpath(__DIR__ . '/../../../') . '/'; - return [ - 'file from vendor directory' => [ - $root . 'vendor/shardj/zf1-future/library/Zend/Locale/Data/es_419.xml' - ], + yield 'file from vendor directory' => [ + $root . 'vendor/shardj/zf1-future/library/Zend/Locale/Data/es_419.xml' ]; } } diff --git a/tests/unit/Mage/Admin/Model/BlockTest.php b/tests/unit/Mage/Admin/Model/BlockTest.php index fe9f9e14aac..9c5c5e9c94f 100644 --- a/tests/unit/Mage/Admin/Model/BlockTest.php +++ b/tests/unit/Mage/Admin/Model/BlockTest.php @@ -48,8 +48,8 @@ public function testValidate(array $expectedResult, array $methods): void ]) ->getMock(); - $mock->expects($this->any())->method('getBlockName')->willReturn($methods['getBlockName']); - $mock->expects($this->any())->method('getIsAllowed')->willReturn($methods['getIsAllowed']); + $mock->method('getBlockName')->willReturn($methods['getBlockName']); + $mock->method('getIsAllowed')->willReturn($methods['getIsAllowed']); $this->assertEquals($expectedResult, $mock->validate()); } diff --git a/tests/unit/Mage/Admin/Model/UserTest.php b/tests/unit/Mage/Admin/Model/UserTest.php index dfcf935a5c8..34cd090d641 100644 --- a/tests/unit/Mage/Admin/Model/UserTest.php +++ b/tests/unit/Mage/Admin/Model/UserTest.php @@ -56,13 +56,13 @@ public function testAuthenticate($expectedResult, array $methods): void ]) ->getMock(); - $mock->expects($this->any())->method('loadByUsername')->willReturnSelf(); - $mock->expects($this->any())->method('getId')->willReturn($methods['getId']); + $mock->method('loadByUsername')->willReturnSelf(); + $mock->method('getId')->willReturn($methods['getId']); // $mock->expects($this->any())->method('getUsername')->willReturn($methods['getUsername']); - $mock->expects($this->any())->method('getPassword')->willReturn($methods['getPassword']); - $mock->expects($this->any())->method('validatePasswordHash')->willReturn($methods['validatePasswordHash']); - $mock->expects($this->any())->method('getIsActive')->willReturn($methods['getIsActive']); - $mock->expects($this->any())->method('hasAssigned2Role')->willReturn($methods['hasAssigned2Role']); + $mock->method('getPassword')->willReturn($methods['getPassword']); + $mock->method('validatePasswordHash')->willReturn($methods['validatePasswordHash']); + $mock->method('getIsActive')->willReturn($methods['getIsActive']); + $mock->method('hasAssigned2Role')->willReturn($methods['hasAssigned2Role']); try { $this->assertSame($expectedResult, $mock->authenticate($methods['getUsername'], $methods['getPassword'])); @@ -136,10 +136,10 @@ public function testValidate($expectedResult, array $methods): void ]) ->getMock(); - $mock->expects($this->any())->method('hasNewPassword')->willReturn($methods['hasNewPassword']); - $mock->expects($this->any())->method('getNewPassword')->willReturn($methods['getNewPassword']); - $mock->expects($this->any())->method('hasPassword')->willReturn($methods['hasPassword']); - $mock->expects($this->any())->method('getPassword')->willReturn($methods['getPassword']); + $mock->method('hasNewPassword')->willReturn($methods['hasNewPassword']); + $mock->method('getNewPassword')->willReturn($methods['getNewPassword']); + $mock->method('hasPassword')->willReturn($methods['hasPassword']); + $mock->method('getPassword')->willReturn($methods['getPassword']); $this->assertSame($expectedResult, $mock->validate()); } @@ -231,8 +231,8 @@ public function testIsResetPasswordLinkTokenExpired(bool $expectedResult, array ]) ->getMock(); - $mock->expects($this->any())->method('getRpToken')->willReturn($methods['getRpToken']); - $mock->expects($this->any())->method('getRpTokenCreatedAt')->willReturn($methods['getRpTokenCreatedAt']); + $mock->method('getRpToken')->willReturn($methods['getRpToken']); + $mock->method('getRpTokenCreatedAt')->willReturn($methods['getRpTokenCreatedAt']); $this->assertSame($expectedResult, $mock->isResetPasswordLinkTokenExpired()); } diff --git a/tests/unit/Mage/Admin/Model/VariableTest.php b/tests/unit/Mage/Admin/Model/VariableTest.php index 91aa547ae6b..f9a0acc7371 100644 --- a/tests/unit/Mage/Admin/Model/VariableTest.php +++ b/tests/unit/Mage/Admin/Model/VariableTest.php @@ -45,8 +45,8 @@ public function testValidate($expectedResult, string $variableName, string $isAl ->setMethods(['getVariableName', 'getIsAllowed']) ->getMock(); - $mock->expects($this->any())->method('getVariableName')->willReturn($variableName); - $mock->expects($this->any())->method('getIsAllowed')->willReturn($isAllowed); + $mock->method('getVariableName')->willReturn($variableName); + $mock->method('getIsAllowed')->willReturn($isAllowed); $this->assertSame($expectedResult, $mock->validate()); } diff --git a/tests/unit/Mage/Adminhtml/Block/Customer/Edit/Tab/AddressesTest.php b/tests/unit/Mage/Adminhtml/Block/Customer/Edit/Tab/AddressesTest.php index c378f22e685..34b92b06ec8 100644 --- a/tests/unit/Mage/Adminhtml/Block/Customer/Edit/Tab/AddressesTest.php +++ b/tests/unit/Mage/Adminhtml/Block/Customer/Edit/Tab/AddressesTest.php @@ -43,12 +43,12 @@ public function testInitForm(): void ->setMethods(['getRegistryCurrentCustomer', 'isReadonly']) ->getMock(); - $mock->expects($this->any()) + $mock ->method('getRegistryCurrentCustomer') // phpcs:ignore Ecg.Classes.ObjectInstantiation.DirectInstantiation ->willReturn(new Mage_Customer_Model_Customer()); - $mock->expects($this->any()) + $mock ->method('isReadonly') ->willReturn(true); diff --git a/tests/unit/Mage/Adminhtml/Block/Customer/Edit/Tab/NewsletterTest.php b/tests/unit/Mage/Adminhtml/Block/Customer/Edit/Tab/NewsletterTest.php index 94a24582212..33d9a1b8bd5 100644 --- a/tests/unit/Mage/Adminhtml/Block/Customer/Edit/Tab/NewsletterTest.php +++ b/tests/unit/Mage/Adminhtml/Block/Customer/Edit/Tab/NewsletterTest.php @@ -44,7 +44,7 @@ public function testInitForm(): void ->setMethods(['getRegistryCurrentCustomer']) ->getMock(); - $mock->expects($this->any()) + $mock ->method('getRegistryCurrentCustomer') // phpcs:ignore Ecg.Classes.ObjectInstantiation.DirectInstantiation ->willReturn(new Mage_Customer_Model_Customer()); diff --git a/tests/unit/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tab/ViewTest.php b/tests/unit/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tab/ViewTest.php index 433b9c1d4fe..6c004239908 100644 --- a/tests/unit/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tab/ViewTest.php +++ b/tests/unit/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tab/ViewTest.php @@ -43,7 +43,7 @@ public function testInitForm(): void ->setMethods(['getRegistryCurrentConvertProfile']) ->getMock(); - $mock->expects($this->any()) + $mock ->method('getRegistryCurrentConvertProfile') // phpcs:ignore Ecg.Classes.ObjectInstantiation.DirectInstantiation ->willReturn(new Mage_Dataflow_Model_Profile()); diff --git a/tests/unit/Mage/Adminhtml/Block/System/Convert/Profile/Edit/Tab/EditTest.php b/tests/unit/Mage/Adminhtml/Block/System/Convert/Profile/Edit/Tab/EditTest.php index ae38cdfa4f7..67b4fa7dba7 100644 --- a/tests/unit/Mage/Adminhtml/Block/System/Convert/Profile/Edit/Tab/EditTest.php +++ b/tests/unit/Mage/Adminhtml/Block/System/Convert/Profile/Edit/Tab/EditTest.php @@ -43,7 +43,7 @@ public function testInitForm(): void ->setMethods(['getRegistryCurrentConvertProfile']) ->getMock(); - $mock->expects($this->any()) + $mock ->method('getRegistryCurrentConvertProfile') // phpcs:ignore Ecg.Classes.ObjectInstantiation.DirectInstantiation ->willReturn(new Mage_Dataflow_Model_Profile()); diff --git a/tests/unit/Mage/Catalog/Helper/Product/UrlTest.php b/tests/unit/Mage/Catalog/Helper/Product/UrlTest.php index 121828571c3..784b02ca909 100644 --- a/tests/unit/Mage/Catalog/Helper/Product/UrlTest.php +++ b/tests/unit/Mage/Catalog/Helper/Product/UrlTest.php @@ -39,7 +39,7 @@ public function setUp(): void public function testGetConvertTable(): void { $this->assertIsArray($this->subject->getConvertTable()); - $this->assertSame(317, count($this->subject->getConvertTable())); + $this->assertCount(317, $this->subject->getConvertTable()); } /** diff --git a/tests/unit/Mage/Catalog/Helper/ProductTest.php b/tests/unit/Mage/Catalog/Helper/ProductTest.php index 0c3bbc9d547..c07fd077d9c 100644 --- a/tests/unit/Mage/Catalog/Helper/ProductTest.php +++ b/tests/unit/Mage/Catalog/Helper/ProductTest.php @@ -48,7 +48,7 @@ public function testCanUseCanonicalTag(): void */ public function testGetAttributeInputTypes(int $expectedResult, ?string $inputType = null): void { - $this->assertSame($expectedResult, count($this->subject->getAttributeInputTypes($inputType))); + $this->assertCount($expectedResult, $this->subject->getAttributeInputTypes($inputType)); } public function provideGetAttributeInputTypes(): Generator diff --git a/tests/unit/Mage/Cms/Block/BlockTest.php b/tests/unit/Mage/Cms/Block/BlockTest.php index f1e9ffe605e..7a7ae92068a 100644 --- a/tests/unit/Mage/Cms/Block/BlockTest.php +++ b/tests/unit/Mage/Cms/Block/BlockTest.php @@ -34,7 +34,7 @@ public function testGetCacheKeyInfo(string $blockId): void ->setMethods(['getBlockId']) ->getMock(); - $mock->expects($this->any())->method('getBlockId')->willReturn($blockId); + $mock->method('getBlockId')->willReturn($blockId); $this->assertIsArray($mock->getCacheKeyInfo()); } diff --git a/tests/unit/Mage/Cms/Block/PageTest.php b/tests/unit/Mage/Cms/Block/PageTest.php index ac04518946b..4bad89b579a 100644 --- a/tests/unit/Mage/Cms/Block/PageTest.php +++ b/tests/unit/Mage/Cms/Block/PageTest.php @@ -35,7 +35,7 @@ public function testGetPage(string $pageId): void ->setMethods(['getPageId']) ->getMock(); - $mock->expects($this->any())->method('getPageId')->willReturn($pageId); + $mock->method('getPageId')->willReturn($pageId); $this->assertInstanceOf(Mage_Cms_Model_Page::class, $mock->getPage()); } diff --git a/tests/unit/Mage/Cms/Block/Widget/BlockTest.php b/tests/unit/Mage/Cms/Block/Widget/BlockTest.php index b2b72c8759f..75a7645d913 100644 --- a/tests/unit/Mage/Cms/Block/Widget/BlockTest.php +++ b/tests/unit/Mage/Cms/Block/Widget/BlockTest.php @@ -44,7 +44,7 @@ public function testGetCacheKeyInfo(string $blockId): void ->setMethods(['getBlockId']) ->getMock(); - $mock->expects($this->any())->method('getBlockId')->willReturn($blockId); + $mock->method('getBlockId')->willReturn($blockId); $this->assertIsArray($mock->getCacheKeyInfo()); } diff --git a/tests/unit/Mage/Core/Helper/EnvironmentConfigLoaderTest.php b/tests/unit/Mage/Core/Helper/EnvironmentConfigLoaderTest.php index 5ce32b196a1..0ac2cdc3317 100644 --- a/tests/unit/Mage/Core/Helper/EnvironmentConfigLoaderTest.php +++ b/tests/unit/Mage/Core/Helper/EnvironmentConfigLoaderTest.php @@ -106,7 +106,7 @@ public function testEnvOverridesForValidConfigKeys(array $config): void $valueAfterOverride = $xml->getNode($configPath); // assert - $this->assertNotEquals((string)$defaultValue, (string)$valueAfterOverride, 'Default value was not overridden.'); + $this->assertNotSame((string)$defaultValue, (string)$valueAfterOverride, 'Default value was not overridden.'); } public function envOverridesCorrectConfigKeysDataProvider(): Generator @@ -222,7 +222,7 @@ public function testEnvDoesNotOverrideForInvalidConfigKeys(array $config): void } // assert - $this->assertTrue(!str_contains('value_will_not_be_changed', (string)$valueAfterCheck), 'Default value was wrongfully overridden.'); + $this->assertFalse(str_contains('value_will_not_be_changed', (string)$valueAfterCheck), 'Default value was wrongfully overridden.'); } public function envDoesNotOverrideOnWrongConfigKeysDataProvider(): Generator diff --git a/tests/unit/Mage/Core/Helper/SecurityTest.php b/tests/unit/Mage/Core/Helper/SecurityTest.php index f674f16a82d..b4a3d1adfb6 100644 --- a/tests/unit/Mage/Core/Helper/SecurityTest.php +++ b/tests/unit/Mage/Core/Helper/SecurityTest.php @@ -17,6 +17,7 @@ namespace OpenMage\Tests\Unit\Mage\Core\Helper; +use Generator; use Mage; use Mage_Core_Block_Abstract; use Mage_Core_Block_Template; @@ -37,29 +38,22 @@ public function setUp(): void } /** - * @return array|Mage_Page_Block_Html_Topmenu_Renderer|Mage_Core_Block_Template|string>> - * * @group Mage_Core * @group Mage_Core_Helper */ - public function validateAgainstBlockMethodBlacklistDataProvider(): array + public function validateAgainstBlockMethodBlacklistDataProvider(): Generator { - // phpcs:ignore Ecg.Classes.ObjectInstantiation.DirectInstantiation $topmenu = new Mage_Page_Block_Html_Topmenu_Renderer(); - // phpcs:ignore Ecg.Classes.ObjectInstantiation.DirectInstantiation $template = new Mage_Core_Block_Template(); - - return [ - [ - $topmenu, - 'setData', - [] - ], - [ - $template, - 'setData', - [] - ], + yield [ + $topmenu, + 'setData', + [] + ]; + yield [ + $template, + 'setData', + [] ]; } @@ -80,52 +74,46 @@ public function testValidateAgainstBlockMethodBlacklist( $this->subject->validateAgainstBlockMethodBlacklist($block, $method, $args); } - /** - * @return array|Mage_Page_Block_Html_Topmenu_Renderer|Mage_Core_Block_Template|string>> - */ - public function forbiddenBlockMethodsDataProvider(): array + public function forbiddenBlockMethodsDataProvider(): Generator { // phpcs:ignore Ecg.Classes.ObjectInstantiation.DirectInstantiation $topmenu = new Mage_Page_Block_Html_Topmenu_Renderer(); // phpcs:ignore Ecg.Classes.ObjectInstantiation.DirectInstantiation $template = new Mage_Core_Block_Template(); - - return [ - [ - $template, - 'fetchView', - [] - ], - [ - $topmenu, - 'fetchView', - [] - ], - [ - $topmenu, - 'render', - [] - ], - [ - $template, - 'Mage_Core_Block_Template::fetchView', - [] - ], - [ - $topmenu, - 'Mage_Page_Block_Html_Topmenu_Renderer::fetchView', - [] - ], - 'parent class name is passed as second arg' => [ - $topmenu, - 'Mage_Core_Block_Template::fetchView', - [] - ], - 'parent class name is passed as second arg2' => [ - $topmenu, - 'Mage_Core_Block_Template::render', - [] - ], + yield [ + $template, + 'fetchView', + [] + ]; + yield [ + $topmenu, + 'fetchView', + [] + ]; + yield [ + $topmenu, + 'render', + [] + ]; + yield [ + $template, + 'Mage_Core_Block_Template::fetchView', + [] + ]; + yield [ + $topmenu, + 'Mage_Page_Block_Html_Topmenu_Renderer::fetchView', + [] + ]; + yield 'parent class name is passed as second arg' => [ + $topmenu, + 'Mage_Core_Block_Template::fetchView', + [] + ]; + yield 'parent class name is passed as second arg2' => [ + $topmenu, + 'Mage_Core_Block_Template::render', + [] ]; } diff --git a/tests/unit/Mage/Log/Model/CustomerTest.php b/tests/unit/Mage/Log/Model/CustomerTest.php index 02965762adc..f029c6c759b 100644 --- a/tests/unit/Mage/Log/Model/CustomerTest.php +++ b/tests/unit/Mage/Log/Model/CustomerTest.php @@ -43,7 +43,7 @@ public function testGetLoginAtTimestamp(): void $this->assertNull($mock->getLoginAtTimestamp()); - $mock->expects($this->any())->method('getLoginAt')->willReturn(true); + $mock->method('getLoginAt')->willReturn(true); $this->assertIsInt($mock->getLoginAtTimestamp()); } } diff --git a/tests/unit/Mage/Sitemap/Model/SitemapTest.php b/tests/unit/Mage/Sitemap/Model/SitemapTest.php index 468f9ff641a..d72d3fb4451 100644 --- a/tests/unit/Mage/Sitemap/Model/SitemapTest.php +++ b/tests/unit/Mage/Sitemap/Model/SitemapTest.php @@ -41,7 +41,7 @@ public function testGetPreparedFilename(): void ->setMethods(['getSitemapFilename']) ->getMock(); - $mock->expects($this->any())->method('getSitemapFilename')->willReturn('text.xml'); + $mock->method('getSitemapFilename')->willReturn('text.xml'); $this->assertIsString($mock->getPreparedFilename()); } @@ -55,7 +55,7 @@ public function testGenerateXml(): void ->setMethods(['getSitemapFilename']) ->getMock(); - $mock->expects($this->any())->method('getSitemapFilename')->willReturn('text.xml'); + $mock->method('getSitemapFilename')->willReturn('text.xml'); $this->assertInstanceOf(Mage_Sitemap_Model_Sitemap::class, $mock->generateXml()); } } diff --git a/tests/unit/Mage/Tax/Helper/DataTest.php b/tests/unit/Mage/Tax/Helper/DataTest.php index 1f9b66855dd..c2606070696 100644 --- a/tests/unit/Mage/Tax/Helper/DataTest.php +++ b/tests/unit/Mage/Tax/Helper/DataTest.php @@ -67,6 +67,7 @@ public function testGetCalculator(): void /** * @group Mage_Tax * @group Mage_Tax_Helper + * @doesNotPerformAssertions */ public function testGetProductPrice(): void { @@ -129,6 +130,7 @@ public function testGetPriceDisplayType(): void /** * @group Mage_Tax * @group Mage_Tax_Helper + * @doesNotPerformAssertions */ public function testNeedPriceConversion(): void { @@ -141,6 +143,7 @@ public function testNeedPriceConversion(): void * @group Mage_Tax_Helper * @group runInSeparateProcess * @runInSeparateProcess + * @doesNotPerformAssertions */ public function testGetPriceFormat(): void { @@ -175,6 +178,7 @@ public function testGetAllRatesByProductClass(): void /** * @group Mage_Tax * @group Mage_Tax_Helper + * @doesNotPerformAssertions */ public function testGetPrice(): void { @@ -300,7 +304,7 @@ public function testGetShippingTaxClass(): void */ public function testGetShippingPrice(): void { - $this->assertSame(100.0, $this->subject->getShippingPrice(100.0)); + $this->assertEqualsWithDelta(100.0, $this->subject->getShippingPrice(100.0), PHP_FLOAT_EPSILON); } /** diff --git a/tests/unit/Varien/Db/Adapter/Pdo/MysqlTest.php b/tests/unit/Varien/Db/Adapter/Pdo/MysqlTest.php index 38a232440da..34a4858ab39 100644 --- a/tests/unit/Varien/Db/Adapter/Pdo/MysqlTest.php +++ b/tests/unit/Varien/Db/Adapter/Pdo/MysqlTest.php @@ -38,9 +38,7 @@ protected function setUp(): void ]; // Create a mock object for Varien_Db_Adapter_Pdo_Mysql - $this->adapter = $this->getMockBuilder(Varien_Db_Adapter_Pdo_Mysql::class) - ->disableOriginalConstructor() - ->getMock(); + $this->adapter = $this->createMock(Varien_Db_Adapter_Pdo_Mysql::class); // Call the constructor manually with our config $reflectedAdapter = new \ReflectionClass(Varien_Db_Adapter_Pdo_Mysql::class); @@ -79,7 +77,7 @@ public function testGetHostInfoWithIpv4Address(): void /** @var Varien_Object $hostInfo */ $hostInfo = $method->invoke($this->adapter, '192.168.1.1:3306'); - $this->assertSame($hostInfo->getAddressType(), Varien_Db_Adapter_Pdo_Mysql::ADDRESS_TYPE_IPV4_ADDRESS); + $this->assertSame(Varien_Db_Adapter_Pdo_Mysql::ADDRESS_TYPE_IPV4_ADDRESS, $hostInfo->getAddressType()); $this->assertSame('192.168.1.1', $hostInfo->getHostName()); $this->assertSame('3306', $hostInfo->getPort()); $this->assertNull($hostInfo->getUnixSocket()); @@ -96,7 +94,7 @@ public function testGetHostInfoWithIpv4AddressWithoutPort(): void /** @var Varien_Object $hostInfo */ $hostInfo = $method->invoke($this->adapter, '192.168.1.1'); - $this->assertSame($hostInfo->getAddressType(), Varien_Db_Adapter_Pdo_Mysql::ADDRESS_TYPE_IPV4_ADDRESS); + $this->assertSame(Varien_Db_Adapter_Pdo_Mysql::ADDRESS_TYPE_IPV4_ADDRESS, $hostInfo->getAddressType()); $this->assertSame('192.168.1.1', $hostInfo->getHostName()); $this->assertNull($hostInfo->getPort()); $this->assertNull($hostInfo->getUnixSocket()); @@ -113,7 +111,7 @@ public function testGetHostInfoWithHostname(): void /** @var Varien_Object $hostInfo */ $hostInfo = $method->invoke($this->adapter, 'db.example.com:3306'); - $this->assertSame($hostInfo->getAddressType(), Varien_Db_Adapter_Pdo_Mysql::ADDRESS_TYPE_HOSTNAME); + $this->assertSame(Varien_Db_Adapter_Pdo_Mysql::ADDRESS_TYPE_HOSTNAME, $hostInfo->getAddressType()); $this->assertSame('db.example.com', $hostInfo->getHostName()); $this->assertSame('3306', $hostInfo->getPort()); $this->assertNull($hostInfo->getUnixSocket()); @@ -130,7 +128,7 @@ public function testGetHostInfoWithHostnameWithoutPort(): void /** @var Varien_Object $hostInfo */ $hostInfo = $method->invoke($this->adapter, 'db.example.com'); - $this->assertSame($hostInfo->getAddressType(), Varien_Db_Adapter_Pdo_Mysql::ADDRESS_TYPE_HOSTNAME); + $this->assertSame(Varien_Db_Adapter_Pdo_Mysql::ADDRESS_TYPE_HOSTNAME, $hostInfo->getAddressType()); $this->assertSame('db.example.com', $hostInfo->getHostName()); $this->assertNull($hostInfo->getPort()); $this->assertNull($hostInfo->getUnixSocket()); @@ -147,7 +145,7 @@ public function testGetHostInfoWithIpv6Address(): void /** @var Varien_Object $hostInfo */ $hostInfo = $method->invoke($this->adapter, '[2001:db8::1]:3306'); - $this->assertSame($hostInfo->getAddressType(), Varien_Db_Adapter_Pdo_Mysql::ADDRESS_TYPE_IPV6_ADDRESS); + $this->assertSame(Varien_Db_Adapter_Pdo_Mysql::ADDRESS_TYPE_IPV6_ADDRESS, $hostInfo->getAddressType()); $this->assertSame('2001:db8::1', $hostInfo->getHostName()); $this->assertSame('3306', $hostInfo->getPort()); $this->assertNull($hostInfo->getUnixSocket()); @@ -164,7 +162,7 @@ public function testGetHostInfoWithIpv6AddressWithoutPort(): void /** @var Varien_Object $hostInfo */ $hostInfo = $method->invoke($this->adapter, '2001:db8::1'); - $this->assertSame($hostInfo->getAddressType(), Varien_Db_Adapter_Pdo_Mysql::ADDRESS_TYPE_IPV6_ADDRESS); + $this->assertSame(Varien_Db_Adapter_Pdo_Mysql::ADDRESS_TYPE_IPV6_ADDRESS, $hostInfo->getAddressType()); $this->assertSame('2001:db8::1', $hostInfo->getHostName()); $this->assertNull($hostInfo->getPort()); $this->assertNull($hostInfo->getUnixSocket()); @@ -181,7 +179,7 @@ public function testGetHostInfoWithIpv6AddressWithZoneId(): void /** @var Varien_Object $hostInfo */ $hostInfo = $method->invoke($this->adapter, '[fe80::1%eth0]:3306'); - $this->assertSame($hostInfo->getAddressType(), Varien_Db_Adapter_Pdo_Mysql::ADDRESS_TYPE_IPV6_ADDRESS); + $this->assertSame(Varien_Db_Adapter_Pdo_Mysql::ADDRESS_TYPE_IPV6_ADDRESS, $hostInfo->getAddressType()); $this->assertSame('fe80::1%eth0', $hostInfo->getHostName()); $this->assertSame('3306', $hostInfo->getPort()); $this->assertNull($hostInfo->getUnixSocket()); @@ -198,7 +196,7 @@ public function testGetHostInfoWithIpv6AddressWithZoneIdWithoutPort(): void /** @var Varien_Object $hostInfo */ $hostInfo = $method->invoke($this->adapter, 'fe80::1%eth0'); - $this->assertSame($hostInfo->getAddressType(), Varien_Db_Adapter_Pdo_Mysql::ADDRESS_TYPE_IPV6_ADDRESS); + $this->assertSame(Varien_Db_Adapter_Pdo_Mysql::ADDRESS_TYPE_IPV6_ADDRESS, $hostInfo->getAddressType()); $this->assertSame('fe80::1%eth0', $hostInfo->getHostName()); $this->assertNull($hostInfo->getPort()); $this->assertNull($hostInfo->getUnixSocket()); diff --git a/tests/unit/Varien/ObjectTest.php b/tests/unit/Varien/ObjectTest.php index fc791421409..211adeb0f5f 100644 --- a/tests/unit/Varien/ObjectTest.php +++ b/tests/unit/Varien/ObjectTest.php @@ -244,7 +244,7 @@ public function testOffset(): void $this->subject->offsetSet('off', 'set'); $this->assertTrue($this->subject->offsetExists('off')); $this->assertSame('set', $this->subject->offsetGet('off')); - $this->assertSame(null, $this->subject->offsetGet('not-exists')); + $this->assertNull($this->subject->offsetGet('not-exists')); $this->subject->offsetUnset('off'); $this->assertFalse($this->subject->offsetExists('off'));