diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 43b4d571c02..549047d501e 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -40,7 +40,7 @@ jobs: uses: actions/cache/restore@v4 with: path: .phpstan.cache - key: "phpstan-result-cache-${{ github.run_id }}" + key: phpstan-result-cache-${{ matrix.php-versions }}-${{ github.run_id }} restore-keys: | phpstan-result-cache- @@ -52,4 +52,4 @@ jobs: if: always() with: path: .phpstan.cache - key: "phpstan-result-cache-${{ github.run_id }}" \ No newline at end of file + key: phpstan-result-cache-${{ matrix.php-versions }}-${{ github.run_id }} \ No newline at end of file diff --git a/.phpstan.dist.baseline.neon b/.phpstan.dist.baseline.neon index 5c1c001b259..013eec00674 100644 --- a/.phpstan.dist.baseline.neon +++ b/.phpstan.dist.baseline.neon @@ -495,21 +495,6 @@ parameters: count: 1 path: app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tab/Wizard.php - - - message: "#^Variable \\$attributes might not be defined\\.$#" - count: 1 - path: app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tab/Wizard.php - - - - message: "#^Variable \\$img might not be defined\\.$#" - count: 1 - path: app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Run.php - - - - message: "#^Variable \\$liStyle might not be defined\\.$#" - count: 1 - path: app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Run.php - - message: "#^Parameter \\#1 \\$currency of method Mage_Directory_Model_Currency\\:\\:getCurrencyRates\\(\\) expects string, array given\\.$#" count: 1 @@ -685,11 +670,6 @@ parameters: count: 2 path: app/code/core/Mage/Adminhtml/Model/Sales/Order/Create.php - - - message: "#^Variable \\$shippingAddress might not be defined\\.$#" - count: 1 - path: app/code/core/Mage/Adminhtml/Model/Sales/Order/Create.php - - message: "#^Call to an undefined method Mage_Sales_Model_Order\\:\\:createFromQuoteAddress\\(\\)\\.$#" count: 1 @@ -720,11 +700,6 @@ parameters: count: 1 path: app/code/core/Mage/Adminhtml/Model/System/Config/Source/Country.php - - - message: "#^Variable \\$values might not be defined\\.$#" - count: 1 - path: app/code/core/Mage/Adminhtml/Model/System/Store.php - - message: "#^Return type \\(Mage_Adminhtml_Helper_Catalog_Product_Edit_Action_Attribute\\) of method Mage_Adminhtml_Catalog_Product_Action_AttributeController\\:\\:_getHelper\\(\\) should be compatible with return type \\(Mage_Adminhtml_Helper_Data\\) of method Mage_Adminhtml_Controller_Action\\:\\:_getHelper\\(\\)$#" count: 1 @@ -870,11 +845,6 @@ parameters: count: 4 path: app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php - - - message: "#^Variable \\$pdf might not be defined\\.$#" - count: 4 - path: app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php - - message: "#^Variable \\$data in isset\\(\\) always exists and is not nullable\\.$#" count: 1 @@ -890,31 +860,6 @@ parameters: count: 1 path: app/code/core/Mage/Adminhtml/controllers/System/CurrencyController.php - - - message: "#^Variable \\$codeBase might not be defined\\.$#" - count: 1 - path: app/code/core/Mage/Adminhtml/controllers/System/StoreController.php - - - - message: "#^Variable \\$itemId might not be defined\\.$#" - count: 1 - path: app/code/core/Mage/Adminhtml/controllers/System/StoreController.php - - - - message: "#^Variable \\$model might not be defined\\.$#" - count: 5 - path: app/code/core/Mage/Adminhtml/controllers/System/StoreController.php - - - - message: "#^Variable \\$notExists might not be defined\\.$#" - count: 1 - path: app/code/core/Mage/Adminhtml/controllers/System/StoreController.php - - - - message: "#^Variable \\$title might not be defined\\.$#" - count: 1 - path: app/code/core/Mage/Adminhtml/controllers/System/StoreController.php - - message: "#^Method Mage_Directory_Model_Country\\:\\:loadByCode\\(\\) invoked with 2 parameters, 1 required\\.$#" count: 1 @@ -1110,11 +1055,6 @@ parameters: count: 1 path: app/code/core/Mage/Api2/Block/Adminhtml/Roles/Tab/Resources.php - - - message: "#^Cannot access offset 'order' on int\\.$#" - count: 4 - path: app/code/core/Mage/Api2/Helper/Data.php - - message: "#^Variable \\$adapters might not be defined\\.$#" count: 1 @@ -1350,16 +1290,6 @@ parameters: count: 1 path: app/code/core/Mage/Authorizenet/controllers/Directpost/PaymentController.php - - - message: "#^Method Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Bundle_Option_Selection\\:\\:isUsedWebsitePrice\\(\\) should return string but returns bool\\.$#" - count: 1 - path: app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Selection.php - - - - message: "#^Parameter \\#4 \\$cond of method Mage_Eav_Model_Entity_Collection_Abstract\\:\\:joinTable\\(\\) expects array\\|null, string given\\.$#" - count: 1 - path: app/code/core/Mage/Bundle/Block/Catalog/Product/List/Partof.php - - message: "#^Call to an undefined method Mage_Catalog_Model_Product_Configuration_Item_Interface\\:\\:getQty\\(\\)\\.$#" count: 1 @@ -1455,11 +1385,6 @@ parameters: count: 1 path: app/code/core/Mage/Bundle/Model/Resource/Indexer/Price.php - - - message: "#^Parameter \\#3 \\$false of method Varien_Db_Adapter_Pdo_Mysql\\:\\:getCheckSql\\(\\) expects string, int given\\.$#" - count: 1 - path: app/code/core/Mage/Bundle/Model/Resource/Indexer/Price.php - - message: "#^Parameter \\#5 \\$condition of method Mage_Catalog_Model_Resource_Product_Indexer_Abstract\\:\\:_addAttributeToSelect\\(\\) expects Zend_Db_Expr\\|null, string given\\.$#" count: 2 @@ -1690,11 +1615,6 @@ parameters: count: 1 path: app/code/core/Mage/Catalog/Block/Widget/Link.php - - - message: "#^Parameter \\#4 \\$cond of method Mage_Eav_Model_Entity_Collection_Abstract\\:\\:joinTable\\(\\) expects array\\|null, string given\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Helper/Category/Url/Rewrite.php - - message: "#^Parameter \\#1 \\$categoryId of method Mage_Catalog_Helper_Data\\:\\:_isCategoryLink\\(\\) expects int, string given\\.$#" count: 1 @@ -2285,26 +2205,6 @@ parameters: count: 1 path: app/code/core/Mage/Catalog/Model/Resource/Category/Indexer/Product.php - - - message: "#^Parameter \\#2 \\$true of method Varien_Db_Adapter_Interface\\:\\:getCheckSql\\(\\) expects string, int given\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Model/Resource/Category/Indexer/Product.php - - - - message: "#^Parameter \\#2 \\$true of method Varien_Db_Adapter_Pdo_Mysql\\:\\:getCheckSql\\(\\) expects string, int given\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Model/Resource/Category/Indexer/Product.php - - - - message: "#^Parameter \\#3 \\$false of method Varien_Db_Adapter_Interface\\:\\:getCheckSql\\(\\) expects string, int given\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Model/Resource/Category/Indexer/Product.php - - - - message: "#^Parameter \\#3 \\$false of method Varien_Db_Adapter_Pdo_Mysql\\:\\:getCheckSql\\(\\) expects string, int given\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Model/Resource/Category/Indexer/Product.php - - message: "#^Variable \\$anchorProductsTable might not be defined\\.$#" count: 1 @@ -2340,31 +2240,16 @@ parameters: count: 1 path: app/code/core/Mage/Catalog/Model/Resource/Category/Tree.php - - - message: "#^Parameter \\#1 \\$category \\(Mage_Catalog_Model_Category\\) of method Mage_Catalog_Model_Resource_Category_Tree\\:\\:move\\(\\) should be compatible with parameter \\$node \\(Varien_Data_Tree_Node\\) of method Varien_Data_Tree_Dbp\\:\\:move\\(\\)$#" - count: 1 - path: app/code/core/Mage/Catalog/Model/Resource/Category/Tree.php - - message: "#^Parameter \\#1 \\$connection of method Varien_Data_Tree_Dbp\\:\\:__construct\\(\\) expects Zend_Db_Adapter_Abstract, Varien_Db_Adapter_Interface\\|false given\\.$#" count: 1 path: app/code/core/Mage/Catalog/Model/Resource/Category/Tree.php - - - message: "#^Parameter \\#1 \\$node of method Varien_Data_Tree_Dbp\\:\\:move\\(\\) expects Varien_Data_Tree_Node, Mage_Catalog_Model_Category given\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Model/Resource/Category/Tree.php - - message: "#^Parameter \\#2 \\$cols of method Zend_Db_Select\\:\\:from\\(\\) expects array\\|string\\|Zend_Db_Expr, null given\\.$#" count: 1 path: app/code/core/Mage/Catalog/Model/Resource/Category/Tree.php - - - message: "#^Parameter \\#3 \\$parentNode of method Varien_Data_Tree_Dbp\\:\\:addChildNodes\\(\\) expects Varien_Data_Tree_Node, null given\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Model/Resource/Category/Tree.php - - message: "#^Parameter \\#2 \\$alias of method Varien_Db_Adapter_Interface\\:\\:quoteColumnAs\\(\\) expects string, null given\\.$#" count: 2 @@ -2395,11 +2280,6 @@ parameters: count: 1 path: app/code/core/Mage/Catalog/Model/Resource/Product.php - - - message: "#^Method Mage_Catalog_Model_Resource_Product_Attribute_Backend_Media\\:\\:insertGallery\\(\\) should return int but returns string\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Model/Resource/Product/Attribute/Backend/Media.php - - message: "#^Method Mage_Catalog_Model_Url\\:\\:refreshProductRewrites\\(\\) invoked with 3 parameters, 1 required\\.$#" count: 1 @@ -2450,11 +2330,6 @@ parameters: count: 1 path: app/code/core/Mage/Catalog/Model/Resource/Product/Collection.php - - - message: "#^Parameter \\#4 \\$cond of method Mage_Eav_Model_Entity_Collection_Abstract\\:\\:joinTable\\(\\) expects array\\|null, string given\\.$#" - count: 1 - path: app/code/core/Mage/Catalog/Model/Resource/Product/Collection.php - - message: "#^Property Mage_Catalog_Model_Resource_Product_Collection\\:\\:\\$_urlRewriteCategory \\(int\\) does not accept default value of type string\\.$#" count: 1 @@ -2510,21 +2385,11 @@ parameters: count: 1 path: app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Price/Configurable.php - - - message: "#^Parameter \\#3 \\$false of method Varien_Db_Adapter_Pdo_Mysql\\:\\:getCheckSql\\(\\) expects string, int given\\.$#" - count: 5 - path: app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Price/Default.php - - message: "#^Parameter \\#5 \\$condition of method Mage_Catalog_Model_Resource_Product_Indexer_Abstract\\:\\:_addAttributeToSelect\\(\\) expects Zend_Db_Expr\\|null, string given\\.$#" count: 1 path: app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Price/Default.php - - - message: "#^Parameter \\#3 \\$false of method Varien_Db_Adapter_Pdo_Mysql\\:\\:getCheckSql\\(\\) expects string, int given\\.$#" - count: 2 - path: app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Price/Grouped.php - - message: "#^Parameter \\#5 \\$condition of method Mage_Catalog_Model_Resource_Product_Indexer_Abstract\\:\\:_addAttributeToSelect\\(\\) expects Zend_Db_Expr\\|null, string given\\.$#" count: 1 @@ -2700,66 +2565,6 @@ parameters: count: 1 path: app/code/core/Mage/CatalogInventory/Model/Resource/Indexer/Stock.php - - - message: "#^Parameter \\#2 \\$true of method Varien_Db_Adapter_Pdo_Mysql\\:\\:getCheckSql\\(\\) expects string, int given\\.$#" - count: 1 - path: app/code/core/Mage/CatalogInventory/Model/Resource/Indexer/Stock/Configurable.php - - - - message: "#^Parameter \\#3 \\$false of method Varien_Db_Adapter_Pdo_Mysql\\:\\:getCheckSql\\(\\) expects string, int given\\.$#" - count: 2 - path: app/code/core/Mage/CatalogInventory/Model/Resource/Indexer/Stock/Configurable.php - - - - message: "#^Parameter \\#2 \\$true of method Varien_Db_Adapter_Pdo_Mysql\\:\\:getCheckSql\\(\\) expects string, int given\\.$#" - count: 2 - path: app/code/core/Mage/CatalogInventory/Model/Resource/Indexer/Stock/Default.php - - - - message: "#^Parameter \\#3 \\$false of method Varien_Db_Adapter_Pdo_Mysql\\:\\:getCheckSql\\(\\) expects string, int given\\.$#" - count: 3 - path: app/code/core/Mage/CatalogInventory/Model/Resource/Indexer/Stock/Default.php - - - - message: "#^Parameter \\#2 \\$true of method Varien_Db_Adapter_Pdo_Mysql\\:\\:getCheckSql\\(\\) expects string, int given\\.$#" - count: 1 - path: app/code/core/Mage/CatalogInventory/Model/Resource/Indexer/Stock/Grouped.php - - - - message: "#^Parameter \\#3 \\$false of method Varien_Db_Adapter_Pdo_Mysql\\:\\:getCheckSql\\(\\) expects string, int given\\.$#" - count: 2 - path: app/code/core/Mage/CatalogInventory/Model/Resource/Indexer/Stock/Grouped.php - - - - message: "#^Parameter \\#1 \\$fieldName of method Varien_Db_Adapter_Interface\\:\\:prepareSqlCondition\\(\\) expects string, bool given\\.$#" - count: 1 - path: app/code/core/Mage/CatalogInventory/Model/Resource/Stock.php - - - - message: "#^Parameter \\#2 \\$true of method Varien_Db_Adapter_Interface\\:\\:getCheckSql\\(\\) expects string, int given\\.$#" - count: 1 - path: app/code/core/Mage/CatalogInventory/Model/Resource/Stock.php - - - - message: "#^Parameter \\#4 \\$cond of method Mage_Eav_Model_Entity_Collection_Abstract\\:\\:joinTable\\(\\) expects array\\|null, string given\\.$#" - count: 1 - path: app/code/core/Mage/CatalogInventory/Model/Resource/Stock.php - - - - message: "#^Property Mage_CatalogInventory_Model_Resource_Stock\\:\\:\\$_isConfigBackorders \\(bool\\) does not accept int\\.$#" - count: 1 - path: app/code/core/Mage/CatalogInventory/Model/Resource/Stock.php - - - - message: "#^Property Mage_CatalogInventory_Model_Resource_Stock\\:\\:\\$_isConfigManageStock \\(bool\\) does not accept int\\.$#" - count: 1 - path: app/code/core/Mage/CatalogInventory/Model/Resource/Stock.php - - - - message: "#^Parameter \\#2 \\$true of method Varien_Db_Adapter_Pdo_Mysql\\:\\:getCheckSql\\(\\) expects string, int given\\.$#" - count: 1 - path: app/code/core/Mage/CatalogInventory/Model/Resource/Stock/Item.php - - message: "#^Method Mage_CatalogInventory_Model_Resource_Stock_Item_Collection\\:\\:_initSelect\\(\\) should return \\$this\\(Mage_CatalogInventory_Model_Resource_Stock_Item_Collection\\) but returns Varien_Db_Select\\.$#" count: 1 @@ -3020,11 +2825,6 @@ parameters: count: 1 path: app/code/core/Mage/Checkout/Model/Cart/Payment/Api/V2.php - - - message: "#^Method Mage_Checkout_Model_Cart_Product_Api_V2\\:\\:_prepareProductsData\\(\\) should return array but returns mixed\\.$#" - count: 1 - path: app/code/core/Mage/Checkout/Model/Cart/Product/Api/V2.php - - message: "#^Method Mage_Checkout_Model_Session\\:\\:getQuoteId\\(\\) invoked with 1 parameter, 0 required\\.$#" count: 1 @@ -3840,11 +3640,6 @@ parameters: count: 1 path: app/code/core/Mage/Customer/Model/Resource/Customer.php - - - message: "#^Parameter \\#3 \\$attribute of method Mage_Eav_Model_Entity_Collection_Abstract\\:\\:addExpressionAttributeToSelect\\(\\) expects string, array\\ given\\.$#" - count: 1 - path: app/code/core/Mage/Customer/Model/Resource/Customer/Collection.php - - message: "#^Parameter \\#2 \\$resourceModel of method Mage_Core_Model_Resource_Db_Collection_Abstract\\:\\:_init\\(\\) expects Mage_Core_Model_Resource_Db_Abstract\\|null, string given\\.$#" count: 1 @@ -4290,11 +4085,6 @@ parameters: count: 4 path: app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php - - - message: "#^Parameter \\#2 \\$array of function implode expects array\\, array\\\\|string\\> given\\.$#" - count: 1 - path: app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php - - message: "#^Property Mage_Eav_Model_Entity_Collection_Abstract\\:\\:\\$_entity \\(Mage_Eav_Model_Entity_Abstract\\) in empty\\(\\) is not falsy\\.$#" count: 1 @@ -4665,11 +4455,6 @@ parameters: count: 1 path: app/code/core/Mage/Index/Model/Resource/Lock/Resource.php - - - message: "#^Parameter \\#2 \\$true of method Varien_Db_Adapter_Interface\\:\\:getCheckSql\\(\\) expects string, int given\\.$#" - count: 1 - path: app/code/core/Mage/Index/Model/Resource/Process/Collection.php - - message: "#^Return type \\(void\\) of method Mage_Index_Model_Resource_Setup\\:\\:applyUpdates\\(\\) should be compatible with return type \\(\\$this\\(Mage_Core_Model_Resource_Setup\\)\\|true\\) of method Mage_Core_Model_Resource_Setup\\:\\:applyUpdates\\(\\)$#" count: 1 @@ -5071,17 +4856,12 @@ parameters: path: app/code/core/Mage/Paypal/Model/Observer.php - - message: "#^Parameter \\#1 \\$payment of method Mage_Paypal_Model_Payflowlink\\:\\:_buildTokenRequest\\(\\) expects Mage_Sales_Model_Order_Payment, Mage_Payment_Model_Info given\\.$#" - count: 1 - path: app/code/core/Mage/Paypal/Model/Payflowlink.php - - - - message: "#^Parameter \\#1 \\$payment of method Mage_Paypal_Model_Payflowlink\\:\\:_generateSecureSilentPostHash\\(\\) expects Mage_Sales_Model_Order_Payment, Mage_Payment_Model_Info given\\.$#" + message: "#^PHPDoc tag @param for parameter \\$payment with type Mage_Payment_Model_Info is not subtype of native type Mage_Sales_Model_Order_Payment\\.$#" count: 1 path: app/code/core/Mage/Paypal/Model/Payflowlink.php - - message: "#^Parameter \\#2 \\$payment of method Mage_Paypal_Model_Payflowlink\\:\\:_processTokenErrors\\(\\) expects Mage_Sales_Model_Order_Payment, Mage_Payment_Model_Info given\\.$#" + message: "#^Parameter \\#1 \\$payment of method Mage_Paypal_Model_Payflowlink\\:\\:_buildTokenRequest\\(\\) expects Mage_Sales_Model_Order_Payment, Mage_Payment_Model_Info given\\.$#" count: 1 path: app/code/core/Mage/Paypal/Model/Payflowlink.php @@ -5245,16 +5025,6 @@ parameters: count: 1 path: app/code/core/Mage/Reports/Model/Report.php - - - message: "#^Parameter \\#3 \\$attribute of method Mage_Eav_Model_Entity_Collection_Abstract\\:\\:addExpressionAttributeToSelect\\(\\) expects string, array\\ given\\.$#" - count: 1 - path: app/code/core/Mage/Reports/Model/Resource/Accounts/Collection.php - - - - message: "#^Parameter \\#3 \\$attribute of method Mage_Eav_Model_Entity_Collection_Abstract\\:\\:addExpressionAttributeToSelect\\(\\) expects string, array\\ given\\.$#" - count: 6 - path: app/code/core/Mage/Reports/Model/Resource/Coupons/Collection.php - - message: "#^Call to an undefined method Mage_Customer_Model_Customer\\:\\:remove\\(\\)\\.$#" count: 1 @@ -5281,35 +5051,10 @@ parameters: path: app/code/core/Mage/Reports/Model/Resource/Event.php - - message: "#^Method Mage_Reports_Model_Resource_Helper_Mysql4\\:\\:mergeVisitorProductIndex\\(\\) should return string but returns int\\.$#" - count: 1 - path: app/code/core/Mage/Reports/Model/Resource/Helper/Mysql4.php - - - - message: "#^Parameter \\#2 \\$true of method Varien_Db_Adapter_Interface\\:\\:getCheckSql\\(\\) expects string, int given\\.$#" - count: 1 - path: app/code/core/Mage/Reports/Model/Resource/Helper/Mysql4.php - - - - message: "#^Parameter \\#3 \\$false of method Varien_Db_Adapter_Interface\\:\\:getCheckSql\\(\\) expects string, int given\\.$#" + message: "#^Return type \\(int\\) of method Mage_Reports_Model_Resource_Helper_Mysql4\\:\\:mergeVisitorProductIndex\\(\\) should be compatible with return type \\(string\\) of method Mage_Reports_Model_Resource_Helper_Interface\\:\\:mergeVisitorProductIndex\\(\\)$#" count: 1 path: app/code/core/Mage/Reports/Model/Resource/Helper/Mysql4.php - - - message: "#^Parameter \\#2 \\$true of method Varien_Db_Adapter_Interface\\:\\:getCheckSql\\(\\) expects string, int given\\.$#" - count: 1 - path: app/code/core/Mage/Reports/Model/Resource/Invoiced/Collection.php - - - - message: "#^Parameter \\#3 \\$attribute of method Mage_Eav_Model_Entity_Collection_Abstract\\:\\:addExpressionAttributeToSelect\\(\\) expects string, array\\ given\\.$#" - count: 8 - path: app/code/core/Mage/Reports/Model/Resource/Invoiced/Collection.php - - - - message: "#^Parameter \\#3 \\$false of method Varien_Db_Adapter_Interface\\:\\:getCheckSql\\(\\) expects string, int given\\.$#" - count: 1 - path: app/code/core/Mage/Reports/Model/Resource/Invoiced/Collection.php - - message: "#^Method Mage_Reports_Model_Resource_Order_Collection\\:\\:_prepareSummaryAggregated\\(\\) invoked with 4 parameters, 3 required\\.$#" count: 1 @@ -5335,21 +5080,11 @@ parameters: count: 1 path: app/code/core/Mage/Reports/Model/Resource/Order/Collection.php - - - message: "#^Parameter \\#3 \\$false of method Varien_Db_Adapter_Interface\\:\\:getCheckSql\\(\\) expects string, int given\\.$#" - count: 1 - path: app/code/core/Mage/Reports/Model/Resource/Order/Collection.php - - message: "#^Variable \\$productViewEvent might not be defined\\.$#" count: 1 path: app/code/core/Mage/Reports/Model/Resource/Product/Collection.php - - - message: "#^Parameter \\#2 \\$true of method Varien_Db_Adapter_Interface\\:\\:getCheckSql\\(\\) expects string, int given\\.$#" - count: 2 - path: app/code/core/Mage/Reports/Model/Resource/Product/Lowstock/Collection.php - - message: "#^Parameter \\#1 \\$from of method Mage_Reports_Model_Resource_Product_Ordered_Collection\\:\\:_joinFields\\(\\) expects string, int given\\.$#" count: 1 @@ -5385,11 +5120,6 @@ parameters: count: 2 path: app/code/core/Mage/Reports/Model/Resource/Quote/Collection.php - - - message: "#^Parameter \\#3 \\$attribute of method Mage_Eav_Model_Entity_Collection_Abstract\\:\\:addExpressionAttributeToSelect\\(\\) expects string, array\\ given\\.$#" - count: 7 - path: app/code/core/Mage/Reports/Model/Resource/Refunded/Collection.php - - message: "#^Parameter \\#1 \\$datetime of method Mage_Reports_Model_Resource_Report_Collection\\:\\:timeShift\\(\\) expects string, int given\\.$#" count: 4 @@ -5425,16 +5155,6 @@ parameters: count: 1 path: app/code/core/Mage/Reports/Model/Resource/Review/Collection.php - - - message: "#^Parameter \\#3 \\$attribute of method Mage_Eav_Model_Entity_Collection_Abstract\\:\\:addExpressionAttributeToSelect\\(\\) expects string, array\\ given\\.$#" - count: 3 - path: app/code/core/Mage/Reports/Model/Resource/Shipping/Collection.php - - - - message: "#^Parameter \\#3 \\$attribute of method Mage_Eav_Model_Entity_Collection_Abstract\\:\\:addExpressionAttributeToSelect\\(\\) expects string, array\\ given\\.$#" - count: 2 - path: app/code/core/Mage/Reports/Model/Resource/Tax/Collection.php - - message: "#^Method Mage_Reports_Model_Resource_Wishlist_Collection\\:\\:getSharedCount\\(\\) should return int but returns string\\|false\\|null\\.$#" count: 1 @@ -6020,16 +5740,6 @@ parameters: count: 2 path: app/code/core/Mage/Sales/Model/Resource/Report/Invoiced.php - - - message: "#^Parameter \\#2 \\$true of method Varien_Db_Adapter_Pdo_Mysql\\:\\:getCheckSql\\(\\) expects string, int given\\.$#" - count: 1 - path: app/code/core/Mage/Sales/Model/Resource/Report/Invoiced.php - - - - message: "#^Parameter \\#3 \\$false of method Varien_Db_Adapter_Pdo_Mysql\\:\\:getCheckSql\\(\\) expects string, int given\\.$#" - count: 1 - path: app/code/core/Mage/Sales/Model/Resource/Report/Invoiced.php - - message: "#^Parameter \\#1 \\$expression of class Zend_Db_Expr constructor expects string, int given\\.$#" count: 1 @@ -6086,7 +5796,7 @@ parameters: path: app/code/core/Mage/SalesRule/Model/Observer.php - - message: "#^Return type \\(array\\) of method Mage_SalesRule_Model_Quote_Nominal_Discount\\:\\:fetch\\(\\) should be compatible with return type \\(Mage_SalesRule_Model_Quote_Discount\\) of method Mage_SalesRule_Model_Quote_Discount\\:\\:fetch\\(\\)$#" + message: "#^Return type \\(array\\) of method Mage_SalesRule_Model_Quote_Nominal_Discount\\:\\:fetch\\(\\) should be compatible with return type \\(\\$this\\(Mage_SalesRule_Model_Quote_Discount\\)\\) of method Mage_SalesRule_Model_Quote_Discount\\:\\:fetch\\(\\)$#" count: 1 path: app/code/core/Mage/SalesRule/Model/Quote/Nominal/Discount.php @@ -6095,16 +5805,6 @@ parameters: count: 1 path: app/code/core/Mage/SalesRule/Model/Resource/Coupon.php - - - message: "#^Parameter \\#2 \\$true of method Varien_Db_Adapter_Interface\\:\\:getCheckSql\\(\\) expects string, int given\\.$#" - count: 1 - path: app/code/core/Mage/SalesRule/Model/Resource/Coupon/Collection.php - - - - message: "#^Parameter \\#3 \\$false of method Varien_Db_Adapter_Interface\\:\\:getCheckSql\\(\\) expects string, int given\\.$#" - count: 1 - path: app/code/core/Mage/SalesRule/Model/Resource/Coupon/Collection.php - - message: "#^Binary operation \"\\+\\=\" between string\\|null and \\-1\\|1 results in an error\\.$#" count: 1 @@ -6160,11 +5860,6 @@ parameters: count: 1 path: app/code/core/Mage/Shipping/Model/Carrier/Abstract.php - - - message: "#^Parameter \\#1 \\$cost of method Mage_Shipping_Model_Carrier_Abstract\\:\\:getFinalPriceWithHandlingFee\\(\\) expects float, string given\\.$#" - count: 1 - path: app/code/core/Mage/Shipping/Model/Carrier/Abstract.php - - message: "#^Property Mage_Shipping_Model_Carrier_Abstract\\:\\:\\$_numBoxes \\(int\\) does not accept float\\.$#" count: 1 @@ -6440,11 +6135,6 @@ parameters: count: 2 path: app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl.php - - - message: "#^Method Mage_Usa_Model_Shipping_Carrier_Dhl\\:\\:_mapRequestToShipment\\(\\) should return null but return statement is missing\\.$#" - count: 1 - path: app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl.php - - message: "#^Parameter \\#3 \\$value of function curl_setopt expects bool, int given\\.$#" count: 2 @@ -6520,91 +6210,11 @@ parameters: count: 1 path: app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International.php - - - message: "#^Method Mage_Usa_Model_Shipping_Carrier_Dhl_International\\:\\:_mapRequestToShipment\\(\\) should return null but return statement is missing\\.$#" - count: 1 - path: app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International.php - - - - message: "#^Method Mage_Usa_Model_Shipping_Carrier_Dhl_International\\:\\:_parseResponse\\(\\) should return Mage_Shipping_Model_Rate_Result but returns Varien_Object\\.$#" - count: 1 - path: app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International.php - - - - message: "#^Method Mage_Usa_Model_Shipping_Carrier_Dhl_International\\:\\:_parseResponse\\(\\) should return Mage_Shipping_Model_Rate_Result but returns bool\\|Mage_Shipping_Model_Rate_Result_Error\\.$#" - count: 1 - path: app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International.php - - message: "#^Parameter \\#1 \\$array_arg of function sort contains unresolvable type\\.$#" count: 1 path: app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International.php - - - message: "#^Parameter \\#1 \\$cost of method Mage_Shipping_Model_Carrier_Abstract\\:\\:getMethodPrice\\(\\) expects string, float given\\.$#" - count: 1 - path: app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International.php - - - - message: "#^Parameter \\#2 \\$value of method SimpleXMLElement\\:\\:addChild\\(\\) expects string\\|null, \\(array\\|float\\|int\\) given\\.$#" - count: 1 - path: app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International.php - - - - message: "#^Parameter \\#2 \\$value of method SimpleXMLElement\\:\\:addChild\\(\\) expects string\\|null, \\(float\\|false\\) given\\.$#" - count: 8 - path: app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International.php - - - - message: "#^Parameter \\#2 \\$value of method SimpleXMLElement\\:\\:addChild\\(\\) expects string\\|null, float given\\.$#" - count: 4 - path: app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International.php - - - - message: "#^Parameter \\#2 \\$value of method SimpleXMLElement\\:\\:addChild\\(\\) expects string\\|null, int given\\.$#" - count: 1 - path: app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International.php - - - - message: "#^Parameter \\#2 \\$value of method SimpleXMLElement\\:\\:addChild\\(\\) expects string\\|null, int\\<0, max\\> given\\.$#" - count: 1 - path: app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International.php - - - - message: "#^Parameter \\#2 \\$value of method SimpleXMLElement\\:\\:addChild\\(\\) expects string\\|null, int\\<1, max\\> given\\.$#" - count: 4 - path: app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International.php - - - - message: "#^Parameter \\#3 \\$toDimensionMeasure of method Mage_Usa_Helper_Data\\:\\:convertMeasureDimension\\(\\) expects string, array\\|bool given\\.$#" - count: 1 - path: app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International.php - - - - message: "#^Parameter \\#3 \\$toWeightMeasure of method Mage_Usa_Helper_Data\\:\\:convertMeasureWeight\\(\\) expects string, array\\|bool given\\.$#" - count: 1 - path: app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International.php - - - - message: "#^Property Mage_Usa_Model_Shipping_Carrier_Dhl_International\\:\\:\\$_request \\(Mage_Shipping_Model_Rate_Request\\|null\\) does not accept Varien_Object\\.$#" - count: 1 - path: app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International.php - - - - message: "#^Property Mage_Usa_Model_Shipping_Carrier_Dhl_International\\:\\:\\$_result \\(Mage_Shipping_Model_Rate_Result\\|null\\) does not accept Mage_Shipping_Model_Tracking_Result\\.$#" - count: 1 - path: app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International.php - - - - message: "#^Variable \\$package might not be defined\\.$#" - count: 2 - path: app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International.php - - - - message: "#^Variable \\$packageType might not be defined\\.$#" - count: 2 - path: app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International.php - - message: "#^Call to an undefined method Zend_Pdf_Page\\:\\:drawLines\\(\\)\\.$#" count: 5 @@ -6655,11 +6265,6 @@ parameters: count: 1 path: app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex.php - - - message: "#^Parameter \\#1 \\$cost of method Mage_Shipping_Model_Carrier_Abstract\\:\\:getMethodPrice\\(\\) expects string, float\\|null given\\.$#" - count: 2 - path: app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex.php - - message: "#^Parameter \\#3 \\$value of function curl_setopt expects bool, int given\\.$#" count: 2 @@ -6675,11 +6280,6 @@ parameters: count: 2 path: app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex.php - - - message: "#^Parameter \\#1 \\$cost of method Mage_Shipping_Model_Carrier_Abstract\\:\\:getMethodPrice\\(\\) expects string, float given\\.$#" - count: 2 - path: app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups.php - - message: "#^Parameter \\#1 \\$error of method Mage_Shipping_Model_Rate_Result\\:\\:setError\\(\\) expects bool, string given\\.$#" count: 1 @@ -6775,11 +6375,6 @@ parameters: count: 1 path: app/code/core/Mage/Weee/Helper/Data.php - - - message: "#^Parameter \\#4 \\$website of method Mage_Weee_Model_Tax\\:\\:getProductWeeeAttributes\\(\\) expects int\\|null, Mage_Core_Model_Website\\|null given\\.$#" - count: 1 - path: app/code/core/Mage/Weee/Helper/Data.php - - message: "#^Parameter \\#1 \\$product of method Mage_Weee_Model_Resource_Attribute_Backend_Weee_Tax\\:\\:deleteProductData\\(\\) expects Mage_Catalog_Model_Product, Varien_Object given\\.$#" count: 1 @@ -6790,11 +6385,6 @@ parameters: count: 1 path: app/code/core/Mage/Weee/Model/Observer.php - - - message: "#^Parameter \\#2 \\$true of method Varien_Db_Adapter_Interface\\:\\:getCheckSql\\(\\) expects string, int given\\.$#" - count: 2 - path: app/code/core/Mage/Weee/Model/Observer.php - - message: "#^Call to an undefined method Mage_Eav_Model_Entity_Attribute_Abstract\\:\\:isScopeGlobal\\(\\)\\.$#" count: 2 @@ -6855,16 +6445,6 @@ parameters: count: 1 path: app/code/core/Mage/Weee/Model/Total/Quote/Weee.php - - - message: "#^Parameter \\#4 \\$website of method Mage_Weee_Helper_Data\\:\\:getProductWeeeAttributes\\(\\) expects Mage_Core_Model_Website\\|null, int\\|string\\|null given\\.$#" - count: 2 - path: app/code/core/Mage/Weee/Model/Total/Quote/Weee.php - - - - message: "#^Parameter \\#5 \\$rate of method Mage_Tax_Model_Sales_Total_Quote_Tax\\:\\:_saveAppliedTaxes\\(\\) expects float, null given\\.$#" - count: 2 - path: app/code/core/Mage/Weee/Model/Total/Quote/Weee.php - - message: "#^Method Mage_Widget_Block_Adminhtml_Widget_Chooser\\:\\:getConfig\\(\\) should return Varien_Object but returns mixed\\.$#" count: 2 @@ -7075,11 +6655,6 @@ parameters: count: 5 path: app/design/adminhtml/default/default/template/bundle/product/edit/bundle/option/search.phtml - - - message: "#^Variable \\$this might not be defined\\.$#" - count: 37 - path: app/design/adminhtml/default/default/template/bundle/product/edit/bundle/option/selection.phtml - - message: "#^Variable \\$this might not be defined\\.$#" count: 1 @@ -7170,6 +6745,11 @@ parameters: count: 1 path: app/design/adminhtml/default/default/template/catalog/product/price.phtml + - + message: "#^Parameter \\#4 \\$website of method Mage_Weee_Helper_Data\\:\\:getProductWeeeAttributesForRenderer\\(\\) expects int\\|null, Mage_Core_Model_Website given\\.$#" + count: 1 + path: app/design/adminhtml/default/default/template/catalog/product/price.phtml + - message: "#^Variable \\$_weeeTaxAttributes might not be defined\\.$#" count: 9 diff --git a/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tab/Wizard.php b/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tab/Wizard.php index 20351aef2c9..4798f573ea7 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tab/Wizard.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tab/Wizard.php @@ -59,6 +59,7 @@ protected function _prepareLayout() public function getAttributes($entityType) { if (!isset($this->_attributes[$entityType])) { + $attributes = []; switch ($entityType) { case 'product': $attributes = Mage::getSingleton('catalog/convert_parser_product') diff --git a/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Run.php b/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Run.php index f5874ab3ec5..dce7807a720 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Run.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Run.php @@ -172,6 +172,7 @@ public function getExceptions() $liStyle = 'background-color:#FFD; '; break; case Varien_Convert_Exception::NOTICE: + default: $img = 'fam_bullet_success.gif'; $liStyle = 'background-color:#DDF; '; break; diff --git a/app/code/core/Mage/Adminhtml/Model/Sales/Order/Create.php b/app/code/core/Mage/Adminhtml/Model/Sales/Order/Create.php index ce5fe356e9d..51415839733 100644 --- a/app/code/core/Mage/Adminhtml/Model/Sales/Order/Create.php +++ b/app/code/core/Mage/Adminhtml/Model/Sales/Order/Create.php @@ -1116,6 +1116,10 @@ protected function _setQuoteAddress(Mage_Sales_Model_Quote_Address $address, arr return $this; } + /** + * @param array|Mage_Sales_Model_Quote_Address $address + * @return $this + */ public function setShippingAddress($address) { if (is_array($address)) { @@ -1164,6 +1168,10 @@ public function getBillingAddress() return $this->getQuote()->getBillingAddress(); } + /** + * @param array|Mage_Sales_Model_Quote_Address $address + * @return $this + */ public function setBillingAddress($address) { if (is_array($address)) { @@ -1173,6 +1181,8 @@ public function setBillingAddress($address) ->setAddressType(Mage_Sales_Model_Quote_Address::TYPE_BILLING); $this->_setQuoteAddress($billingAddress, $address); $billingAddress->implodeStreetAddress(); + } elseif ($address instanceof Mage_Sales_Model_Quote_Address) { + $billingAddress = $address; } if ($this->getShippingAddress()->getSameAsBilling()) { @@ -1488,7 +1498,6 @@ protected function _prepareQuoteItems() { foreach ($this->getQuote()->getAllItems() as $item) { $options = []; - // phpcs:ignore Ecg.Performance.Loop.DataLoad $productOptions = $item->getProduct()->getTypeInstance(true)->getOrderOptions($item->getProduct()); if ($productOptions) { $productOptions['info_buyRequest']['options'] = $this->_prepareOptionsForRequest($item); diff --git a/app/code/core/Mage/Adminhtml/Model/System/Store.php b/app/code/core/Mage/Adminhtml/Model/System/Store.php index 84c9f86cb7e..d58cf07b77d 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Store.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Store.php @@ -129,6 +129,7 @@ public function getStoreValuesForForm($empty = false, $all = false) if ($website->getId() != $group->getWebsiteId()) { continue; } + $values = []; $groupShow = false; foreach ($this->_storeCollection as $store) { if ($group->getId() != $store->getGroupId()) { diff --git a/app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php b/app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php index 49c9547e70b..6180ca677bc 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php @@ -344,9 +344,11 @@ public function massCancelAction() $countCancelOrder = 0; $countNonCancelOrder = 0; foreach ($orderIds as $orderId) { + // phpcs:ignore Ecg.Performance.Loop.ModelLSD $order = Mage::getModel('sales/order')->load($orderId); if ($order->canCancel()) { $order->cancel() + // phpcs:ignore Ecg.Performance.Loop.ModelLSD ->save(); $countCancelOrder++; } else { @@ -375,9 +377,11 @@ public function massHoldAction() $countHoldOrder = 0; foreach ($orderIds as $orderId) { + // phpcs:ignore Ecg.Performance.Loop.ModelLSD $order = Mage::getModel('sales/order')->load($orderId); if ($order->canHold()) { $order->hold() + // phpcs:ignore Ecg.Performance.Loop.ModelLSD ->save(); $countHoldOrder++; } @@ -409,9 +413,11 @@ public function massUnholdAction() $countNonUnholdOrder = 0; foreach ($orderIds as $orderId) { + // phpcs:ignore Ecg.Performance.Loop.ModelLSD $order = Mage::getModel('sales/order')->load($orderId); if ($order->canUnhold()) { $order->unhold() + // phpcs:ignore Ecg.Performance.Loop.ModelLSD ->save(); $countUnholdOrder++; } else { @@ -449,18 +455,19 @@ public function massPrintAction() /** * Print invoices for selected orders + * + * @return Mage_Adminhtml_Sales_OrderController|void */ public function pdfinvoicesAction() { $orderIds = $this->getRequest()->getPost('order_ids'); - $flag = false; if (!empty($orderIds)) { foreach ($orderIds as $orderId) { $invoices = Mage::getResourceModel('sales/order_invoice_collection') ->setOrderFilter($orderId) + // phpcs:ignore Ecg.Performance.Loop.ModelLSD ->load(); if ($invoices->getSize() > 0) { - $flag = true; if (!isset($pdf)) { $pdf = Mage::getModel('sales/order_pdf_invoice')->getPdf($invoices); } else { @@ -469,7 +476,7 @@ public function pdfinvoicesAction() } } } - if ($flag) { + if (isset($pdf) && $pdf instanceof Zend_Pdf) { return $this->_prepareDownloadResponse( 'invoice' . Mage::getSingleton('core/date')->date('Y-m-d_H-i-s') . '.pdf', $pdf->render(), @@ -485,18 +492,19 @@ public function pdfinvoicesAction() /** * Print shipments for selected orders + * + * @return Mage_Adminhtml_Sales_OrderController|void */ public function pdfshipmentsAction() { $orderIds = $this->getRequest()->getPost('order_ids'); - $flag = false; if (!empty($orderIds)) { foreach ($orderIds as $orderId) { $shipments = Mage::getResourceModel('sales/order_shipment_collection') ->setOrderFilter($orderId) + // phpcs:ignore Ecg.Performance.Loop.ModelLSD ->load(); if ($shipments->getSize()) { - $flag = true; if (!isset($pdf)) { $pdf = Mage::getModel('sales/order_pdf_shipment')->getPdf($shipments); } else { @@ -505,7 +513,7 @@ public function pdfshipmentsAction() } } } - if ($flag) { + if (isset($pdf) && $pdf instanceof Zend_Pdf) { return $this->_prepareDownloadResponse( 'packingslip' . Mage::getSingleton('core/date')->date('Y-m-d_H-i-s') . '.pdf', $pdf->render(), @@ -521,18 +529,19 @@ public function pdfshipmentsAction() /** * Print creditmemos for selected orders + * + * @return Mage_Adminhtml_Sales_OrderController|void */ public function pdfcreditmemosAction() { $orderIds = $this->getRequest()->getPost('order_ids'); - $flag = false; if (!empty($orderIds)) { foreach ($orderIds as $orderId) { $creditmemos = Mage::getResourceModel('sales/order_creditmemo_collection') ->setOrderFilter($orderId) + // phpcs:ignore Ecg.Performance.Loop.ModelLSD ->load(); if ($creditmemos->getSize()) { - $flag = true; if (!isset($pdf)) { $pdf = Mage::getModel('sales/order_pdf_creditmemo')->getPdf($creditmemos); } else { @@ -541,7 +550,7 @@ public function pdfcreditmemosAction() } } } - if ($flag) { + if (isset($pdf) && $pdf instanceof Zend_Pdf) { return $this->_prepareDownloadResponse( 'creditmemo' . Mage::getSingleton('core/date')->date('Y-m-d_H-i-s') . '.pdf', $pdf->render(), @@ -557,18 +566,19 @@ public function pdfcreditmemosAction() /** * Print all documents for selected orders + * + * @return Mage_Adminhtml_Sales_OrderController|void */ public function pdfdocsAction() { $orderIds = $this->getRequest()->getPost('order_ids'); - $flag = false; if (!empty($orderIds)) { foreach ($orderIds as $orderId) { $invoices = Mage::getResourceModel('sales/order_invoice_collection') ->setOrderFilter($orderId) + // phpcs:ignore Ecg.Performance.Loop.ModelLSD ->load(); if ($invoices->getSize()) { - $flag = true; if (!isset($pdf)) { $pdf = Mage::getModel('sales/order_pdf_invoice')->getPdf($invoices); } else { @@ -579,9 +589,9 @@ public function pdfdocsAction() $shipments = Mage::getResourceModel('sales/order_shipment_collection') ->setOrderFilter($orderId) + // phpcs:ignore Ecg.Performance.Loop.ModelLSD ->load(); if ($shipments->getSize()) { - $flag = true; if (!isset($pdf)) { $pdf = Mage::getModel('sales/order_pdf_shipment')->getPdf($shipments); } else { @@ -592,9 +602,9 @@ public function pdfdocsAction() $creditmemos = Mage::getResourceModel('sales/order_creditmemo_collection') ->setOrderFilter($orderId) + // phpcs:ignore Ecg.Performance.Loop.ModelLSD ->load(); if ($creditmemos->getSize()) { - $flag = true; if (!isset($pdf)) { $pdf = Mage::getModel('sales/order_pdf_creditmemo')->getPdf($creditmemos); } else { @@ -603,7 +613,7 @@ public function pdfdocsAction() } } } - if ($flag) { + if (isset($pdf) && $pdf instanceof Zend_Pdf) { return $this->_prepareDownloadResponse( 'docs' . Mage::getSingleton('core/date')->date('Y-m-d_H-i-s') . '.pdf', $pdf->render(), diff --git a/app/code/core/Mage/Adminhtml/controllers/System/StoreController.php b/app/code/core/Mage/Adminhtml/controllers/System/StoreController.php index 2876934207b..08a67c2a4a9 100644 --- a/app/code/core/Mage/Adminhtml/controllers/System/StoreController.php +++ b/app/code/core/Mage/Adminhtml/controllers/System/StoreController.php @@ -113,23 +113,30 @@ public function editStoreAction() if (!Mage::registry('store_action')) { Mage::register('store_action', 'edit'); } + + $itemId = null; + $model = null; + $title = ''; + $notExists = ''; + $codeBase = ''; + switch (Mage::registry('store_type')) { case 'website': - $itemId = $this->getRequest()->getParam('website_id', null); + $itemId = $this->getRequest()->getParam('website_id'); $model = Mage::getModel('core/website'); $title = Mage::helper('core')->__('Website'); $notExists = Mage::helper('core')->__('The website does not exist.'); $codeBase = Mage::helper('core')->__('Before modifying the website code please make sure that it is not used in index.php.'); break; case 'group': - $itemId = $this->getRequest()->getParam('group_id', null); + $itemId = $this->getRequest()->getParam('group_id'); $model = Mage::getModel('core/store_group'); $title = Mage::helper('core')->__('Store'); $notExists = Mage::helper('core')->__('The store does not exist'); $codeBase = false; break; case 'store': - $itemId = $this->getRequest()->getParam('store_id', null); + $itemId = $this->getRequest()->getParam('store_id'); $model = Mage::getModel('core/store'); $title = Mage::helper('core')->__('Store View'); $notExists = Mage::helper('core')->__("Store view doesn't exist"); diff --git a/app/code/core/Mage/Api2/Helper/Data.php b/app/code/core/Mage/Api2/Helper/Data.php index fdc2ab398b7..9d3adb58f46 100644 --- a/app/code/core/Mage/Api2/Helper/Data.php +++ b/app/code/core/Mage/Api2/Helper/Data.php @@ -42,8 +42,8 @@ class Mage_Api2_Helper_Data extends Mage_Core_Helper_Abstract /** * Compare order to be used in adapters list sort * - * @param int $a - * @param int $b + * @param array $a + * @param array $b * @return int */ protected static function _compareOrder($a, $b) diff --git a/app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Selection.php b/app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Selection.php index ece3b749413..9ecb62a415d 100644 --- a/app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Selection.php +++ b/app/code/core/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Selection.php @@ -136,7 +136,7 @@ public function getSelectionSearchUrl() /** * Check if used website scope price * - * @return string + * @return bool */ public function isUsedWebsitePrice() { diff --git a/app/code/core/Mage/Bundle/Model/Resource/Indexer/Price.php b/app/code/core/Mage/Bundle/Model/Resource/Indexer/Price.php index 92c1d7a6018..58f628fbb00 100644 --- a/app/code/core/Mage/Bundle/Model/Resource/Indexer/Price.php +++ b/app/code/core/Mage/Bundle/Model/Resource/Indexer/Price.php @@ -181,7 +181,7 @@ protected function _prepareBundlePriceByType($priceType, $entityIds = null) $select->columns(['tax_class_id' => new Zend_Db_Expr('0')]); } else { $select->columns( - ['tax_class_id' => $write->getCheckSql($taxClassId . ' IS NOT NULL', $taxClassId, 0)] + ['tax_class_id' => $write->getCheckSql($taxClassId . ' IS NOT NULL', $taxClassId, '0')] ); } diff --git a/app/code/core/Mage/Catalog/Model/Convert/Adapter/Product.php b/app/code/core/Mage/Catalog/Model/Convert/Adapter/Product.php index 931a500dc90..b4db5fea2bd 100644 --- a/app/code/core/Mage/Catalog/Model/Convert/Adapter/Product.php +++ b/app/code/core/Mage/Catalog/Model/Convert/Adapter/Product.php @@ -368,6 +368,7 @@ public function parse() $importIds = $batchImportModel->getIdCollection(); foreach ($importIds as $importId) { + // phpcs:ignore Ecg.Performance.Loop.ModelLSD $batchImportModel->load($importId); $importData = $batchImportModel->getBatchData(); @@ -511,6 +512,7 @@ public function save() // if product is new, create default values first if (!$model->getId()) { $new = true; + // phpcs:ignore Ecg.Performance.Loop.ModelLSD $model->save(); // if new product and then store is not default @@ -520,6 +522,7 @@ public function save() $default = Mage::getModel('catalog/product'); $default->setData($data); $default->setStoreId(0); + // phpcs:ignore Ecg.Performance.Loop.ModelLSD $default->save(); unset($default); } // end @@ -533,6 +536,7 @@ public function save() $storeId ); } + // phpcs:ignore Ecg.Performance.Loop.ModelLSD $model->save(); } @@ -564,6 +568,7 @@ public function save() } } } + // phpcs:ignore Ecg.Performance.Loop.ModelLSD $stockItem->save(); unset($data); unset($stockItem); diff --git a/app/code/core/Mage/Catalog/Model/Resource/Category.php b/app/code/core/Mage/Catalog/Model/Resource/Category.php index a211aeab077..c9a474443eb 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Category.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Category.php @@ -458,7 +458,6 @@ public function getChildrenAmount($category, $isActiveFlag = true) 'c.attribute_id = :attribute_id AND c.store_id = :store_id AND c.entity_id = m.entity_id', [] ) - // phpcs:ignore Ecg.Sql.SlowQuery.SlowRawSql ->where('m.path LIKE :c_path') ->where($checkSql . ' = :active_flag'); diff --git a/app/code/core/Mage/Catalog/Model/Resource/Category/Flat/Collection.php b/app/code/core/Mage/Catalog/Model/Resource/Category/Flat/Collection.php index ea2cc2b5944..3d384e763af 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Category/Flat/Collection.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Category/Flat/Collection.php @@ -315,7 +315,6 @@ public function addPathsFilter($paths) $select = $this->getSelect(); $cond = []; foreach ($paths as $path) { - // phpcs:ignore Ecg.Sql.SlowQuery.SlowRawSql $cond[] = $this->getResource()->getReadConnection()->quoteInto('main_table.path LIKE ?', "$path%"); } if ($cond) { diff --git a/app/code/core/Mage/Catalog/Model/Resource/Category/Indexer/Product.php b/app/code/core/Mage/Catalog/Model/Resource/Category/Indexer/Product.php index 9b34af6b110..db9af7af51c 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Category/Indexer/Product.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Category/Indexer/Product.php @@ -152,7 +152,7 @@ public function catalogProductMassAction(Mage_Index_Model_Event $event) */ $adapter = $this->_getWriteAdapter(); $select = $adapter->select() - ->distinct(true) + ->distinct() ->from(['cp' => $this->_categoryProductTable], ['category_id']) ->join( ['ce' => $this->_categoryTable], @@ -261,7 +261,7 @@ public function catalogCategorySave(Mage_Index_Model_Event $event) 'e_value' => 1 ]; $select = $this->_getReadAdapter()->select() - ->distinct(true) + ->distinct() ->from(['ce' => $this->_categoryTable], ['entity_id']) ->joinInner( ['dca' => $anchorInfo['table']], @@ -335,7 +335,7 @@ protected function _refreshNotAnchorRootCategories(?array $categoryIds = null) } $select = $adapter->select() - ->distinct(true) + ->distinct() ->from(['cc' => $this->getTable('catalog/category')], null) ->join( ['i' => $this->getMainTable()], @@ -529,7 +529,7 @@ protected function _refreshAnchorRelations($categoryIds = null, $productIds = nu * Insert anchor categories relations */ $adapter = $this->_getReadAdapter(); - $isParent = $adapter->getCheckSql('MIN(cp.category_id)=ce.entity_id', 1, 0); + $isParent = $adapter->getCheckSql('MIN(cp.category_id)=ce.entity_id', '1', '0'); $position = 'MIN(' . $adapter->getCheckSql( 'cp.category_id = ce.entity_id', @@ -539,7 +539,7 @@ protected function _refreshAnchorRelations($categoryIds = null, $productIds = nu . ')'; $select = $adapter->select() - ->distinct(true) + ->distinct() ->from(['ce' => $this->_categoryTable], ['entity_id']) ->joinInner( ['cc' => $this->_categoryTable], @@ -606,7 +606,7 @@ protected function _refreshAnchorRelations($categoryIds = null, $productIds = nu $adapter->getCheckSql('ss.value_id IS NOT NULL', 'ss.value', 'ds.value') . '=?', Mage_Catalog_Model_Product_Status::STATUS_ENABLED ) - ->group(['ce.entity_id', 'cp.product_id', 's.store_id']); + ->group(['ce.entity_id', 'cp.product_id', 's.store_id']); if ($categoryIds) { $select->where('ce.entity_id IN (?)', $categoryIds); } @@ -636,7 +636,7 @@ protected function _refreshRootRelations($productIds) $isParent = new Zend_Db_Expr('0'); $position = new Zend_Db_Expr('0'); $select = $this->_getReadAdapter()->select() - ->distinct(true) + ->distinct() ->from(['pw' => $this->_productWebsiteTable], []) ->joinInner(['g' => $this->_groupTable], 'g.website_id=pw.website_id', []) ->joinInner(['s' => $this->_storeTable], 's.group_id=g.group_id', []) @@ -860,6 +860,7 @@ public function reindexAll() * Prepare anchor categories products */ $anchorProductsTable = $this->_getAnchorCategoriesProductsTemporaryTable(); + // phpcs:ignore Ecg.Performance.Loop.ModelLSD $idxAdapter->delete($anchorProductsTable); $position = 'MIN(' . @@ -874,7 +875,7 @@ public function reindexAll() $select = $idxAdapter->select() ->useStraightJoin(true) - ->distinct(true) + ->distinct() ->from(['ca' => $anchorTable], ['category_id']) ->joinInner( ['ce' => $this->_categoryTable], @@ -908,7 +909,7 @@ public function reindexAll() ['ap' => $anchorProductsTable], ['category_id', 'product_id', 'position', // => new Zend_Db_Expr('MIN('. $idxAdapter->quoteIdentifier('ap.position').')'), - 'is_parent' => $idxAdapter->getCheckSql('cp.product_id > 0', 1, 0), + 'is_parent' => $idxAdapter->getCheckSql('cp.product_id > 0', '1', '0'), 'store_id' => new Zend_Db_Expr($storeId)] ) ->joinLeft( diff --git a/app/code/core/Mage/Catalog/Model/Resource/Category/Tree.php b/app/code/core/Mage/Catalog/Model/Resource/Category/Tree.php index 9332e02e585..d6c177d6b43 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Category/Tree.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Category/Tree.php @@ -467,7 +467,6 @@ public function loadByIds($ids, $addCollectionData = true, $updateAnchorProductC ->where('entity_id IN (?)', $ids); $where = [$levelField . '=0' => true]; - // phpcs:ignore Ecg.Performance.FetchAll.Found foreach ($this->_conn->fetchAll($select) as $item) { if (!preg_match("#^[0-9\/]+$#", $item['path'])) { $item['path'] = ''; @@ -495,7 +494,6 @@ public function loadByIds($ids, $addCollectionData = true, $updateAnchorProductC $select->where(implode(' OR ', $where)); // get array of records and add them as nodes to the tree - // phpcs:ignore Ecg.Performance.FetchAll.Found $arrNodes = $this->_conn->fetchAll($select); if (!$arrNodes) { return false; @@ -538,7 +536,6 @@ public function loadBreadcrumbsArray($path, $addCollectionData = true, $withRoot $select ->where('e.entity_id IN(?)', $pathIds) ->order($this->_conn->getLengthSql('e.path') . ' ' . Varien_Db_Select::SQL_ASC); - // phpcs:ignore Ecg.Performance.FetchAll.Found $result = $this->_conn->fetchAll($select); $this->_updateAnchorProductCount($result); } @@ -561,7 +558,7 @@ protected function _updateAnchorProductCount(&$data) /** * Obtain select for categories with attributes. - * By default everything from entity table is selected + * By default, everything from entity table is selected * + name, is_active and is_anchor * Also the correct product_count is selected, depending on is the category anchor or not. * @@ -627,7 +624,6 @@ protected function _createCollectionDataSelect($sorted = true, $optionalAttribut ['COUNT(DISTINCT scp.product_id)'] ) ->where('see.entity_id = e.entity_id') - // phpcs:ignore Ecg.Sql.SlowQuery.SlowRawSql ->orWhere('see.path LIKE ?', $subConcat); $select->columns(['product_count' => $subSelect]); diff --git a/app/code/core/Mage/Catalog/Model/Resource/Eav/Attribute.php b/app/code/core/Mage/Catalog/Model/Resource/Eav/Attribute.php index e20be43040b..9ebc303c88f 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Eav/Attribute.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Eav/Attribute.php @@ -222,7 +222,7 @@ public function getStoreId() if ($dataObject) { return $dataObject->getStoreId(); } - return $this->getData('store_id'); + return (int)$this->getData('store_id'); } /** diff --git a/app/code/core/Mage/Catalog/Model/Resource/Product.php b/app/code/core/Mage/Catalog/Model/Resource/Product.php index da7e036fbaf..fdbc33279a6 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Product.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Product.php @@ -92,7 +92,6 @@ public function getWebsiteIdsByProductIds($productIds) ->from($this->_productWebsiteTable, ['product_id', 'website_id']) ->where('product_id IN (?)', $productIds); $productsWebsites = []; - // phpcs:ignore Ecg.Performance.FetchAll.Found foreach ($this->_getWriteAdapter()->fetchAll($select) as $productInfo) { $productId = $productInfo['product_id']; if (!isset($productsWebsites[$productId])) { @@ -319,7 +318,6 @@ public function refreshIndex($product) ->from($this->getTable('catalog/category')) ->where('entity_id IN (?)', $categoryIds); - // phpcs:ignore Ecg.Performance.FetchAll.Found $categoriesInfo = $writeAdapter->fetchAll($categoriesSelect); $indexCategoryIds = []; @@ -517,7 +515,6 @@ public function getAvailableInCategories($object) { // is_parent=1 ensures that we'll get only category IDs those are direct parents of the product, instead of // fetching all parent IDs, including those are higher on the tree - // phpcs:ignore Ecg.Sql.SlowQuery.SlowSql $select = $this->_getReadAdapter()->select()->distinct() ->from($this->getTable('catalog/category_product_index'), ['category_id']) ->where('product_id = ? AND is_parent = 1', (int)$object->getEntityId()); @@ -621,7 +618,6 @@ public function getProductsSku(array $productIds) $select = $this->_getReadAdapter()->select() ->from($this->getTable('catalog/product'), ['entity_id', 'sku']) ->where('entity_id IN (?)', $productIds); - // phpcs:ignore Ecg.Performance.FetchAll.Found return $this->_getReadAdapter()->fetchAll($select); } @@ -654,7 +650,6 @@ public function getProductEntitiesInfo($columns = null) $select = $adapter->select() ->from($this->getTable('catalog/product'), $columns); - // phpcs:ignore Ecg.Performance.FetchAll.Found return $adapter->fetchAll($select); } @@ -690,7 +685,6 @@ public function getAssignedImages($product, $storeIds) ->where('store_id IN (?)', $storeIds) ->where('attribute_code IN (?)', ['small_image', 'thumbnail', 'image']); - // phpcs:ignore Ecg.Performance.FetchAll.Found return $read->fetchAll($select); } diff --git a/app/code/core/Mage/Catalog/Model/Resource/Product/Attribute/Backend/Media.php b/app/code/core/Mage/Catalog/Model/Resource/Product/Attribute/Backend/Media.php index e5b72d0a491..612dc5de927 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Product/Attribute/Backend/Media.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Product/Attribute/Backend/Media.php @@ -26,6 +26,7 @@ class Mage_Catalog_Model_Resource_Product_Attribute_Backend_Media extends Mage_C protected $_eventPrefix = 'catalog_product_attribute_backend_media'; + // phpcs:ignore Ecg.PHP.PrivateClassMember.PrivateClassMemberError private $_attributeId = null; protected function _construct() @@ -94,7 +95,7 @@ protected function _removeDuplicates(&$result) * Insert gallery value to db and retrieve last id * * @param array $data - * @return int + * @return string */ public function insertGallery($data) { diff --git a/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Price.php b/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Price.php index ea634f9fa15..9dbc47e45ad 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Price.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Price.php @@ -557,6 +557,7 @@ protected function _prepareWebsiteDateTable() if ($website->getBaseCurrencyCode() != $baseCurrency) { $rate = Mage::getModel('directory/currency') + // phpcs:ignore Ecg.Performance.Loop.ModelLSD ->load($baseCurrency) ->getRate($website->getBaseCurrencyCode()); if (!$rate) { diff --git a/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Price/Default.php b/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Price/Default.php index c06d8c7dd0a..37dfd0c711c 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Price/Default.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Price/Default.php @@ -408,13 +408,13 @@ protected function _applyCustomOption() $tierPriceRound = new Zend_Db_Expr("ROUND(i.base_tier * ({$optPriceValue} / 100), 4)"); $tierPriceExpr = $write->getCheckSql("{$optPriceType} = 'fixed'", $optPriceValue, $tierPriceRound); $tierPriceMin = new Zend_Db_Expr("MIN($tierPriceExpr)"); - $tierPriceValue = $write->getCheckSql('MIN(o.is_require) > 0', $tierPriceMin, 0); + $tierPriceValue = $write->getCheckSql('MIN(o.is_require) > 0', $tierPriceMin, '0'); $tierPrice = $write->getCheckSql('MIN(i.base_tier) IS NOT NULL', $tierPriceValue, 'NULL'); $groupPriceRound = new Zend_Db_Expr("ROUND(i.base_group_price * ({$optPriceValue} / 100), 4)"); $groupPriceExpr = $write->getCheckSql("{$optPriceType} = 'fixed'", $optPriceValue, $groupPriceRound); $groupPriceMin = new Zend_Db_Expr("MIN($groupPriceExpr)"); - $groupPriceValue = $write->getCheckSql('MIN(o.is_require) > 0', $groupPriceMin, 0); + $groupPriceValue = $write->getCheckSql('MIN(o.is_require) > 0', $groupPriceMin, '0'); $groupPrice = $write->getCheckSql('MIN(i.base_group_price) IS NOT NULL', $groupPriceValue, 'NULL'); $maxPriceRound = new Zend_Db_Expr("ROUND(i.price * ({$optPriceValue} / 100), 4)"); @@ -471,18 +471,18 @@ protected function _applyCustomOption() $minPriceRound = new Zend_Db_Expr("ROUND(i.price * ({$optPriceValue} / 100), 4)"); $priceExpr = $write->getCheckSql("{$optPriceType} = 'fixed'", $optPriceValue, $minPriceRound); - $minPrice = $write->getCheckSql("{$priceExpr} > 0 AND o.is_require > 1", $priceExpr, 0); + $minPrice = $write->getCheckSql("{$priceExpr} > 0 AND o.is_require > 1", $priceExpr, '0'); $maxPrice = $priceExpr; $tierPriceRound = new Zend_Db_Expr("ROUND(i.base_tier * ({$optPriceValue} / 100), 4)"); $tierPriceExpr = $write->getCheckSql("{$optPriceType} = 'fixed'", $optPriceValue, $tierPriceRound); - $tierPriceValue = $write->getCheckSql("{$tierPriceExpr} > 0 AND o.is_require > 0", $tierPriceExpr, 0); + $tierPriceValue = $write->getCheckSql("{$tierPriceExpr} > 0 AND o.is_require > 0", $tierPriceExpr, '0'); $tierPrice = $write->getCheckSql('i.base_tier IS NOT NULL', $tierPriceValue, 'NULL'); $groupPriceRound = new Zend_Db_Expr("ROUND(i.base_group_price * ({$optPriceValue} / 100), 4)"); $groupPriceExpr = $write->getCheckSql("{$optPriceType} = 'fixed'", $optPriceValue, $groupPriceRound); - $groupPriceValue = $write->getCheckSql("{$groupPriceExpr} > 0 AND o.is_require > 0", $groupPriceExpr, 0); + $groupPriceValue = $write->getCheckSql("{$groupPriceExpr} > 0 AND o.is_require > 0", $groupPriceExpr, '0'); $groupPrice = $write->getCheckSql('i.base_group_price IS NOT NULL', $groupPriceValue, 'NULL'); $select->columns([ diff --git a/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Price/Grouped.php b/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Price/Grouped.php index 3ee176662df..64fa38868b5 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Price/Grouped.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Price/Grouped.php @@ -79,8 +79,8 @@ protected function _prepareGroupedProductPriceData($entityIds = null) ); $this->_addWebsiteJoinToSelect($select, true); $this->_addProductWebsiteJoinToSelect($select, 'cw.website_id', 'e.entity_id'); - $minCheckSql = $write->getCheckSql('le.required_options = 0', 'i.min_price', 0); - $maxCheckSql = $write->getCheckSql('le.required_options = 0', 'i.max_price', 0); + $minCheckSql = $write->getCheckSql('le.required_options = 0', 'i.min_price', '0'); + $maxCheckSql = $write->getCheckSql('le.required_options = 0', 'i.max_price', '0'); $select->columns('website_id', 'cw') ->join( ['le' => $this->getTable('catalog/product')], diff --git a/app/code/core/Mage/Catalog/Model/Resource/Url.php b/app/code/core/Mage/Catalog/Model/Resource/Url.php index 9608d34c7b2..8ef86c2c61e 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Url.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Url.php @@ -184,7 +184,6 @@ public function getLastUsedRewriteRequestIncrement($prefix, $suffix, $storeId) $select = $adapter->select() ->from($this->getMainTable(), new Zend_Db_Expr('MAX(' . $urlIncrementPartExpression . ')')) ->where('store_id = :store_id') - // phpcs:ignore Ecg.Sql.SlowQuery.SlowRawSql ->where('request_path LIKE :request_path') ->where($adapter->prepareSqlCondition('request_path', [ 'regexp' => '^' . preg_quote($prefix) . '[0-9]*' . preg_quote($suffix) . '$' @@ -265,7 +264,6 @@ public function prepareRewrites($storeId, $categoryIds = null, $productIds = nul $select->where('product_id IN(?)', $productIds); } - // phpcs:ignore Ecg.Performance.FetchAll.Found $rowSet = $adapter->fetchAll($select, $bind); foreach ($rowSet as $row) { @@ -469,7 +467,6 @@ protected function _getCategoryAttribute($attributeCode, $categoryIds, $storeId) $bind['store_id'] = $storeId; } - // phpcs:ignore Ecg.Performance.FetchAll.Found $rowSet = $adapter->fetchAll($select, $bind); $attributes = []; @@ -611,7 +608,6 @@ public function _getProductAttribute($attributeCode, $productIds, $storeId) $bind['store_id'] = $storeId; } - // phpcs:ignore Ecg.Performance.FetchAll.Found $rowSet = $adapter->fetchAll($select, $bind); $attributes = []; @@ -710,7 +706,6 @@ protected function _getCategories($categoryIds, $storeId = null, $path = null) } $select - // phpcs:ignore Ecg.Sql.SlowQuery.SlowRawSql ->where('main_table.path LIKE ?', $path . '%') ->order('main_table.path'); } @@ -735,7 +730,6 @@ protected function _getCategories($categoryIds, $storeId = null, $path = null) 'store_id' => (int)$storeId ]; - // phpcs:ignore Ecg.Performance.FetchAll.Found $rowSet = $adapter->fetchAll($select, $bind); foreach ($rowSet as $row) { if ($storeId !== null) { @@ -862,11 +856,9 @@ public function getRootChildrenIds($categoryId, $categoryPath, $includeStart = t $adapter = $this->_getReadAdapter(); $select = $adapter->select() ->from([$this->getTable('catalog/category')], ['entity_id']) - // phpcs:ignore Ecg.Sql.SlowQuery.SlowRawSql ->where('path LIKE ?', $categoryPath . '/%'); $categoryIds = []; - // phpcs:ignore Ecg.Performance.FetchAll.Found $rowSet = $adapter->fetchAll($select); foreach ($rowSet as $row) { $categoryIds[$row['entity_id']] = $row['entity_id']; @@ -961,7 +953,6 @@ protected function _getProducts($productIds, $storeId, $entityId, &$lastEntityId $select->where('e.entity_id IN(?)', $productIds); } - // phpcs:ignore Ecg.Performance.FetchAll.Found $rowSet = $adapter->fetchAll($select, $bind); foreach ($rowSet as $row) { $product = new Varien_Object($row); @@ -981,7 +972,6 @@ protected function _getProducts($productIds, $storeId, $entityId, &$lastEntityId ['product_id', 'category_id'] ) ->where('product_id IN(?)', array_keys($products)); - // phpcs:ignore Ecg.Performance.FetchAll.Found $categories = $adapter->fetchAll($select); foreach ($categories as $category) { $productId = $category['product_id']; @@ -1287,7 +1277,6 @@ public function getRewriteByProductStore(array $products) $select->orWhere($cond); } - // phpcs:ignore Ecg.Performance.FetchAll.Found $rowSet = $adapter->fetchAll($select, $bind); foreach ($rowSet as $row) { $result[$row['product_id']] = [ diff --git a/app/code/core/Mage/CatalogIndex/Model/Resource/Indexer/Abstract.php b/app/code/core/Mage/CatalogIndex/Model/Resource/Indexer/Abstract.php index 2e914ca6200..a1f7b6d441f 100644 --- a/app/code/core/Mage/CatalogIndex/Model/Resource/Indexer/Abstract.php +++ b/app/code/core/Mage/CatalogIndex/Model/Resource/Indexer/Abstract.php @@ -118,7 +118,6 @@ public function loadAttributeCodesByCondition($conditions) $select = $this->_getReadAdapter()->select(); $select->from(['main_table' => $table], 'attribute_id') ->join(['additional_table' => $this->getTable('catalog/eav_attribute')], 'additional_table.attribute_id=main_table.attribute_id'); - // phpcs:ignore Ecg.Sql.SlowQuery.SlowSql $select->distinct(true); if (is_array($conditions)) { diff --git a/app/code/core/Mage/CatalogInventory/Model/Resource/Indexer/Stock/Configurable.php b/app/code/core/Mage/CatalogInventory/Model/Resource/Indexer/Stock/Configurable.php index 4326ec5a784..d1eff82761b 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Resource/Indexer/Stock/Configurable.php +++ b/app/code/core/Mage/CatalogInventory/Model/Resource/Indexer/Stock/Configurable.php @@ -85,18 +85,18 @@ protected function _getStockStatusSelect($entityIds = null, $usePrimaryTable = f if ($this->_isManageStock()) { $statusExpr = $adapter->getCheckSql( 'cisi.use_config_manage_stock = 0 AND cisi.manage_stock = 0', - 1, + '1', 'cisi.is_in_stock' ); } else { $statusExpr = $adapter->getCheckSql( 'cisi.use_config_manage_stock = 0 AND cisi.manage_stock = 1', 'cisi.is_in_stock', - 1 + '1' ); } - $optExpr = $adapter->getCheckSql("{$psCond} AND le.required_options = 0", 'i.stock_status', 0); + $optExpr = $adapter->getCheckSql("{$psCond} AND le.required_options = 0", 'i.stock_status', '0'); $stockStatusExpr = $adapter->getLeastSql(["MAX({$optExpr})", "MIN({$statusExpr})"]); $select->columns([ diff --git a/app/code/core/Mage/CatalogInventory/Model/Resource/Indexer/Stock/Default.php b/app/code/core/Mage/CatalogInventory/Model/Resource/Indexer/Stock/Default.php index 91a0a7ceb4d..4765b65600b 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Resource/Indexer/Stock/Default.php +++ b/app/code/core/Mage/CatalogInventory/Model/Resource/Indexer/Stock/Default.php @@ -140,7 +140,7 @@ protected function _isManageStock() protected function _getStockStatusSelect($entityIds = null, $usePrimaryTable = false) { $adapter = $this->_getWriteAdapter(); - $qtyExpr = $adapter->getCheckSql('cisi.qty > 0', 'cisi.qty', 0); + $qtyExpr = $adapter->getCheckSql('cisi.qty > 0', 'cisi.qty', '0'); $select = $adapter->select() ->from(['e' => $this->getTable('catalog/product')], ['entity_id']); $this->_addWebsiteJoinToSelect($select, true); @@ -167,18 +167,18 @@ protected function _getStockStatusSelect($entityIds = null, $usePrimaryTable = f if ($this->_isManageStock()) { $statusExpr = $adapter->getCheckSql( 'cisi.use_config_manage_stock = 0 AND cisi.manage_stock = 0', - 1, + '1', 'cisi.is_in_stock' ); } else { $statusExpr = $adapter->getCheckSql( 'cisi.use_config_manage_stock = 0 AND cisi.manage_stock = 1', 'cisi.is_in_stock', - 1 + '1' ); } - $optExpr = $adapter->getCheckSql($psCondition, 1, 0); + $optExpr = $adapter->getCheckSql($psCondition, '1', '0'); $stockStatusExpr = $adapter->getLeastSql([$optExpr, $statusExpr]); $select->columns(['status' => $stockStatusExpr]); diff --git a/app/code/core/Mage/CatalogInventory/Model/Resource/Indexer/Stock/Grouped.php b/app/code/core/Mage/CatalogInventory/Model/Resource/Indexer/Stock/Grouped.php index 020194d5c8d..9fd32c9557d 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Resource/Indexer/Stock/Grouped.php +++ b/app/code/core/Mage/CatalogInventory/Model/Resource/Indexer/Stock/Grouped.php @@ -86,18 +86,18 @@ protected function _getStockStatusSelect($entityIds = null, $usePrimaryTable = f if ($this->_isManageStock()) { $statusExpr = $adapter->getCheckSql( 'cisi.use_config_manage_stock = 0 AND cisi.manage_stock = 0', - 1, + '1', 'cisi.is_in_stock' ); } else { $statusExpr = $adapter->getCheckSql( 'cisi.use_config_manage_stock = 0 AND cisi.manage_stock = 1', 'cisi.is_in_stock', - 1 + '1' ); } - $optExpr = $adapter->getCheckSql("{$psCond} AND le.required_options = 0", 'i.stock_status', 0); + $optExpr = $adapter->getCheckSql("{$psCond} AND le.required_options = 0", 'i.stock_status', '0'); $stockStatusExpr = $adapter->getLeastSql(["MAX({$optExpr})", "MIN({$statusExpr})"]); $select->columns([ diff --git a/app/code/core/Mage/CatalogInventory/Model/Resource/Stock.php b/app/code/core/Mage/CatalogInventory/Model/Resource/Stock.php index 7f743cde86a..510c5e67a82 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Resource/Stock.php +++ b/app/code/core/Mage/CatalogInventory/Model/Resource/Stock.php @@ -59,7 +59,7 @@ class Mage_CatalogInventory_Model_Resource_Stock extends Mage_Core_Model_Resourc /** * Notify for quantity below _configNotifyStockQty value * - * @var int + * @var string */ protected $_configNotifyStockQty; @@ -220,7 +220,7 @@ protected function _initConfig() ]; foreach ($configMap as $field => $const) { - $this->$field = Mage::getStoreConfigAsInt($const); + $this->$field = Mage::getStoreConfig($const); } $this->_isConfig = true; @@ -350,7 +350,7 @@ public function addLowStockFilter(Mage_Catalog_Model_Resource_Product_Collection $conditions = [ [ $adapter->prepareSqlCondition('invtr.use_config_manage_stock', 1), - $adapter->prepareSqlCondition($this->_isConfigManageStock, 1), + $adapter->prepareSqlCondition((string)$this->_isConfigManageStock, 1), $adapter->prepareSqlCondition('invtr.qty', ['lt' => $qtyIf]) ], [ diff --git a/app/code/core/Mage/CatalogInventory/Model/Resource/Stock/Item.php b/app/code/core/Mage/CatalogInventory/Model/Resource/Stock/Item.php index ee8878750f3..3cd6b24de0e 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Resource/Stock/Item.php +++ b/app/code/core/Mage/CatalogInventory/Model/Resource/Stock/Item.php @@ -71,7 +71,7 @@ protected function _getLoadSelect($field, $value, $object) public function addCatalogInventoryToProductCollection($productCollection) { $adapter = $this->_getReadAdapter(); - $isManageStock = Mage::getStoreConfigAsInt(Mage_CatalogInventory_Model_Stock_Item::XML_PATH_MANAGE_STOCK); + $isManageStock = (string)Mage::getStoreConfigAsInt(Mage_CatalogInventory_Model_Stock_Item::XML_PATH_MANAGE_STOCK); $stockExpr = $adapter->getCheckSql('cisi.use_config_manage_stock = 1', $isManageStock, 'cisi.manage_stock'); $stockExpr = $adapter->getCheckSql("({$stockExpr} = 1)", 'cisi.is_in_stock', '1'); 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 de244f6c8a6..bde8b77fc63 100644 --- a/app/code/core/Mage/CatalogRule/Model/Action/Index/Refresh.php +++ b/app/code/core/Mage/CatalogRule/Model/Action/Index/Refresh.php @@ -595,7 +595,7 @@ protected function _prepareGroupWebsite($timestamp) { $this->_connection->delete($this->_resource->getTable('catalogrule/rule_group_website'), []); $select = $this->_connection->select() - ->distinct(true) + ->distinct() ->from( $this->_resource->getTable('catalogrule/rule_product'), ['rule_id', 'customer_group_id', 'website_id'] diff --git a/app/code/core/Mage/CatalogRule/Model/Resource/Rule.php b/app/code/core/Mage/CatalogRule/Model/Resource/Rule.php index 84d4cf03db8..7f44e79dd89 100644 --- a/app/code/core/Mage/CatalogRule/Model/Resource/Rule.php +++ b/app/code/core/Mage/CatalogRule/Model/Resource/Rule.php @@ -158,6 +158,7 @@ public function validateProduct(Mage_CatalogRule_Model_Rule $rule, Varien_Object $helper = $this->_factory->getHelper('catalog/product_flat'); if ($helper->isEnabled() && $helper->isBuiltAllStores()) { foreach ($this->_app->getStores(false) as $store) { + // phpcs:ignore Ecg.Performance.Loop.ArraySize if (count($websiteIds) == 0 || in_array($store->getWebsiteId(), $websiteIds)) { $selectByStore = $rule->getProductFlatSelect($store->getId()); $selectByStore->where('p.entity_id = ?', $product->getId()); @@ -213,7 +214,7 @@ public function insertRuleData(Mage_CatalogRule_Model_Rule $rule, array $website ) ->reset(Varien_Db_Select::COLUMNS) ->columns([ - new Zend_Db_Expr($store->getWebsiteId()), + new Zend_Db_Expr((string)$store->getWebsiteId()), 'cg.customer_group_id', 'p.entity_id', new Zend_Db_Expr($rule->getId()), @@ -227,6 +228,7 @@ public function insertRuleData(Mage_CatalogRule_Model_Rule $rule, array $website new Zend_Db_Expr($subActionAmount), ]); + // phpcs:ignore Ecg.Performance.Loop.ArraySize if (count($productIds) > 0) { $selectByStore->where('p.entity_id IN (?)', array_keys($productIds)); } @@ -286,6 +288,7 @@ public function insertRuleData(Mage_CatalogRule_Model_Rule $rule, array $website 'sub_discount_amount' => $subActionAmount, ]; + // phpcs:ignore Ecg.Performance.Loop.ArraySize if (count($rows) == 1000) { $write->insertMultiple($this->getTable('catalogrule/rule_product'), $rows); $rows = []; diff --git a/app/code/core/Mage/Checkout/Model/Cart/Product/Api/V2.php b/app/code/core/Mage/Checkout/Model/Cart/Product/Api/V2.php index 097a78d10d7..d2a77383414 100644 --- a/app/code/core/Mage/Checkout/Model/Cart/Product/Api/V2.php +++ b/app/code/core/Mage/Checkout/Model/Cart/Product/Api/V2.php @@ -24,7 +24,7 @@ class Mage_Checkout_Model_Cart_Product_Api_V2 extends Mage_Checkout_Model_Cart_P /** * Return an Array of Object attributes. * - * @param mixed $data + * @param object|array $data * @return array */ protected function _prepareProductsData($data) diff --git a/app/code/core/Mage/Core/Helper/String.php b/app/code/core/Mage/Core/Helper/String.php index 46196a2b374..689fd0fa3d2 100644 --- a/app/code/core/Mage/Core/Helper/String.php +++ b/app/code/core/Mage/Core/Helper/String.php @@ -515,7 +515,7 @@ public function uniOrd($c) /** * UnSerialize string * @param string|null $str - * @return mixed|null + * @return null|void * @throws Exception */ public function unserialize($str) @@ -525,7 +525,9 @@ public function unserialize($str) } $reader = new Unserialize_Reader_ArrValue('data'); $prevChar = null; - for ($i = 0; $i < strlen($str); $i++) { + + $strLen = strlen($str); + for ($i = 0; $i < $strLen; $i++) { $char = $str[$i]; $result = $reader->read($char, $prevChar); if (!is_null($result)) { diff --git a/app/code/core/Mage/Core/Helper/Url.php b/app/code/core/Mage/Core/Helper/Url.php index 117333ec969..bc87ed3ce7f 100644 --- a/app/code/core/Mage/Core/Helper/Url.php +++ b/app/code/core/Mage/Core/Helper/Url.php @@ -137,7 +137,6 @@ public function removeRequestParam($url, $paramKey, $caseSensitive = false) } list($baseUrl, $query) = explode('?', $url, 2); - // phpcs:ignore Ecg.Security.ForbiddenFunction.Found parse_str($query, $params); if (!$caseSensitive) { @@ -176,7 +175,6 @@ protected function _getSingletonModel($name, $arguments = []) */ public function encodePunycode($url) { - // phpcs:ignore Ecg.Security.ForbiddenFunction.Found $parsedUrl = parse_url($url); if (!$this->_isPunycode($parsedUrl['host'])) { $host = idn_to_ascii($parsedUrl['host']); @@ -195,7 +193,6 @@ public function encodePunycode($url) */ public function decodePunycode($url) { - // phpcs:ignore Ecg.Security.ForbiddenFunction.Found $parsedUrl = parse_url($url); if ($this->_isPunycode($parsedUrl['host'])) { $host = idn_to_utf8($parsedUrl['host']); diff --git a/app/code/core/Mage/Core/Model/Store.php b/app/code/core/Mage/Core/Model/Store.php index 5d66743c18e..f9deb4b67e6 100644 --- a/app/code/core/Mage/Core/Model/Store.php +++ b/app/code/core/Mage/Core/Model/Store.php @@ -1045,21 +1045,21 @@ public function getGroup() /** * Retrieve website identifier * - * @return int|string|null + * @return int */ public function getWebsiteId() { - return $this->_getData('website_id'); + return (int)$this->_getData('website_id'); } /** * Retrieve group identifier * - * @return int|string|null + * @return int */ public function getGroupId() { - return $this->_getData('group_id'); + return (int)$this->_getData('group_id'); } /** diff --git a/app/code/core/Mage/Core/Model/Store/Group.php b/app/code/core/Mage/Core/Model/Store/Group.php index c4dac455f24..bbc0a1a6aad 100644 --- a/app/code/core/Mage/Core/Model/Store/Group.php +++ b/app/code/core/Mage/Core/Model/Store/Group.php @@ -97,6 +97,7 @@ class Mage_Core_Model_Store_Group extends Mage_Core_Model_Abstract /** * @var bool */ + // phpcs:ignore Ecg.PHP.PrivateClassMember.PrivateClassMemberError private $_isReadOnly = false; /** diff --git a/app/code/core/Mage/Core/Model/Website.php b/app/code/core/Mage/Core/Model/Website.php index 9cb4c2dea47..a55ca2a8bf7 100644 --- a/app/code/core/Mage/Core/Model/Website.php +++ b/app/code/core/Mage/Core/Model/Website.php @@ -136,6 +136,7 @@ class Mage_Core_Model_Website extends Mage_Core_Model_Abstract /** * @var bool */ + // phpcs:ignore Ecg.PHP.PrivateClassMember.PrivateClassMemberError private $_isReadOnly = false; /** diff --git a/app/code/core/Mage/Eav/Model/Entity/Abstract.php b/app/code/core/Mage/Eav/Model/Entity/Abstract.php index 03b4d1c530c..284a081b37f 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Abstract.php +++ b/app/code/core/Mage/Eav/Model/Entity/Abstract.php @@ -975,7 +975,6 @@ protected function _loadModelAttributes($object) $select = $selects; } - // phpcs:ignore Ecg.Performance.FetchAll.Found $values = $this->_getReadAdapter()->fetchAll($select); foreach ($values as $valueRow) { $this->_setAttributeValue($object, $valueRow); @@ -995,7 +994,6 @@ protected function _loadModelAttributes($object) */ protected function _prepareLoadSelect(array $selects) { - // phpcs:ignore Ecg.Sql.SlowQuery.SlowSql return $this->_getReadAdapter()->select()->union($selects, Zend_Db_Select::SQL_UNION_ALL); } diff --git a/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Abstract.php b/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Abstract.php index e599ab7f87a..004767ac201 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Abstract.php +++ b/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Abstract.php @@ -221,8 +221,8 @@ public function getDefaultValue() * Validate object * * @param Varien_Object $object - * @throws Mage_Eav_Exception * @return $this|bool + * @throws Mage_Eav_Exception|Mage_Core_Exception */ public function validate($object) { @@ -309,6 +309,7 @@ public function beforeDelete($object) { return $this; } + /** * After delete method * diff --git a/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php b/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php index ec43b35dea4..08102b11fc2 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php +++ b/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php @@ -484,7 +484,7 @@ public function addStaticField($field) * * @param string $alias * @param string $expression - * @param string $attribute + * @param string|array $attribute * @return $this */ public function addExpressionAttributeToSelect($alias, $expression, $attribute) @@ -544,13 +544,11 @@ public function groupByAttribute($attribute) } } else { if (isset($this->_joinFields[$attribute])) { - // phpcs:ignore Ecg.Sql.SlowQuery.SlowSql $this->getSelect()->group($this->_getAttributeFieldName($attribute)); return $this; } if (isset($this->_staticFields[$attribute])) { - // phpcs:ignore Ecg.Sql.SlowQuery.SlowSql $this->getSelect()->group(sprintf('e.%s', $attribute)); return $this; } @@ -564,11 +562,9 @@ public function groupByAttribute($attribute) } if ($attrInstance->getBackend()->isStatic()) { - // phpcs:ignore Ecg.Sql.SlowQuery.SlowSql $this->getSelect()->group($entityField); } else { $this->_addAttributeJoin($attribute); - // phpcs:ignore Ecg.Sql.SlowQuery.SlowSql $this->getSelect()->group($this->_getAttributeTableAlias($attribute) . '.value'); } } @@ -748,7 +744,7 @@ public function joinField($alias, $table, $field, $bind, $cond = null, $joinType * @param array|string|Zend_Db_Expr $table * @param string $bind * @param string|array $fields - * @param null|array $cond + * @param string|array|null $cond * @param string $joinType * @return $this */ @@ -1126,13 +1122,11 @@ public function _loadAttributes($printQuery = false, $logQuery = false) if (!empty($selects)) { try { if (is_array($selects)) { - // phpcs:ignore Ecg.Sql.SlowQuery.SlowRawSql $select = implode(' UNION ALL ', $selects); } else { $select = $selects; } - // phpcs:ignore Ecg.Performance.FetchAll.Found $values = $this->getConnection()->fetchAll($select); } catch (Exception $e) { Mage::printException($e, $select); diff --git a/app/code/core/Mage/ImportExport/Model/Import/Entity/Abstract.php b/app/code/core/Mage/ImportExport/Model/Import/Entity/Abstract.php index e439b9fbc36..ed61cd97f9c 100644 --- a/app/code/core/Mage/ImportExport/Model/Import/Entity/Abstract.php +++ b/app/code/core/Mage/ImportExport/Model/Import/Entity/Abstract.php @@ -216,7 +216,7 @@ abstract protected function _importData(); /** * Returns boolean TRUE if row scope is default (fundamental) scope. * - * @return bool + * @return true */ protected function _isRowScopeDefault(array $rowData) { @@ -287,6 +287,7 @@ protected function _saveValidatedBunches() $rowData = $this->_prepareRowForDb($rowData); $rowSize = strlen(Mage::helper('core')->jsonEncode($rowData)); + // phpcs:ignore Ecg.Performance.Loop.ArraySize $isBunchSizeExceeded = ($bunchSize > 0 && count($bunchRows) >= $bunchSize); if (($productDataSize + $rowSize) >= $maxDataSize || $isBunchSizeExceeded) { diff --git a/app/code/core/Mage/Index/Model/Resource/Process/Collection.php b/app/code/core/Mage/Index/Model/Resource/Process/Collection.php index 4bf5fe8625f..494b867bd72 100644 --- a/app/code/core/Mage/Index/Model/Resource/Process/Collection.php +++ b/app/code/core/Mage/Index/Model/Resource/Process/Collection.php @@ -58,7 +58,7 @@ public function addEventsStats() 'e.process_id=main_table.process_id', ['events' => $this->getConnection()->getCheckSql( $this->getConnection()->prepareSqlCondition('e.events', ['null' => null]), - 0, + '0', 'e.events' )] ); diff --git a/app/code/core/Mage/Page/Block/Switch.php b/app/code/core/Mage/Page/Block/Switch.php index e796f2269ed..b3f1743936d 100644 --- a/app/code/core/Mage/Page/Block/Switch.php +++ b/app/code/core/Mage/Page/Block/Switch.php @@ -24,7 +24,7 @@ class Mage_Page_Block_Switch extends Mage_Core_Block_Template protected $_storeInUrl; /** - * @return int|string|null + * @return int * @throws Mage_Core_Model_Store_Exception */ public function getCurrentWebsiteId() @@ -33,7 +33,7 @@ public function getCurrentWebsiteId() } /** - * @return int|string|null + * @return int * @throws Mage_Core_Model_Store_Exception */ public function getCurrentGroupId() diff --git a/app/code/core/Mage/Paypal/Model/Payflowlink.php b/app/code/core/Mage/Paypal/Model/Payflowlink.php index 3e842ffa8b4..78432d3390f 100644 --- a/app/code/core/Mage/Paypal/Model/Payflowlink.php +++ b/app/code/core/Mage/Paypal/Model/Payflowlink.php @@ -365,6 +365,7 @@ protected function _getOrderFromResponse() /** * Build request for getting token * + * @param Mage_Sales_Model_Order_Payment|Mage_Payment_Model_Info $payment * @return Varien_Object */ protected function _buildTokenRequest(Mage_Sales_Model_Order_Payment $payment) @@ -438,7 +439,6 @@ protected function _getStoreId() * * @return Mage_Paypal_Model_Payflow_Request */ - // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass protected function _buildBasicRequest(Varien_Object $payment) { $request = Mage::getModel('paypal/payflow_request'); @@ -509,7 +509,7 @@ protected function _formatStr($format, $string) * Set token data in payment object * * @param Varien_Object $response - * @param Mage_Sales_Model_Order_Payment $payment + * @param Mage_Payment_Model_Info|Mage_Sales_Model_Order_Payment $payment * @throws Mage_Core_Exception */ protected function _processTokenErrors($response, $payment) @@ -539,7 +539,7 @@ protected function _getSecureSilentPostHash($payment) /** * Generate end return new secure hash value * - * @param Mage_Sales_Model_Order_Payment $payment + * @param Mage_Payment_Model_Info $payment * @return string */ protected function _generateSecureSilentPostHash($payment) @@ -567,7 +567,6 @@ protected function _addTransaction($payment, $txnId) * @param mixed $amount * @return $this */ - // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassAfterLastUsed protected function _initialize(Varien_Object $payment, $amount) { return $this; @@ -592,7 +591,6 @@ public function prepareOrderReview($token = null) * @param string $txnId * @return $this */ - // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassAfterLastUsed protected function _authorize(Varien_Object $payment, $amount, $transaction, $txnId) { return $this; @@ -615,7 +613,6 @@ protected function _process(Varien_Object $document) * @param mixed $amount * @return $this */ - // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassAfterLastUsed protected function _checkTransaction($transaction, $amount) { return $this; diff --git a/app/code/core/Mage/Reports/Model/Resource/Helper/Mysql4.php b/app/code/core/Mage/Reports/Model/Resource/Helper/Mysql4.php index b4122993c69..6aff205a968 100644 --- a/app/code/core/Mage/Reports/Model/Resource/Helper/Mysql4.php +++ b/app/code/core/Mage/Reports/Model/Resource/Helper/Mysql4.php @@ -27,7 +27,7 @@ class Mage_Reports_Model_Resource_Helper_Mysql4 extends Mage_Core_Model_Resource * @param string $mainTable * @param array $data * @param mixed $matchFields - * @return string + * @return int */ public function mergeVisitorProductIndex($mainTable, $data, $matchFields) { @@ -93,7 +93,7 @@ public function updateReportRatingPos($type, $column, $mainTable, $aggregationTa [ 't.store_id', $periodCol, - $adapter->getCheckSql($productTypesInExpr, 1, 0), + $adapter->getCheckSql($productTypesInExpr, '1', '0'), 'total_qty DESC' ] ); diff --git a/app/code/core/Mage/Reports/Model/Resource/Invoiced/Collection.php b/app/code/core/Mage/Reports/Model/Resource/Invoiced/Collection.php index e3cceb0d692..fa20f493a0c 100644 --- a/app/code/core/Mage/Reports/Model/Resource/Invoiced/Collection.php +++ b/app/code/core/Mage/Reports/Model/Resource/Invoiced/Collection.php @@ -30,7 +30,7 @@ class Mage_Reports_Model_Resource_Invoiced_Collection extends Mage_Sales_Model_E */ public function setDateRange($from, $to) { - $orderInvoicedExpr = $this->getConnection()->getCheckSql('{{base_total_invoiced}} > 0', 1, 0); + $orderInvoicedExpr = $this->getConnection()->getCheckSql('{{base_total_invoiced}} > 0', '1', '0'); $this->_reset() ->addAttributeToSelect('*') ->addAttributeToFilter('created_at', ['from' => $from, 'to' => $to]) @@ -46,8 +46,8 @@ public function setDateRange($from, $to) ) ->addAttributeToFilter('state', ['neq' => Mage_Sales_Model_Order::STATE_CANCELED]) ->getSelect() - ->group('entity_id') - ->having('orders > ?', 0); + ->group('entity_id') + ->having('orders > ?', 0); /* * Allow Analytic Functions Usage */ diff --git a/app/code/core/Mage/Reports/Model/Resource/Order/Collection.php b/app/code/core/Mage/Reports/Model/Resource/Order/Collection.php index e3300319bc9..ee469722d0f 100644 --- a/app/code/core/Mage/Reports/Model/Resource/Order/Collection.php +++ b/app/code/core/Mage/Reports/Model/Resource/Order/Collection.php @@ -502,7 +502,7 @@ public function calculateSales($isFilter = 0) $averageExpr = $adapter->getCheckSql( 'SUM(main_table.orders_count) > 0', 'SUM(main_table.total_revenue_amount)/SUM(main_table.orders_count)', - 0 + '0' ); $this->getSelect()->columns([ 'lifetime' => new Zend_Db_Expr('SUM(main_table.total_revenue_amount)'), @@ -552,8 +552,8 @@ public function setDateRange($from, $to) ->addFieldToFilter('created_at', ['from' => $from, 'to' => $to]) ->addFieldToFilter('state', ['neq' => Mage_Sales_Model_Order::STATE_CANCELED]) ->getSelect() - ->columns(['orders' => 'COUNT(DISTINCT(main_table.entity_id))']) - ->group('entity_id'); + ->columns(['orders' => 'COUNT(DISTINCT(main_table.entity_id))']) + ->group('entity_id'); $this->getSelect()->columns([ 'items' => 'SUM(main_table.total_qty_ordered)']); 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 96ef04e36b9..a7fa64b4f2c 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 @@ -204,7 +204,7 @@ public function useManageStockFilter($storeId = null) $this->joinInventoryItem(); $manageStockExpr = $this->getConnection()->getCheckSql( $this->_getInventoryItemField('use_config_manage_stock') . ' = 1', - Mage::getStoreConfigAsInt(Mage_CatalogInventory_Model_Stock_Item::XML_PATH_MANAGE_STOCK, $storeId), + (string)Mage::getStoreConfigAsInt(Mage_CatalogInventory_Model_Stock_Item::XML_PATH_MANAGE_STOCK, $storeId), $this->_getInventoryItemField('manage_stock') ); $this->getSelect()->where($manageStockExpr . ' = ?', 1); @@ -222,7 +222,7 @@ public function useNotifyStockQtyFilter($storeId = null) $this->joinInventoryItem(['qty']); $notifyStockExpr = $this->getConnection()->getCheckSql( $this->_getInventoryItemField('use_config_notify_stock_qty') . ' = 1', - Mage::getStoreConfigAsInt(Mage_CatalogInventory_Model_Stock_Item::XML_PATH_NOTIFY_STOCK_QTY, $storeId), + (string)Mage::getStoreConfigAsInt(Mage_CatalogInventory_Model_Stock_Item::XML_PATH_NOTIFY_STOCK_QTY, $storeId), $this->_getInventoryItemField('notify_stock_qty') ); $this->getSelect()->where('qty < ?', $notifyStockExpr); diff --git a/app/code/core/Mage/Sales/Model/Entity/Sale/Collection.php b/app/code/core/Mage/Sales/Model/Entity/Sale/Collection.php index 4b2b06bea0c..1721cfaa708 100644 --- a/app/code/core/Mage/Sales/Model/Entity/Sale/Collection.php +++ b/app/code/core/Mage/Sales/Model/Entity/Sale/Collection.php @@ -87,7 +87,6 @@ public function load($printQuery = false, $logQuery = false) ] ) ->where('sales.entity_type_id=?', $this->getEntity()->getTypeId()) - // phpcs:ignore Ecg.Sql.SlowQuery.SlowSql ->group('sales.store_id') ; if ($this->_customer instanceof Mage_Customer_Model_Customer) { @@ -97,7 +96,6 @@ public function load($printQuery = false, $logQuery = false) $this->printLogQuery($printQuery, $logQuery); try { - // phpcs:ignore Ecg.Performance.FetchAll.Found $values = $this->_read->fetchAll($this->getSelect()->__toString()); } catch (Exception $e) { $this->printLogQuery(true, true, $this->getSelect()->__toString()); diff --git a/app/code/core/Mage/Sales/Model/Quote.php b/app/code/core/Mage/Sales/Model/Quote.php index 6ad5876b35d..9571414f337 100644 --- a/app/code/core/Mage/Sales/Model/Quote.php +++ b/app/code/core/Mage/Sales/Model/Quote.php @@ -31,8 +31,8 @@ * * @method bool hasCanApplyMsrp() * @method bool getCanApplyMsrp() - * @method string getAppliedRuleIds() - * @method $this setAppliedRuleIds(string $value) + * @method string|array getAppliedRuleIds() + * @method $this setAppliedRuleIds(string|array $value) * * @method string getBaseCurrencyCode() * @method $this setBaseCurrencyCode(string $value) diff --git a/app/code/core/Mage/Sales/Model/Quote/Address.php b/app/code/core/Mage/Sales/Model/Quote/Address.php index bd1522aa303..9759929fa94 100644 --- a/app/code/core/Mage/Sales/Model/Quote/Address.php +++ b/app/code/core/Mage/Sales/Model/Quote/Address.php @@ -27,8 +27,8 @@ * @method string getAddressType() * @method $this setAddressType(string $value) * @method $this unsAddressType() - * @method string getAppliedRuleIds() - * @method $this setAppliedRuleIds(string $value) + * @method array getAppliedRuleIds() + * @method $this setAppliedRuleIds(array $value) * @method bool getAppliedTaxesReset() * @method $this setAppliedTaxesReset(bool $value) * diff --git a/app/code/core/Mage/Sales/Model/Resource/Quote/Address/Attribute/Frontend.php b/app/code/core/Mage/Sales/Model/Resource/Quote/Address/Attribute/Frontend.php index c2493446a89..c120d80029c 100644 --- a/app/code/core/Mage/Sales/Model/Resource/Quote/Address/Attribute/Frontend.php +++ b/app/code/core/Mage/Sales/Model/Resource/Quote/Address/Attribute/Frontend.php @@ -26,7 +26,6 @@ class Mage_Sales_Model_Resource_Quote_Address_Attribute_Frontend extends Mage_Ea * * @return $this|array */ - // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass public function fetchTotals(Mage_Sales_Model_Quote_Address $address) { return []; diff --git a/app/code/core/Mage/Sales/Model/Resource/Report/Invoiced.php b/app/code/core/Mage/Sales/Model/Resource/Report/Invoiced.php index b38e5e1ee96..e6278692f62 100644 --- a/app/code/core/Mage/Sales/Model/Resource/Report/Invoiced.php +++ b/app/code/core/Mage/Sales/Model/Resource/Report/Invoiced.php @@ -213,7 +213,7 @@ protected function _aggregateByOrderCreatedAt($from, $to) 'orders_invoiced' => new Zend_Db_Expr( sprintf( 'SUM(%s)', - $adapter->getCheckSql('base_total_invoiced > 0', 1, 0) + $adapter->getCheckSql('base_total_invoiced > 0', '1', '0') ) ), 'invoiced' => new Zend_Db_Expr( diff --git a/app/code/core/Mage/SalesRule/Model/Quote/Discount.php b/app/code/core/Mage/SalesRule/Model/Quote/Discount.php index c6fe7f7cd68..62a68d2a0b7 100644 --- a/app/code/core/Mage/SalesRule/Model/Quote/Discount.php +++ b/app/code/core/Mage/SalesRule/Model/Quote/Discount.php @@ -40,7 +40,7 @@ public function __construct() /** * Collect address discount amount * - * @return Mage_SalesRule_Model_Quote_Discount + * @return $this */ public function collect(Mage_Sales_Model_Quote_Address $address) { @@ -122,7 +122,7 @@ public function collect(Mage_Sales_Model_Quote_Address $address) * Aggregate item discount information to address data and related properties * * @param Mage_Sales_Model_Quote_Item_Abstract $item - * @return Mage_SalesRule_Model_Quote_Discount + * @return $this */ protected function _aggregateItemDiscount($item) { @@ -134,7 +134,7 @@ protected function _aggregateItemDiscount($item) /** * Add discount total information to address * - * @return Mage_SalesRule_Model_Quote_Discount + * @return $this */ public function fetch(Mage_Sales_Model_Quote_Address $address) { diff --git a/app/code/core/Mage/SalesRule/Model/Quote/Freeshipping.php b/app/code/core/Mage/SalesRule/Model/Quote/Freeshipping.php index f94f344a912..a75bde5bf9b 100644 --- a/app/code/core/Mage/SalesRule/Model/Quote/Freeshipping.php +++ b/app/code/core/Mage/SalesRule/Model/Quote/Freeshipping.php @@ -37,7 +37,7 @@ public function __construct() /** * Collect information about free shipping for all address items * - * @return Mage_SalesRule_Model_Quote_Freeshipping + * @return $this */ public function collect(Mage_Sales_Model_Quote_Address $address) { @@ -90,7 +90,7 @@ public function collect(Mage_Sales_Model_Quote_Address $address) * Add information about free shipping for all address items to address object * By default we not present such information * - * @return Mage_SalesRule_Model_Quote_Freeshipping + * @return $this */ public function fetch(Mage_Sales_Model_Quote_Address $address) { diff --git a/app/code/core/Mage/SalesRule/Model/Resource/Coupon/Collection.php b/app/code/core/Mage/SalesRule/Model/Resource/Coupon/Collection.php index 6b25201400e..4c5836881b5 100644 --- a/app/code/core/Mage/SalesRule/Model/Resource/Coupon/Collection.php +++ b/app/code/core/Mage/SalesRule/Model/Resource/Coupon/Collection.php @@ -80,7 +80,7 @@ public function addIsUsedFilterCallback($collection, $column) { $filterValue = $column->getFilter()->getCondition(); - $fieldExpression = $this->getConnection()->getCheckSql('main_table.times_used > 0', 1, 0); + $fieldExpression = $this->getConnection()->getCheckSql('main_table.times_used > 0', '1', '0'); $resultCondition = $this->_getConditionSql($fieldExpression, ['eq' => $filterValue]); $collection->getSelect()->where($resultCondition); } diff --git a/app/code/core/Mage/Shipping/Model/Carrier/Abstract.php b/app/code/core/Mage/Shipping/Model/Carrier/Abstract.php index c23a1ed6a12..da1537de2b9 100644 --- a/app/code/core/Mage/Shipping/Model/Carrier/Abstract.php +++ b/app/code/core/Mage/Shipping/Model/Carrier/Abstract.php @@ -406,7 +406,7 @@ protected function _updateFreeMethodQuote($request) /** * Calculate price considering free shipping and handling fee * - * @param string $cost + * @param float $cost * @param string $method * @return float|string */ diff --git a/app/code/core/Mage/Shipping/Model/Rate/Request.php b/app/code/core/Mage/Shipping/Model/Rate/Request.php index f6031e070b1..65bb1bb02f1 100644 --- a/app/code/core/Mage/Shipping/Model/Rate/Request.php +++ b/app/code/core/Mage/Shipping/Model/Rate/Request.php @@ -51,8 +51,8 @@ * @method Mage_Sales_Model_Quote_Item[] getAllItems() * @method $this setAllItems(array $items) * - * @method string getBaseCurrency() - * @method $this setBaseCurrency(string $value) + * @method Mage_Directory_Model_Currency getBaseCurrency() + * @method $this setBaseCurrency(Mage_Directory_Model_Currency $value) * @method float getBaseSubtotalInclTax() * @method $this setBaseSubtotalInclTax(float $value) * @@ -117,8 +117,8 @@ * @method $this setPackageWidth(int $value) * @method int getPackageDepth() * @method $this setPackageDepth(int $value) - * @method string getPackageCurrency() - * @method $this setPackageCurrency(string $value) + * @method Mage_Directory_Model_Currency getPackageCurrency() + * @method $this setPackageCurrency(Mage_Directory_Model_Currency $value) * @method $this setPostcode(string $value) * * @method $this setRegionId(string $value) diff --git a/app/code/core/Mage/Tax/Model/Resource/Calculation.php b/app/code/core/Mage/Tax/Model/Resource/Calculation.php index a7572c7f64c..3e6b2db72bd 100644 --- a/app/code/core/Mage/Tax/Model/Resource/Calculation.php +++ b/app/code/core/Mage/Tax/Model/Resource/Calculation.php @@ -335,7 +335,6 @@ protected function _getRates($request) * @see ZF-7592 issue http://framework.zend.com/issues/browse/ZF-7592 */ if ($postcodeIsNumeric || $postcodeIsRange) { - // phpcs:ignore Ecg.Sql.SlowQuery.SlowSql $select = $this->_getReadAdapter()->select()->union( [ '(' . $select . ')', @@ -351,7 +350,6 @@ protected function _getRates($request) ->order('tax_postcode ' . Varien_Db_Select::SQL_DESC) ->order('value ' . Varien_Db_Select::SQL_DESC); - // phpcs:ignore Ecg.Performance.FetchAll.Found $this->_ratesCache[$cacheKey] = $this->_getReadAdapter()->fetchAll($select); } @@ -484,10 +482,8 @@ public function getRatesByCustomerTaxClass($customerTaxClass, $productTaxClass = 'state_table.region_id = main_table.tax_region_id', ['region_code' => 'state_table.code'] ) - // phpcs:ignore Ecg.Sql.SlowQuery.SlowSql ->distinct(true); - // phpcs:ignore Ecg.Performance.FetchAll.Found $csp = $adapter->fetchAll($selectCSP); $result = []; diff --git a/app/code/core/Mage/Tax/Model/Sales/Total/Quote/Tax.php b/app/code/core/Mage/Tax/Model/Sales/Total/Quote/Tax.php index f09c2c9ce6c..e542f373014 100644 --- a/app/code/core/Mage/Tax/Model/Sales/Total/Quote/Tax.php +++ b/app/code/core/Mage/Tax/Model/Sales/Total/Quote/Tax.php @@ -1442,6 +1442,7 @@ protected function _calculateRowWeeeTax($discountAmount, $item, $rate, $base = t * @param float $weeeAmountExclTax * @return mixed */ + // phpcs:ignore Ecg.PHP.PrivateClassMember.PrivateClassMemberError private function _getWeeeTax($rate, $item, $discountAmount, $weeeAmountIncludingTax, $weeeAmountExclTax) { $isWeeeTaxAlreadyIncluded = $this->_weeeHelper->isTaxIncluded($this->_store); @@ -1509,7 +1510,7 @@ protected function _recalculateParent(Mage_Sales_Model_Quote_Item_Abstract $item * @param array $applied * @param float $amount * @param float $baseAmount - * @param float $rate + * @param float|null $rate */ protected function _saveAppliedTaxes( Mage_Sales_Model_Quote_Address $address, @@ -1533,8 +1534,8 @@ protected function _saveAppliedTaxes( } if (!is_null($row['percent'])) { - $row['percent'] = $row['percent'] ? $row['percent'] : 1; - $rate = $rate ? $rate : 1; + $row['percent'] = $row['percent'] ?: 1; + $rate = $rate ?: 1; $appliedAmount = $amount / $rate * $row['percent']; $baseAppliedAmount = $baseAmount / $rate * $row['percent']; diff --git a/app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl.php b/app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl.php index 2244585cb9e..8f643b5efc0 100644 --- a/app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl.php +++ b/app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl.php @@ -908,7 +908,7 @@ protected function _addRate($shipXml) $desc = ($shipXml->EstimateDetail) ? (string)$shipXml->EstimateDetail->ServiceLevelCommitment->Desc : null; $totalEstimate = $shipXml->EstimateDetail - ? (string)$shipXml->EstimateDetail->RateEstimate->TotalChargeEstimate + ? (float)$shipXml->EstimateDetail->RateEstimate->TotalChargeEstimate : null; /* * DHL can return with empty result and success code @@ -1257,8 +1257,6 @@ public function getAdditionalProtectionRoundingTypes() /** * Map request to shipment - * - * @return null */ protected function _mapRequestToShipment(Varien_Object $request) { diff --git a/app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International.php b/app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International.php index 090c3731615..362a6fae7c2 100644 --- a/app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International.php +++ b/app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International.php @@ -48,7 +48,7 @@ class Mage_Usa_Model_Shipping_Carrier_Dhl_International extends Mage_Usa_Model_S /** * Rate request data * - * @var Mage_Shipping_Model_Rate_Request|null + * @var Mage_Shipping_Model_Rate_Request|Varien_Object|null */ protected $_request = null; @@ -62,7 +62,7 @@ class Mage_Usa_Model_Shipping_Carrier_Dhl_International extends Mage_Usa_Model_S /** * Rate result data * - * @var Mage_Shipping_Model_Rate_Result|null + * @var Mage_Shipping_Model_Rate_Result|Mage_Shipping_Model_Tracking_Result|null */ protected $_result = null; @@ -400,7 +400,7 @@ public function getAllowedMethods() * * @param string $type * @param string $code - * @return array|bool + * @return array|string|false */ public function getCode($type, $code = '') { @@ -671,18 +671,18 @@ protected function _makePieces(SimpleXMLElement $nodeBkgDetails) } elseif (($sumWeight + $weightItem) > $maxWeight) { $numberOfPieces++; $nodePiece = $nodePieces->addChild('Piece', '', ''); - $nodePiece->addChild('PieceID', $numberOfPieces); + $nodePiece->addChild('PieceID', (string)$numberOfPieces); $this->_addDimension($nodePiece); - $nodePiece->addChild('Weight', $sumWeight); + $nodePiece->addChild('Weight', (string)$sumWeight); break; } else { unset($items[$keyItem]); $numberOfPieces++; $sumWeight += $weightItem; $nodePiece = $nodePieces->addChild('Piece', '', ''); - $nodePiece->addChild('PieceID', $numberOfPieces); + $nodePiece->addChild('PieceID', (string)$numberOfPieces); $this->_addDimension($nodePiece); - $nodePiece->addChild('Weight', $sumWeight); + $nodePiece->addChild('Weight', (string)$sumWeight); $sumWeight = 0; break; } @@ -691,15 +691,15 @@ protected function _makePieces(SimpleXMLElement $nodeBkgDetails) if ($sumWeight > 0) { $numberOfPieces++; $nodePiece = $nodePieces->addChild('Piece', '', ''); - $nodePiece->addChild('PieceID', $numberOfPieces); + $nodePiece->addChild('PieceID', (string)$numberOfPieces); $this->_addDimension($nodePiece); - $nodePiece->addChild('Weight', $sumWeight); + $nodePiece->addChild('Weight', (string)$sumWeight); } } else { $nodePiece = $nodePieces->addChild('Piece', '', ''); - $nodePiece->addChild('PieceID', 1); + $nodePiece->addChild('PieceID', '1'); $this->_addDimension($nodePiece); - $nodePiece->addChild('Weight', $this->_getWeight($this->_rawRequest->getWeight())); + $nodePiece->addChild('Weight', (string)$this->_getWeight($this->_rawRequest->getWeight())); } $handlingAction = $this->getConfigData('handling_action'); @@ -752,9 +752,9 @@ protected function _addDimension($nodePiece) { $sizeChecker = (string)$this->getConfigData('size'); - $height = $this->_getDimension((float)$this->getConfigData('height')); - $depth = $this->_getDimension((float)$this->getConfigData('depth')); - $width = $this->_getDimension((float)$this->getConfigData('width')); + $height = (string)$this->_getDimension((float)$this->getConfigData('height')); + $depth = (string)$this->_getDimension((float)$this->getConfigData('depth')); + $width = (string)$this->_getDimension((float)$this->getConfigData('width')); if ($sizeChecker && $height && $depth && $width) { $nodePiece->addChild('Height', $height); @@ -903,7 +903,7 @@ protected function _setQuotesRequestXmlDate(SimpleXMLElement $requestXml, $date) * Parse response from DHL web service * * @param string $response - * @return Mage_Shipping_Model_Rate_Result + * @return Mage_Shipping_Model_Rate_Result|Varien_Object */ protected function _parseResponse($response) { @@ -1177,8 +1177,6 @@ public function getContainerTypes(?Varien_Object $params = null) /** * Map request to shipment - * - * @return null */ protected function _mapRequestToShipment(Varien_Object $request) { @@ -1320,7 +1318,7 @@ protected function _doRequest() /* Commodity * The CommodityCode element contains commodity code for shipment contents. Its - * value should lie in between 1 to 9999.This field is mandatory. + * value should lie in between 1 and 9999.This field is mandatory. */ $nodeCommodity = $xml->addChild('Commodity', '', ''); $nodeCommodity->addChild('CommodityCode', '1'); @@ -1415,13 +1413,13 @@ protected function _doRequest() * Generation Shipment Details Node according to origin region * * @param SimpleXMLElement $xml - * @param Mage_Shipping_Model_Rate_Request $rawRequest + * @param Mage_Shipping_Model_Rate_Request|Varien_Object $rawRequest * @param string $originRegion */ protected function _shipmentDetails($xml, $rawRequest, $originRegion = '') { $nodeShipmentDetails = $xml->addChild('ShipmentDetails', '', ''); - $nodeShipmentDetails->addChild('NumberOfPieces', count($rawRequest->getPackages())); + $nodeShipmentDetails->addChild('NumberOfPieces', (string)count($rawRequest->getPackages())); if ($originRegion) { $nodeShipmentDetails->addChild( @@ -1432,6 +1430,9 @@ protected function _shipmentDetails($xml, $rawRequest, $originRegion = '') $nodePieces = $nodeShipmentDetails->addChild('Pieces', '', ''); + $package = []; + $packageType = ''; + /* * Package type * EE (DHL Express Envelope), OD (Other DHL Packaging), CP (Custom Packaging) @@ -1446,19 +1447,19 @@ protected function _shipmentDetails($xml, $rawRequest, $originRegion = '') if ($package['params']['container'] == self::DHL_CONTENT_TYPE_NON_DOC) { $packageType = 'CP'; } - $nodePiece->addChild('PieceID', ++$i); + $nodePiece->addChild('PieceID', (string)++$i); $nodePiece->addChild('PackageType', $packageType); - $nodePiece->addChild('Weight', round($package['params']['weight'], 1)); + $nodePiece->addChild('Weight', (string)round($package['params']['weight'], 1)); $params = $package['params']; if ($params['width'] && $params['length'] && $params['height']) { if (!$originRegion) { - $nodePiece->addChild('Width', round($params['width'])); - $nodePiece->addChild('Height', round($params['height'])); - $nodePiece->addChild('Depth', round($params['length'])); + $nodePiece->addChild('Width', (string)round($params['width'])); + $nodePiece->addChild('Height', (string)round($params['height'])); + $nodePiece->addChild('Depth', (string)round($params['length'])); } else { - $nodePiece->addChild('Depth', round($params['length'])); - $nodePiece->addChild('Width', round($params['width'])); - $nodePiece->addChild('Height', round($params['height'])); + $nodePiece->addChild('Depth', (string)round($params['length'])); + $nodePiece->addChild('Width', (string)round($params['width'])); + $nodePiece->addChild('Height', (string)round($params['height'])); } } $content = []; @@ -1469,7 +1470,7 @@ protected function _shipmentDetails($xml, $rawRequest, $originRegion = '') } if (!$originRegion) { - $nodeShipmentDetails->addChild('Weight', round($rawRequest->getPackageWeight(), 1)); + $nodeShipmentDetails->addChild('Weight', (string)round($rawRequest->getPackageWeight(), 1)); $nodeShipmentDetails->addChild('WeightUnit', substr($this->_getWeightUnit(), 0, 1)); diff --git a/app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex.php b/app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex.php index a5727f6ce4d..d7832a788f7 100644 --- a/app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex.php +++ b/app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex.php @@ -239,7 +239,6 @@ public function setRequest(Mage_Shipping_Model_Rate_Request $request) if ($request->getDestPostcode()) { $r->setDestPostal($request->getDestPostcode()); - } else { } $weight = $this->getTotalNumOfBoxes($request->getPackageWeight()); @@ -691,7 +690,7 @@ protected function _parseXmlResponse($response) $costArr[(string)$entry->Service] = (string)$entry->EstimatedCharges->DiscountedCharges->NetCharge; $priceArr[(string)$entry->Service] = $this->getMethodPrice( - (string)$entry->EstimatedCharges->DiscountedCharges->NetCharge, + (float)$entry->EstimatedCharges->DiscountedCharges->NetCharge, (string)$entry->Service ); } 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 e25e22d7bb5..2d881580189 100644 --- a/app/code/core/Mage/Usa/Model/Shipping/Carrier/Usps.php +++ b/app/code/core/Mage/Usa/Model/Shipping/Carrier/Usps.php @@ -465,7 +465,7 @@ protected function _parseXmlResponse($response) if (in_array($serviceCode, $allowedMethods)) { $costArr[$serviceCode] = (string)$postage->Rate; $priceArr[$serviceCode] = $this->getMethodPrice( - (string)$postage->Rate, + (float)$postage->Rate, $serviceCode ); } @@ -475,6 +475,7 @@ protected function _parseXmlResponse($response) } else { // International Rates if (is_object($xml->Package) && is_object($xml->Package->Service)) { foreach ($xml->Package->Service as $service) { + // phpcs:ignore Ecg.Performance.Loop.ArraySize if ($service->ServiceErrors->count()) { continue; } @@ -484,7 +485,7 @@ protected function _parseXmlResponse($response) if (in_array($serviceCode, $allowedMethods)) { $costArr[$serviceCode] = (string)$service->Postage; $priceArr[$serviceCode] = $this->getMethodPrice( - (string)$service->Postage, + (float)$service->Postage, $serviceCode ); } @@ -1902,7 +1903,8 @@ protected function _parseZip($zipString, $returnFull = false) if (preg_match('/[\\d\\w]{5}\\-[\\d\\w]{4}/', $zipString) != 0) { $zip = explode('-', $zipString); } - for ($i = 0; $i < count($zip); ++$i) { + $zipCount = count($zip); + for ($i = 0; $i < $zipCount; ++$i) { if (strlen($zip[$i]) == 5) { $zip5 = $zip[$i]; } elseif (strlen($zip[$i]) == 4) { diff --git a/app/code/core/Mage/Weee/Helper/Data.php b/app/code/core/Mage/Weee/Helper/Data.php index e997b93d5f8..44be568aa72 100644 --- a/app/code/core/Mage/Weee/Helper/Data.php +++ b/app/code/core/Mage/Weee/Helper/Data.php @@ -220,7 +220,7 @@ public function typeOfDisplay($product, $compareTo = null, $zone = null, $store * @param Mage_Catalog_Model_Product $product * @param null|false|Varien_Object $shipping * @param null|false|Varien_Object $billing - * @param Mage_Core_Model_Website $website + * @param int|Mage_Core_Model_Website $website * @param bool $calculateTaxes * @return array */ @@ -300,7 +300,7 @@ public function getProductWeeeAttributesForDisplay($product) * @param Mage_Catalog_Model_Product $product * @param null|false|Varien_Object $shipping Shipping Address * @param null|false|Varien_Object $billing Billing Address - * @param null|Mage_Core_Model_Website $website + * @param null|int $website * @param mixed $calculateTaxes * @return array */ @@ -456,6 +456,7 @@ public function getAmountInclTaxes($attributes) $amount += $attribute->getAmount() + $attribute->getTaxAmount(); } } else { + // phpcs:ignore Ecg.Classes.ObjectInstantiation.DirectInstantiation throw new Mage_Core_Exception('$attributes must be an array'); } diff --git a/app/code/core/Mage/Weee/Model/Observer.php b/app/code/core/Mage/Weee/Model/Observer.php index 632672016ca..6e5871d9582 100644 --- a/app/code/core/Mage/Weee/Model/Observer.php +++ b/app/code/core/Mage/Weee/Model/Observer.php @@ -111,12 +111,12 @@ public function prepareCatalogIndexSelect(Varien_Event_Observer $observer) } $checkDiscountField = $select->getAdapter()->getCheckSql( 'discount_percent.value IS NULL', - 0, + '0', 'discount_percent.value' ); foreach ($attributes as $attribute) { $fieldAlias = sprintf('weee_%s_table.value', $attribute); - $checkAdditionalCalculation = $select->getAdapter()->getCheckSql("{$fieldAlias} IS NULL", 0, $fieldAlias); + $checkAdditionalCalculation = $select->getAdapter()->getCheckSql("{$fieldAlias} IS NULL", '0', $fieldAlias); if (Mage::helper('weee')->isDiscounted()) { $additionalCalculations[] = sprintf('+(%s*(1-(%s/100)))', $checkAdditionalCalculation, $checkDiscountField); } else { diff --git a/app/code/core/Mage/Weee/Model/Tax.php b/app/code/core/Mage/Weee/Model/Tax.php index 3b9c3000629..7eb8ce16f70 100644 --- a/app/code/core/Mage/Weee/Model/Tax.php +++ b/app/code/core/Mage/Weee/Model/Tax.php @@ -148,7 +148,7 @@ public function getWeeeTaxAttributeCodes($forceEnabled = false) * @param Mage_Catalog_Model_Product $product * @param Mage_Sales_Model_Quote_Address $shipping * @param Mage_Sales_Model_Quote_Address $billing - * @param int $website + * @param int|Mage_Core_Model_Website $website * @param bool $calculateTax * @param bool $ignoreDiscount * @return array @@ -238,6 +238,7 @@ public function getProductWeeeAttributes( $amount = $amount - $taxAmount; } else { $appliedRates = Mage::getModel('tax/calculation')->getAppliedRates($rateRequest); + // phpcs:ignore Ecg.Performance.Loop.ArraySize if (count($appliedRates) > 1) { $taxAmount = 0; foreach ($appliedRates as $appliedRate) { diff --git a/app/design/adminhtml/default/default/template/bundle/product/edit/bundle/option/selection.phtml b/app/design/adminhtml/default/default/template/bundle/product/edit/bundle/option/selection.phtml index 81db5433641..2b5baa636e9 100644 --- a/app/design/adminhtml/default/default/template/bundle/product/edit/bundle/option/selection.phtml +++ b/app/design/adminhtml/default/default/template/bundle/product/edit/bundle/option/selection.phtml @@ -12,6 +12,11 @@ * @copyright Copyright (c) 2021-2023 The OpenMage Contributors (https://www.openmage.org) * @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ + +/** + * @see Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Bundle_Option_Selection + * @var Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Bundle_Option_Selection $this + */ ?>