From 4a746db7bf391c30c585d40cdb9572bdd1c51319 Mon Sep 17 00:00:00 2001 From: Sven Reichel Date: Thu, 8 Sep 2022 00:53:56 +0200 Subject: [PATCH 1/4] Added $this as return in Mage_Adminhtml_Helper_Catalog_Product_Composite --- .github/phpstan-baseline.neon | 10 ---------- .../Adminhtml/Helper/Catalog/Product/Composite.php | 2 ++ 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/.github/phpstan-baseline.neon b/.github/phpstan-baseline.neon index f744c46a4c3..893bd6f683c 100644 --- a/.github/phpstan-baseline.neon +++ b/.github/phpstan-baseline.neon @@ -530,16 +530,6 @@ parameters: count: 1 path: ../app/code/core/Mage/Adminhtml/Block/Widget/Tabs.php - - - message: "#^Method Mage_Adminhtml_Helper_Catalog_Product_Composite\\:\\:renderConfigureResult\\(\\) should return \\$this\\(Mage_Adminhtml_Helper_Catalog_Product_Composite\\) but return statement is missing\\.$#" - count: 1 - path: ../app/code/core/Mage/Adminhtml/Helper/Catalog/Product/Composite.php - - - - message: "#^Method Mage_Adminhtml_Helper_Catalog_Product_Composite\\:\\:renderUpdateResult\\(\\) should return \\$this\\(Mage_Adminhtml_Helper_Catalog_Product_Composite\\) but return statement is missing\\.$#" - count: 1 - path: ../app/code/core/Mage/Adminhtml/Helper/Catalog/Product/Composite.php - - message: "#^Method Mage_Adminhtml_Model_Config\\:\\:getSection\\(\\) should return Varien_Simplexml_Element but return statement is missing\\.$#" count: 1 diff --git a/app/code/core/Mage/Adminhtml/Helper/Catalog/Product/Composite.php b/app/code/core/Mage/Adminhtml/Helper/Catalog/Product/Composite.php index 4fbbcf7dee1..ae8d6dac1db 100644 --- a/app/code/core/Mage/Adminhtml/Helper/Catalog/Product/Composite.php +++ b/app/code/core/Mage/Adminhtml/Helper/Catalog/Product/Composite.php @@ -55,6 +55,7 @@ public function renderUpdateResult($controller, Varien_Object $updateResult) $this->_initUpdateResultLayout($controller); $controller->renderLayout(); + return $this; } /** @@ -142,5 +143,6 @@ public function renderConfigureResult($controller, Varien_Object $configureResul $this->_initConfigureResultLayout($controller, $isOk, $productType); $controller->renderLayout(); + return $this; } } From 5d8411a1849bca2e101b1933fbf1cda62bb9d9aa Mon Sep 17 00:00:00 2001 From: Sven Reichel Date: Thu, 8 Sep 2022 01:08:47 +0200 Subject: [PATCH 2/4] Added $this as return for afterLoad() --- .github/phpstan-baseline.neon | 40 ------------------- .../Model/System/Config/Backend/Encrypted.php | 2 +- .../System/Config/Backend/Serialized.php | 4 ++ .../Model/Product/Attribute/Backend/Media.php | 5 +++ .../System/Config/Backend/Minsaleqty.php | 3 ++ app/code/core/Mage/Core/Model/Config/Data.php | 2 + .../Attribute/Backend/Boolean/Config.php | 2 + .../System/Config/Backend/MerchantCountry.php | 2 + .../Resource/Order/Invoice/Collection.php | 3 +- 9 files changed, 21 insertions(+), 42 deletions(-) diff --git a/.github/phpstan-baseline.neon b/.github/phpstan-baseline.neon index 893bd6f683c..5257efc5332 100644 --- a/.github/phpstan-baseline.neon +++ b/.github/phpstan-baseline.neon @@ -575,16 +575,6 @@ parameters: count: 1 path: ../app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Catalog/Search/Type.php - - - message: "#^Method Mage_Adminhtml_Model_System_Config_Backend_Encrypted\\:\\:_afterLoad\\(\\) should return \\$this\\(Mage_Adminhtml_Model_System_Config_Backend_Encrypted\\) but return statement is missing\\.$#" - count: 1 - path: ../app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Encrypted.php - - - - message: "#^Method Mage_Adminhtml_Model_System_Config_Backend_Serialized\\:\\:_afterLoad\\(\\) should return \\$this\\(Mage_Adminhtml_Model_System_Config_Backend_Serialized\\) but return statement is missing\\.$#" - count: 1 - path: ../app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Serialized.php - - message: "#^Comparison operation \"\\=\\=\" between \\(Varien_Simplexml_Element\\|null\\) and 1 results in an error\\.$#" count: 1 @@ -1385,11 +1375,6 @@ parameters: count: 1 path: ../app/code/core/Mage/Catalog/Model/Product/Attribute/Api.php - - - message: "#^Method Mage_Catalog_Model_Product_Attribute_Backend_Media\\:\\:afterLoad\\(\\) should return \\$this\\(Mage_Catalog_Model_Product_Attribute_Backend_Media\\) but return statement is missing\\.$#" - count: 1 - path: ../app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Media.php - - message: "#^Method Mage_Catalog_Model_Product_Attribute_Backend_Recurring\\:\\:beforeSave\\(\\) should return \\$this\\(Mage_Catalog_Model_Product_Attribute_Backend_Recurring\\) but return statement is missing\\.$#" count: 1 @@ -1745,11 +1730,6 @@ parameters: count: 1 path: ../app/code/core/Mage/CatalogInventory/Model/Stock/Item.php - - - message: "#^Method Mage_CatalogInventory_Model_System_Config_Backend_Minsaleqty\\:\\:_afterLoad\\(\\) should return \\$this\\(Mage_CatalogInventory_Model_System_Config_Backend_Minsaleqty\\) but return statement is missing\\.$#" - count: 1 - path: ../app/code/core/Mage/CatalogInventory/Model/System/Config/Backend/Minsaleqty.php - - message: "#^Variable \\$gId might not be defined\\.$#" count: 1 @@ -1975,11 +1955,6 @@ parameters: count: 1 path: ../app/code/core/Mage/Core/Model/Config.php - - - message: "#^Method Mage_Core_Model_Config_Data\\:\\:afterLoad\\(\\) should return \\$this\\(Mage_Core_Model_Config_Data\\) but return statement is missing\\.$#" - count: 1 - path: ../app/code/core/Mage/Core/Model/Config/Data.php - - message: "#^Binary operation \"\\+\" between string and string results in an error\\.$#" count: 1 @@ -2570,11 +2545,6 @@ parameters: count: 2 path: ../app/code/core/Mage/Eav/Model/Resource/Form/Type.php - - - message: "#^Method Mage_GiftMessage_Model_Entity_Attribute_Backend_Boolean_Config\\:\\:afterLoad\\(\\) should return \\$this\\(Mage_GiftMessage_Model_Entity_Attribute_Backend_Boolean_Config\\) but return statement is missing\\.$#" - count: 1 - path: ../app/code/core/Mage/GiftMessage/Model/Entity/Attribute/Backend/Boolean/Config.php - - message: "#^Method Mage_GiftMessage_Model_Entity_Attribute_Backend_Boolean_Config\\:\\:beforeSave\\(\\) should return \\$this\\(Mage_GiftMessage_Model_Entity_Attribute_Backend_Boolean_Config\\) but return statement is missing\\.$#" count: 1 @@ -3300,11 +3270,6 @@ parameters: count: 1 path: ../app/code/core/Mage/Paypal/Model/Standard.php - - - message: "#^Method Mage_Paypal_Model_System_Config_Backend_MerchantCountry\\:\\:_afterLoad\\(\\) should return \\$this\\(Mage_Paypal_Model_System_Config_Backend_MerchantCountry\\) but return statement is missing\\.$#" - count: 1 - path: ../app/code/core/Mage/Paypal/Model/System/Config/Backend/MerchantCountry.php - - message: "#^Method Varien_Data_Collection\\:\\:toOptionArray\\(\\) invoked with 1 parameter, 0 required\\.$#" count: 1 @@ -3630,11 +3595,6 @@ parameters: count: 1 path: ../app/code/core/Mage/Sales/Model/Resource/Order/Address.php - - - message: "#^Method Mage_Sales_Model_Resource_Order_Invoice_Collection\\:\\:_afterLoad\\(\\) should return \\$this\\(Mage_Sales_Model_Resource_Order_Invoice_Collection\\) but return statement is missing\\.$#" - count: 1 - path: ../app/code/core/Mage/Sales/Model/Resource/Order/Invoice/Collection.php - - message: "#^Call to an undefined method Mage_Core_Model_Abstract\\:\\:isFailsafe\\(\\)\\.$#" count: 1 diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Encrypted.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Encrypted.php index 0b6fe033eae..ae8281ce384 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Encrypted.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Encrypted.php @@ -29,7 +29,6 @@ class Mage_Adminhtml_Model_System_Config_Backend_Encrypted extends Mage_Core_Mod { /** * Decrypt value after loading - * */ protected function _afterLoad() { @@ -37,6 +36,7 @@ protected function _afterLoad() if (!empty($value) && ($decrypted = Mage::helper('core')->decrypt($value))) { $this->setValue($decrypted); } + return $this; } /** diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Serialized.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Serialized.php index 1c3f2065395..a195bef92f9 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Serialized.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Serialized.php @@ -25,6 +25,9 @@ */ class Mage_Adminhtml_Model_System_Config_Backend_Serialized extends Mage_Core_Model_Config_Data { + /** + * @return $this + */ protected function _afterLoad() { if (!is_array($this->getValue())) { @@ -40,6 +43,7 @@ protected function _afterLoad() } $this->setValue($unserializedValue); } + return $this; } /** diff --git a/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Media.php b/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Media.php index 212348e1101..540732915d0 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Media.php +++ b/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Media.php @@ -27,12 +27,16 @@ */ class Mage_Catalog_Model_Product_Attribute_Backend_Media extends Mage_Eav_Model_Entity_Attribute_Backend_Abstract { + /** + * @var array + */ protected $_renamedImages = []; /** * Load attribute data after product loaded * * @param Mage_Catalog_Model_Product $object + * @return $this */ public function afterLoad($object) { @@ -52,6 +56,7 @@ public function afterLoad($object) } $object->setData($attrCode, $value); + return $this; } /** diff --git a/app/code/core/Mage/CatalogInventory/Model/System/Config/Backend/Minsaleqty.php b/app/code/core/Mage/CatalogInventory/Model/System/Config/Backend/Minsaleqty.php index e679f5593ca..e515f546a7b 100644 --- a/app/code/core/Mage/CatalogInventory/Model/System/Config/Backend/Minsaleqty.php +++ b/app/code/core/Mage/CatalogInventory/Model/System/Config/Backend/Minsaleqty.php @@ -29,16 +29,19 @@ class Mage_CatalogInventory_Model_System_Config_Backend_Minsaleqty extends Mage_ { /** * Process data after load + * @return $this */ protected function _afterLoad() { $value = $this->getValue(); $value = Mage::helper('cataloginventory/minsaleqty')->makeArrayFieldValue($value); $this->setValue($value); + return $this; } /** * Prepare data before save + * @return $this */ protected function _beforeSave() { diff --git a/app/code/core/Mage/Core/Model/Config/Data.php b/app/code/core/Mage/Core/Model/Config/Data.php index 5924ed19537..3c1408fe965 100644 --- a/app/code/core/Mage/Core/Model/Config/Data.php +++ b/app/code/core/Mage/Core/Model/Config/Data.php @@ -68,10 +68,12 @@ protected function _construct() /** * Add availability call after load as public + * @return $this */ public function afterLoad() { $this->_afterLoad(); + return $this; } /** diff --git a/app/code/core/Mage/GiftMessage/Model/Entity/Attribute/Backend/Boolean/Config.php b/app/code/core/Mage/GiftMessage/Model/Entity/Attribute/Backend/Boolean/Config.php index 13872ac190c..3fbee520842 100644 --- a/app/code/core/Mage/GiftMessage/Model/Entity/Attribute/Backend/Boolean/Config.php +++ b/app/code/core/Mage/GiftMessage/Model/Entity/Attribute/Backend/Boolean/Config.php @@ -32,12 +32,14 @@ class Mage_GiftMessage_Model_Entity_Attribute_Backend_Boolean_Config extends Mag * Set attribute default value if value empty * * @param Varien_Object $object + * @return $this */ public function afterLoad($object) { if (!$object->hasData($this->getAttribute()->getAttributeCode())) { $object->setData($this->getAttribute()->getAttributeCode(), $this->getDefaultValue()); } + return $this; } /** diff --git a/app/code/core/Mage/Paypal/Model/System/Config/Backend/MerchantCountry.php b/app/code/core/Mage/Paypal/Model/System/Config/Backend/MerchantCountry.php index ee88a2aca1a..cd6d646c054 100644 --- a/app/code/core/Mage/Paypal/Model/System/Config/Backend/MerchantCountry.php +++ b/app/code/core/Mage/Paypal/Model/System/Config/Backend/MerchantCountry.php @@ -36,6 +36,7 @@ class Mage_Paypal_Model_System_Config_Backend_MerchantCountry extends Mage_Core_ /** * Substitute empty value with Default country. + * @return $this */ protected function _afterLoad() { @@ -49,5 +50,6 @@ protected function _afterLoad() } $this->setValue($defaultCountry); } + return $this; } } diff --git a/app/code/core/Mage/Sales/Model/Resource/Order/Invoice/Collection.php b/app/code/core/Mage/Sales/Model/Resource/Order/Invoice/Collection.php index b03ca09d105..0962bb76918 100644 --- a/app/code/core/Mage/Sales/Model/Resource/Order/Invoice/Collection.php +++ b/app/code/core/Mage/Sales/Model/Resource/Order/Invoice/Collection.php @@ -51,10 +51,11 @@ protected function _construct() /** * Used to emulate after load functionality for each item without loading them - * + * @return $this */ protected function _afterLoad() { $this->walk('afterLoad'); + return $this; } } From 4c9ff9cbd171c3466fd21487e59781ad1df9d1bc Mon Sep 17 00:00:00 2001 From: Sven Reichel Date: Thu, 8 Sep 2022 01:13:47 +0200 Subject: [PATCH 3/4] Added $this as return for beforeSave() --- .github/phpstan-baseline.neon | 15 --------------- .../Model/Product/Attribute/Backend/Recurring.php | 2 ++ .../Model/Customer/Attribute/Backend/Password.php | 2 ++ .../Entity/Attribute/Backend/Boolean/Config.php | 2 ++ 4 files changed, 6 insertions(+), 15 deletions(-) diff --git a/.github/phpstan-baseline.neon b/.github/phpstan-baseline.neon index 5257efc5332..039c597a785 100644 --- a/.github/phpstan-baseline.neon +++ b/.github/phpstan-baseline.neon @@ -1375,11 +1375,6 @@ parameters: count: 1 path: ../app/code/core/Mage/Catalog/Model/Product/Attribute/Api.php - - - message: "#^Method Mage_Catalog_Model_Product_Attribute_Backend_Recurring\\:\\:beforeSave\\(\\) should return \\$this\\(Mage_Catalog_Model_Product_Attribute_Backend_Recurring\\) but return statement is missing\\.$#" - count: 1 - path: ../app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Recurring.php - - message: "#^Cannot call method getBackend\\(\\) on bool\\|Mage_Catalog_Model_Resource_Attribute\\.$#" count: 11 @@ -2145,11 +2140,6 @@ parameters: count: 1 path: ../app/code/core/Mage/Customer/Model/Customer.php - - - message: "#^Method Mage_Customer_Model_Customer_Attribute_Backend_Password\\:\\:beforeSave\\(\\) should return \\$this\\(Mage_Customer_Model_Customer_Attribute_Backend_Password\\) but return statement is missing\\.$#" - count: 1 - path: ../app/code/core/Mage/Customer/Model/Customer/Attribute/Backend/Password.php - - message: "#^Cannot call method addAttributeToSelect\\(\\) on Mage_Core_Model_Resource_Db_Collection_Abstract\\|false\\.$#" count: 1 @@ -2545,11 +2535,6 @@ parameters: count: 2 path: ../app/code/core/Mage/Eav/Model/Resource/Form/Type.php - - - message: "#^Method Mage_GiftMessage_Model_Entity_Attribute_Backend_Boolean_Config\\:\\:beforeSave\\(\\) should return \\$this\\(Mage_GiftMessage_Model_Entity_Attribute_Backend_Boolean_Config\\) but return statement is missing\\.$#" - count: 1 - path: ../app/code/core/Mage/GiftMessage/Model/Entity/Attribute/Backend/Boolean/Config.php - - message: "#^Call to an undefined method Mage_Eav_Model_Entity_Abstract\\:\\:setGiftMessageId\\(\\)\\.$#" count: 1 diff --git a/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Recurring.php b/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Recurring.php index b63398812d2..b095b6c9143 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Recurring.php +++ b/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Recurring.php @@ -30,6 +30,7 @@ class Mage_Catalog_Model_Product_Attribute_Backend_Recurring extends Mage_Eav_Mo /** * Serialize or remove before saving * @param Mage_Catalog_Model_Product $product + * @return $this */ public function beforeSave($product) { @@ -40,6 +41,7 @@ public function beforeSave($product) $product->unsRecurringProfile(); } } + return $this; } /** diff --git a/app/code/core/Mage/Customer/Model/Customer/Attribute/Backend/Password.php b/app/code/core/Mage/Customer/Model/Customer/Attribute/Backend/Password.php index f79003a2625..a16bdb36416 100644 --- a/app/code/core/Mage/Customer/Model/Customer/Attribute/Backend/Password.php +++ b/app/code/core/Mage/Customer/Model/Customer/Attribute/Backend/Password.php @@ -33,6 +33,7 @@ class Mage_Customer_Model_Customer_Attribute_Backend_Password extends Mage_Eav_M * b) transform temporary attribute 'password' into real attribute 'password_hash' * * @param Mage_Customer_Model_Customer $object + * @return $this * @throws Mage_Core_Exception */ public function beforeSave($object) @@ -49,6 +50,7 @@ public function beforeSave($object) } $object->setPasswordHash($object->hashPassword($password)); } + return $this; } /** diff --git a/app/code/core/Mage/GiftMessage/Model/Entity/Attribute/Backend/Boolean/Config.php b/app/code/core/Mage/GiftMessage/Model/Entity/Attribute/Backend/Boolean/Config.php index 3fbee520842..7ca5ad64ad4 100644 --- a/app/code/core/Mage/GiftMessage/Model/Entity/Attribute/Backend/Boolean/Config.php +++ b/app/code/core/Mage/GiftMessage/Model/Entity/Attribute/Backend/Boolean/Config.php @@ -46,6 +46,7 @@ public function afterLoad($object) * Set attribute default value if value empty * * @param Varien_Object $object + * @return $this */ public function beforeSave($object) { @@ -53,6 +54,7 @@ public function beforeSave($object) && $object->getData($this->getAttribute()->getAttributeCode()) == $this->getDefaultValue()) { $object->unsData($this->getAttribute()->getAttributeCode()); } + return $this; } /** From 9dd6a33a96f16d2dc11e792f42150913c17cea1d Mon Sep 17 00:00:00 2001 From: Sven Reichel Date: Thu, 8 Sep 2022 01:57:49 +0200 Subject: [PATCH 4/4] Fixed "should return string but return statement is missing" --- .github/phpstan-baseline.neon | 70 ------------------- .../Block/Review/Grid/Renderer/Type.php | 14 ++-- .../Widget/Grid/Column/Renderer/Options.php | 1 + .../controllers/CustomerController.php | 23 +++--- .../Api2/Product/Image/Rest/Admin/V1.php | 2 +- .../Model/Product/Option/Type/File.php | 1 + .../Block/Onepage/Payment/Methods.php | 1 + app/code/core/Mage/Core/functions.php | 2 +- .../Index/Block/Adminhtml/Process/Edit.php | 4 ++ .../Block/Adminhtml/Process/Edit/Tabs.php | 3 + .../Block/Catalog/Product/View/Profile.php | 1 + .../core/Mage/Paypal/Model/Payflowlink.php | 3 + .../core/Mage/Paypal/Model/Payflowpro.php | 1 + .../Mage/Sales/Model/Billing/Agreement.php | 4 +- .../Block/Customer/Wishlist/Item/Column.php | 3 +- 15 files changed, 39 insertions(+), 94 deletions(-) diff --git a/.github/phpstan-baseline.neon b/.github/phpstan-baseline.neon index 039c597a785..fc20ced1525 100644 --- a/.github/phpstan-baseline.neon +++ b/.github/phpstan-baseline.neon @@ -280,11 +280,6 @@ parameters: count: 1 path: ../app/code/core/Mage/Adminhtml/Block/Report/Sales/Coupons/Grid.php - - - message: "#^Method Mage_Adminhtml_Block_Review_Grid_Renderer_Type\\:\\:render\\(\\) should return string but return statement is missing\\.$#" - count: 1 - path: ../app/code/core/Mage/Adminhtml/Block/Review/Grid/Renderer/Type.php - - message: "#^Undefined variable\\: \\$info$#" count: 1 @@ -500,11 +495,6 @@ parameters: count: 1 path: ../app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Number.php - - - message: "#^Method Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Options\\:\\:render\\(\\) should return string but return statement is missing\\.$#" - count: 1 - path: ../app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Options.php - - message: "#^Call to an undefined method Mage_Adminhtml_Block_Widget_Tab_Interface\\:\\:getSkipGenerateContent\\(\\)\\.$#" count: 1 @@ -615,11 +605,6 @@ parameters: count: 1 path: ../app/code/core/Mage/Adminhtml/controllers/Catalog/SearchController.php - - - message: "#^Method Mage_Adminhtml_CustomerController\\:\\:cartAction\\(\\) should return string but return statement is missing\\.$#" - count: 1 - path: ../app/code/core/Mage/Adminhtml/controllers/CustomerController.php - - message: "#^Call to an undefined method Varien_Simplexml_Element\\:\\:getClassName\\(\\)\\.$#" count: 1 @@ -1230,11 +1215,6 @@ parameters: count: 2 path: ../app/code/core/Mage/Catalog/Model/Api/Resource.php - - - message: "#^Method Mage_Catalog_Model_Api2_Product_Image_Rest_Admin_V1\\:\\:_create\\(\\) should return string but return statement is missing\\.$#" - count: 1 - path: ../app/code/core/Mage/Catalog/Model/Api2/Product/Image/Rest/Admin/V1.php - - message: "#^Call to an undefined method Mage_Core_Model_Abstract\\:\\:toOptionArray\\(\\)\\.$#" count: 1 @@ -1420,11 +1400,6 @@ parameters: count: 1 path: ../app/code/core/Mage/Catalog/Model/Product/Option/Type/File.php - - - message: "#^Method Mage_Catalog_Model_Product_Option_Type_File\\:\\:getCustomizedView\\(\\) should return string but return statement is missing\\.$#" - count: 1 - path: ../app/code/core/Mage/Catalog/Model/Product/Option/Type/File.php - - message: "#^Variable \\$value in isset\\(\\) always exists and is not nullable\\.$#" count: 1 @@ -1785,11 +1760,6 @@ parameters: count: 1 path: ../app/code/core/Mage/Checkout/Block/Cart/Item/Renderer/Configurable.php - - - message: "#^Method Mage_Checkout_Block_Onepage_Payment_Methods\\:\\:getMethodLabelAfterHtml\\(\\) should return string but return statement is missing\\.$#" - count: 1 - path: ../app/code/core/Mage/Checkout/Block/Onepage/Payment/Methods.php - - message: "#^Call to an undefined method Mage_Sales_Model_Service_Order\\:\\:register\\(\\)\\.$#" count: 1 @@ -2075,11 +2045,6 @@ parameters: count: 1 path: ../app/code/core/Mage/Core/functions.php - - - message: "#^Function mageDebugBacktrace\\(\\) should return string but return statement is missing\\.$#" - count: 1 - path: ../app/code/core/Mage/Core/functions.php - - message: "#^Variable \\$arguments might not be defined\\.$#" count: 1 @@ -2715,11 +2680,6 @@ parameters: count: 3 path: ../app/code/core/Mage/ImportExport/Model/Import/Entity/Product/Type/Grouped.php - - - message: "#^Method Mage_Index_Block_Adminhtml_Process_Edit\\:\\:getHeaderText\\(\\) should return string but return statement is missing\\.$#" - count: 1 - path: ../app/code/core/Mage/Index/Block/Adminhtml/Process/Edit.php - - message: "#^Method Mage_Core_Model_Resource\\:\\:getConnection\\(\\) invoked with 2 parameters, 1 required\\.$#" count: 1 @@ -2855,11 +2815,6 @@ parameters: count: 1 path: ../app/code/core/Mage/Paygate/controllers/Authorizenet/PaymentController.php - - - message: "#^Method Mage_Payment_Block_Catalog_Product_View_Profile\\:\\:getDateHtml\\(\\) should return string but return statement is missing\\.$#" - count: 1 - path: ../app/code/core/Mage/Payment/Block/Catalog/Product/View/Profile.php - - message: "#^Call to an undefined method Mage_Core_Model_Abstract\\:\\:isAvailable\\(\\)\\.$#" count: 1 @@ -3185,16 +3140,6 @@ parameters: count: 1 path: ../app/code/core/Mage/Paypal/Model/Observer.php - - - message: "#^Method Mage_Paypal_Model_Payflowlink\\:\\:_getTrxTokenType\\(\\) should return string but return statement is missing\\.$#" - count: 1 - path: ../app/code/core/Mage/Paypal/Model/Payflowlink.php - - - - message: "#^Method Mage_Paypal_Model_Payflowlink\\:\\:initialize\\(\\) should return \\$this\\(Mage_Paypal_Model_Payflowlink\\) but return statement is missing\\.$#" - count: 1 - path: ../app/code/core/Mage/Paypal/Model/Payflowlink.php - - message: "#^Variable \\$order in empty\\(\\) always exists and is not falsy\\.$#" count: 1 @@ -3220,11 +3165,6 @@ parameters: count: 1 path: ../app/code/core/Mage/Paypal/Model/Payflowpro.php - - - message: "#^Method Mage_Paypal_Model_Payflowpro\\:\\:getConfigPaymentAction\\(\\) should return string but return statement is missing\\.$#" - count: 1 - path: ../app/code/core/Mage/Paypal/Model/Payflowpro.php - - message: "#^Variable \\$order in empty\\(\\) always exists and is not falsy\\.$#" count: 1 @@ -3440,11 +3380,6 @@ parameters: count: 1 path: ../app/code/core/Mage/Sales/Block/Order/Details.php - - - message: "#^Method Mage_Sales_Model_Billing_Agreement\\:\\:getStatusLabel\\(\\) should return string but return statement is missing\\.$#" - count: 1 - path: ../app/code/core/Mage/Sales/Model/Billing/Agreement.php - - message: "#^Call to an undefined method Varien_Simplexml_Element\\:\\:getClassName\\(\\)\\.$#" count: 1 @@ -3875,11 +3810,6 @@ parameters: count: 1 path: ../app/code/core/Mage/Widget/Model/Widget/Instance.php - - - message: "#^Method Mage_Wishlist_Block_Customer_Wishlist_Item_Column\\:\\:_beforeChildToHtml\\(\\) should return string but return statement is missing\\.$#" - count: 1 - path: ../app/code/core/Mage/Wishlist/Block/Customer/Wishlist/Item/Column.php - - message: "#^Method Mage_Wishlist_Model_Item\\:\\:save\\(\\) should return \\$this\\(Mage_Wishlist_Model_Item\\) but return statement is missing\\.$#" count: 1 diff --git a/app/code/core/Mage/Adminhtml/Block/Review/Grid/Renderer/Type.php b/app/code/core/Mage/Adminhtml/Block/Review/Grid/Renderer/Type.php index 66d21a55589..f61dc3f0e0b 100644 --- a/app/code/core/Mage/Adminhtml/Block/Review/Grid/Renderer/Type.php +++ b/app/code/core/Mage/Adminhtml/Block/Review/Grid/Renderer/Type.php @@ -27,17 +27,23 @@ */ class Mage_Adminhtml_Block_Review_Grid_Renderer_Type extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract { + /** + * @param Mage_Catalog_Model_Product $row + * @return string + */ public function render(Varien_Object $row) { if (is_null($row->getCustomerId())) { if ($row->getStoreId() == Mage_Core_Model_App::ADMIN_STORE_ID) { return Mage::helper('review')->__('Administrator'); - } else { - return Mage::helper('review')->__('Guest'); } - } elseif ($row->getCustomerId() > 0) { + return Mage::helper('review')->__('Guest'); + } + + if ($row->getCustomerId() > 0) { return Mage::helper('review')->__('Customer'); } - //return ($row->getCustomerId() ? Mage::helper('review')->__('Customer') : Mage::helper('review')->__('Guest')); + + return ''; } } diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Options.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Options.php index a141e184c76..5c1d927d6b0 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Options.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Options.php @@ -57,5 +57,6 @@ public function render(Varien_Object $row) return $this->escapeHtml($value); } } + return ''; } } diff --git a/app/code/core/Mage/Adminhtml/controllers/CustomerController.php b/app/code/core/Mage/Adminhtml/controllers/CustomerController.php index f0bfcf93cd1..a91cc439e5c 100644 --- a/app/code/core/Mage/Adminhtml/controllers/CustomerController.php +++ b/app/code/core/Mage/Adminhtml/controllers/CustomerController.php @@ -44,6 +44,11 @@ public function preDispatch() return parent::preDispatch(); } + /** + * @param string $idFieldName + * @return $this + * @throws Mage_Core_Exception + */ protected function _initCustomer($idFieldName = 'id') { $this->_title($this->__('Customers'))->_title($this->__('Manage Customers')); @@ -134,7 +139,7 @@ public function editAction() $addressForm->setFormCode('adminhtml_customer_address'); foreach (array_keys($data['address']) as $addressId) { - if ($addressId == '_template_') { + if ($addressId === '_template_') { continue; } @@ -335,7 +340,7 @@ public function saveAction() $customer->setPassword($data['account']['password']); $customer->setPasswordCreatedAt(time()); $customer->setForceConfirmed(true); - if ($customer->getPassword() == 'auto') { + if ($customer->getPassword() === 'auto') { $sendPassToEmail = true; $customer->setPassword($customer->generatePassword()); } @@ -361,7 +366,7 @@ public function saveAction() if (!empty($data['account']['new_password'])) { $newPassword = trim($data['account']['new_password']); - if ($newPassword == 'auto') { + if ($newPassword === 'auto') { $newPassword = $customer->generatePassword(); } else { $minPasswordLength = Mage::getModel('customer/customer')->getMinPasswordLength(); @@ -446,7 +451,6 @@ protected function _sendUploadResponse($fileName, $content, $contentType='applic /** * Customer orders grid - * */ public function ordersAction() { $this->_initCustomer(); @@ -456,7 +460,6 @@ public function ordersAction() { /** * Customer last orders grid for ajax - * */ public function lastOrdersAction() { $this->_initCustomer(); @@ -466,7 +469,6 @@ public function lastOrdersAction() { /** * Customer newsletter grid - * */ public function newsletterAction() { @@ -504,7 +506,6 @@ public function wishlistAction() /** * Customer last view wishlist for ajax - * */ public function viewWishlistAction() { @@ -515,8 +516,6 @@ public function viewWishlistAction() /** * [Handle and then] get a cart grid contents - * - * @return string */ public function cartAction() { @@ -543,7 +542,6 @@ public function cartAction() /** * Get shopping cart to view only - * */ public function viewCartAction() { @@ -557,7 +555,6 @@ public function viewCartAction() /** * Get shopping carts from all websites for specified client - * */ public function cartsAction() { @@ -568,7 +565,6 @@ public function cartsAction() /** * Get customer's product reviews list - * */ public function productReviewsAction() { @@ -583,7 +579,6 @@ public function productReviewsAction() /** * Get customer's tags list - * */ public function productTagsAction() { @@ -660,7 +655,7 @@ public function validateAction() $addressForm = Mage::getModel('customer/form'); $addressForm->setFormCode('adminhtml_customer_address')->ignoreInvisible(false); foreach (array_keys($addressesData) as $index) { - if ($index == '_template_') { + if ($index === '_template_') { continue; } $address = $customer->getAddressItemById($index); diff --git a/app/code/core/Mage/Catalog/Model/Api2/Product/Image/Rest/Admin/V1.php b/app/code/core/Mage/Catalog/Model/Api2/Product/Image/Rest/Admin/V1.php index aa4148def29..27d6547ed1c 100644 --- a/app/code/core/Mage/Catalog/Model/Api2/Product/Image/Rest/Admin/V1.php +++ b/app/code/core/Mage/Catalog/Model/Api2/Product/Image/Rest/Admin/V1.php @@ -32,7 +32,7 @@ class Mage_Catalog_Model_Api2_Product_Image_Rest_Admin_V1 extends Mage_Catalog_M * * @throws Mage_Api2_Exception * @param array $data - * @return string + * @return string|void */ protected function _create(array $data) { diff --git a/app/code/core/Mage/Catalog/Model/Product/Option/Type/File.php b/app/code/core/Mage/Catalog/Model/Product/Option/Type/File.php index 45118572aaf..24968b8e4c2 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Option/Type/File.php +++ b/app/code/core/Mage/Catalog/Model/Product/Option/Type/File.php @@ -60,6 +60,7 @@ public function getCustomizedView($optionInfo) } catch (Exception $e) { return $optionInfo['value']; } + return ''; } /** diff --git a/app/code/core/Mage/Checkout/Block/Onepage/Payment/Methods.php b/app/code/core/Mage/Checkout/Block/Onepage/Payment/Methods.php index 489b13e9190..99755fb83be 100644 --- a/app/code/core/Mage/Checkout/Block/Onepage/Payment/Methods.php +++ b/app/code/core/Mage/Checkout/Block/Onepage/Payment/Methods.php @@ -94,5 +94,6 @@ public function getMethodLabelAfterHtml(Mage_Payment_Model_Method_Abstract $meth if ($form = $this->getChild('payment.method.' . $method->getCode())) { return $form->getMethodLabelAfterHtml(); } + return ''; } } diff --git a/app/code/core/Mage/Core/functions.php b/app/code/core/Mage/Core/functions.php index 5e05bde7ecb..4c3a13bdbcc 100644 --- a/app/code/core/Mage/Core/functions.php +++ b/app/code/core/Mage/Core/functions.php @@ -201,7 +201,7 @@ function mageCoreErrorHandler($errno, $errstr, $errfile, $errline) * @param bool $return * @param bool $html * @param bool $showFirst - * @return string + * @return string|void */ function mageDebugBacktrace($return = false, $html = true, $showFirst = false) { diff --git a/app/code/core/Mage/Index/Block/Adminhtml/Process/Edit.php b/app/code/core/Mage/Index/Block/Adminhtml/Process/Edit.php index 8950852d45c..78f9a63d6ce 100644 --- a/app/code/core/Mage/Index/Block/Adminhtml/Process/Edit.php +++ b/app/code/core/Mage/Index/Block/Adminhtml/Process/Edit.php @@ -25,6 +25,9 @@ */ class Mage_Index_Block_Adminhtml_Process_Edit extends Mage_Adminhtml_Block_Widget_Form_Container { + /** + * Mage_Index_Block_Adminhtml_Process_Edit constructor. + */ public function __construct() { $this->_objectId = 'process_id'; @@ -75,5 +78,6 @@ public function getHeaderText() if ($process && $process->getId()) { return Mage::helper('index')->__("'%s' Index Process Information", $process->getIndexer()->getName()); } + return ''; } } diff --git a/app/code/core/Mage/Index/Block/Adminhtml/Process/Edit/Tabs.php b/app/code/core/Mage/Index/Block/Adminhtml/Process/Edit/Tabs.php index 7abc4cd151a..c645ba19670 100644 --- a/app/code/core/Mage/Index/Block/Adminhtml/Process/Edit/Tabs.php +++ b/app/code/core/Mage/Index/Block/Adminhtml/Process/Edit/Tabs.php @@ -25,6 +25,9 @@ */ class Mage_Index_Block_Adminhtml_Process_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs { + /** + * Mage_Index_Block_Adminhtml_Process_Edit_Tabs constructor. + */ public function __construct() { parent::__construct(); diff --git a/app/code/core/Mage/Payment/Block/Catalog/Product/View/Profile.php b/app/code/core/Mage/Payment/Block/Catalog/Product/View/Profile.php index 36132a41e56..659c1a631f0 100644 --- a/app/code/core/Mage/Payment/Block/Catalog/Product/View/Profile.php +++ b/app/code/core/Mage/Payment/Block/Catalog/Product/View/Profile.php @@ -73,6 +73,7 @@ public function getDateHtml() ->setTime(true); return $calendar->getHtml(); } + return ''; } /** diff --git a/app/code/core/Mage/Paypal/Model/Payflowlink.php b/app/code/core/Mage/Paypal/Model/Payflowlink.php index 26a4c31db15..1008ff1d85d 100644 --- a/app/code/core/Mage/Paypal/Model/Payflowlink.php +++ b/app/code/core/Mage/Paypal/Model/Payflowlink.php @@ -158,6 +158,7 @@ public function getTemplate() * * @param string $paymentAction * @param Varien_Object $stateObject + * @return $this */ public function initialize($paymentAction, $stateObject) { @@ -184,6 +185,7 @@ public function initialize($paymentAction, $stateObject) default: break; } + return $this; } /** @@ -487,6 +489,7 @@ protected function _getTrxTokenType() case Mage_Paypal_Model_Config::PAYMENT_ACTION_SALE: return self::TRXTYPE_SALE; } + return ''; } /** diff --git a/app/code/core/Mage/Paypal/Model/Payflowpro.php b/app/code/core/Mage/Paypal/Model/Payflowpro.php index a3a09b5b46a..2aa78b659c9 100644 --- a/app/code/core/Mage/Paypal/Model/Payflowpro.php +++ b/app/code/core/Mage/Paypal/Model/Payflowpro.php @@ -138,6 +138,7 @@ public function getConfigPaymentAction() case Mage_Paypal_Model_Config::PAYMENT_ACTION_SALE: return Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE; } + return ''; } /** diff --git a/app/code/core/Mage/Sales/Model/Billing/Agreement.php b/app/code/core/Mage/Sales/Model/Billing/Agreement.php index 95c1ccb8365..f576960556f 100644 --- a/app/code/core/Mage/Sales/Model/Billing/Agreement.php +++ b/app/code/core/Mage/Sales/Model/Billing/Agreement.php @@ -69,7 +69,6 @@ class Mage_Sales_Model_Billing_Agreement extends Mage_Payment_Model_Billing_Agre /** * Init model - * */ protected function _construct() { @@ -79,7 +78,7 @@ protected function _construct() /** * Set created_at parameter * - * @return Mage_Core_Model_Abstract + * @inheritdoc */ protected function _beforeSave() { @@ -118,6 +117,7 @@ public function getStatusLabel() case self::STATUS_CANCELED: return Mage::helper('sales')->__('Canceled'); } + return ''; } /** diff --git a/app/code/core/Mage/Wishlist/Block/Customer/Wishlist/Item/Column.php b/app/code/core/Mage/Wishlist/Block/Customer/Wishlist/Item/Column.php index 7a471736034..c9ff7037277 100644 --- a/app/code/core/Mage/Wishlist/Block/Customer/Wishlist/Item/Column.php +++ b/app/code/core/Mage/Wishlist/Block/Customer/Wishlist/Item/Column.php @@ -30,7 +30,7 @@ class Mage_Wishlist_Block_Customer_Wishlist_Item_Column extends Mage_Wishlist_Bl /** * Checks whether column should be shown in table * - * @return bool + * @return true */ public function isEnabled() { @@ -55,7 +55,6 @@ protected function _toHtml() * * @param string $name * @param Mage_Core_Block_Abstract $child - * @return string */ protected function _beforeChildToHtml($name, $child) {