Skip to content

Commit 97e0b70

Browse files
authored
Added some return statements to match parent class or interface (#2574)
* Added $this as return in Mage_Adminhtml_Helper_Catalog_Product_Composite * Added $this as return for afterLoad() * Added $this as return for beforeSave() * Fixed "should return string but return statement is missing"
1 parent 811cc5a commit 97e0b70

File tree

26 files changed

+68
-161
lines changed

26 files changed

+68
-161
lines changed

.github/phpstan-baseline.neon

Lines changed: 0 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -280,11 +280,6 @@ parameters:
280280
count: 1
281281
path: ../app/code/core/Mage/Adminhtml/Block/Report/Sales/Coupons/Grid.php
282282

283-
-
284-
message: "#^Method Mage_Adminhtml_Block_Review_Grid_Renderer_Type\\:\\:render\\(\\) should return string but return statement is missing\\.$#"
285-
count: 1
286-
path: ../app/code/core/Mage/Adminhtml/Block/Review/Grid/Renderer/Type.php
287-
288283
-
289284
message: "#^Undefined variable\\: \\$info$#"
290285
count: 1
@@ -500,11 +495,6 @@ parameters:
500495
count: 1
501496
path: ../app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Number.php
502497

503-
-
504-
message: "#^Method Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Options\\:\\:render\\(\\) should return string but return statement is missing\\.$#"
505-
count: 1
506-
path: ../app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Options.php
507-
508498
-
509499
message: "#^Call to an undefined method Mage_Adminhtml_Block_Widget_Tab_Interface\\:\\:getSkipGenerateContent\\(\\)\\.$#"
510500
count: 1
@@ -530,16 +520,6 @@ parameters:
530520
count: 1
531521
path: ../app/code/core/Mage/Adminhtml/Block/Widget/Tabs.php
532522

533-
-
534-
message: "#^Method Mage_Adminhtml_Helper_Catalog_Product_Composite\\:\\:renderConfigureResult\\(\\) should return \\$this\\(Mage_Adminhtml_Helper_Catalog_Product_Composite\\) but return statement is missing\\.$#"
535-
count: 1
536-
path: ../app/code/core/Mage/Adminhtml/Helper/Catalog/Product/Composite.php
537-
538-
-
539-
message: "#^Method Mage_Adminhtml_Helper_Catalog_Product_Composite\\:\\:renderUpdateResult\\(\\) should return \\$this\\(Mage_Adminhtml_Helper_Catalog_Product_Composite\\) but return statement is missing\\.$#"
540-
count: 1
541-
path: ../app/code/core/Mage/Adminhtml/Helper/Catalog/Product/Composite.php
542-
543523
-
544524
message: "#^Method Mage_Adminhtml_Model_Config\\:\\:getSection\\(\\) should return Varien_Simplexml_Element but return statement is missing\\.$#"
545525
count: 1
@@ -585,16 +565,6 @@ parameters:
585565
count: 1
586566
path: ../app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Catalog/Search/Type.php
587567

588-
-
589-
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\\.$#"
590-
count: 1
591-
path: ../app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Encrypted.php
592-
593-
-
594-
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\\.$#"
595-
count: 1
596-
path: ../app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Serialized.php
597-
598568
-
599569
message: "#^Comparison operation \"\\=\\=\" between \\(Varien_Simplexml_Element\\|null\\) and 1 results in an error\\.$#"
600570
count: 1
@@ -635,11 +605,6 @@ parameters:
635605
count: 1
636606
path: ../app/code/core/Mage/Adminhtml/controllers/Catalog/SearchController.php
637607

638-
-
639-
message: "#^Method Mage_Adminhtml_CustomerController\\:\\:cartAction\\(\\) should return string but return statement is missing\\.$#"
640-
count: 1
641-
path: ../app/code/core/Mage/Adminhtml/controllers/CustomerController.php
642-
643608
-
644609
message: "#^Call to an undefined method Varien_Simplexml_Element\\:\\:getClassName\\(\\)\\.$#"
645610
count: 1
@@ -1250,11 +1215,6 @@ parameters:
12501215
count: 2
12511216
path: ../app/code/core/Mage/Catalog/Model/Api/Resource.php
12521217

1253-
-
1254-
message: "#^Method Mage_Catalog_Model_Api2_Product_Image_Rest_Admin_V1\\:\\:_create\\(\\) should return string but return statement is missing\\.$#"
1255-
count: 1
1256-
path: ../app/code/core/Mage/Catalog/Model/Api2/Product/Image/Rest/Admin/V1.php
1257-
12581218
-
12591219
message: "#^Call to an undefined method Mage_Core_Model_Abstract\\:\\:toOptionArray\\(\\)\\.$#"
12601220
count: 1
@@ -1395,16 +1355,6 @@ parameters:
13951355
count: 1
13961356
path: ../app/code/core/Mage/Catalog/Model/Product/Attribute/Api.php
13971357

1398-
-
1399-
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\\.$#"
1400-
count: 1
1401-
path: ../app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Media.php
1402-
1403-
-
1404-
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\\.$#"
1405-
count: 1
1406-
path: ../app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Recurring.php
1407-
14081358
-
14091359
message: "#^Cannot call method getBackend\\(\\) on bool\\|Mage_Catalog_Model_Resource_Attribute\\.$#"
14101360
count: 11
@@ -1450,11 +1400,6 @@ parameters:
14501400
count: 1
14511401
path: ../app/code/core/Mage/Catalog/Model/Product/Option/Type/File.php
14521402

1453-
-
1454-
message: "#^Method Mage_Catalog_Model_Product_Option_Type_File\\:\\:getCustomizedView\\(\\) should return string but return statement is missing\\.$#"
1455-
count: 1
1456-
path: ../app/code/core/Mage/Catalog/Model/Product/Option/Type/File.php
1457-
14581403
-
14591404
message: "#^Variable \\$value in isset\\(\\) always exists and is not nullable\\.$#"
14601405
count: 1
@@ -1755,11 +1700,6 @@ parameters:
17551700
count: 1
17561701
path: ../app/code/core/Mage/CatalogInventory/Model/Stock/Item.php
17571702

1758-
-
1759-
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\\.$#"
1760-
count: 1
1761-
path: ../app/code/core/Mage/CatalogInventory/Model/System/Config/Backend/Minsaleqty.php
1762-
17631703
-
17641704
message: "#^Variable \\$gId might not be defined\\.$#"
17651705
count: 1
@@ -1820,11 +1760,6 @@ parameters:
18201760
count: 1
18211761
path: ../app/code/core/Mage/Checkout/Block/Cart/Item/Renderer/Configurable.php
18221762

1823-
-
1824-
message: "#^Method Mage_Checkout_Block_Onepage_Payment_Methods\\:\\:getMethodLabelAfterHtml\\(\\) should return string but return statement is missing\\.$#"
1825-
count: 1
1826-
path: ../app/code/core/Mage/Checkout/Block/Onepage/Payment/Methods.php
1827-
18281763
-
18291764
message: "#^Call to an undefined method Mage_Sales_Model_Service_Order\\:\\:register\\(\\)\\.$#"
18301765
count: 1
@@ -1985,11 +1920,6 @@ parameters:
19851920
count: 1
19861921
path: ../app/code/core/Mage/Core/Model/Config.php
19871922

1988-
-
1989-
message: "#^Method Mage_Core_Model_Config_Data\\:\\:afterLoad\\(\\) should return \\$this\\(Mage_Core_Model_Config_Data\\) but return statement is missing\\.$#"
1990-
count: 1
1991-
path: ../app/code/core/Mage/Core/Model/Config/Data.php
1992-
19931923
-
19941924
message: "#^Binary operation \"\\+\" between string and string results in an error\\.$#"
19951925
count: 1
@@ -2115,11 +2045,6 @@ parameters:
21152045
count: 1
21162046
path: ../app/code/core/Mage/Core/functions.php
21172047

2118-
-
2119-
message: "#^Function mageDebugBacktrace\\(\\) should return string but return statement is missing\\.$#"
2120-
count: 1
2121-
path: ../app/code/core/Mage/Core/functions.php
2122-
21232048
-
21242049
message: "#^Variable \\$arguments might not be defined\\.$#"
21252050
count: 1
@@ -2180,11 +2105,6 @@ parameters:
21802105
count: 1
21812106
path: ../app/code/core/Mage/Customer/Model/Customer.php
21822107

2183-
-
2184-
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\\.$#"
2185-
count: 1
2186-
path: ../app/code/core/Mage/Customer/Model/Customer/Attribute/Backend/Password.php
2187-
21882108
-
21892109
message: "#^Cannot call method addAttributeToSelect\\(\\) on Mage_Core_Model_Resource_Db_Collection_Abstract\\|false\\.$#"
21902110
count: 1
@@ -2580,16 +2500,6 @@ parameters:
25802500
count: 2
25812501
path: ../app/code/core/Mage/Eav/Model/Resource/Form/Type.php
25822502

2583-
-
2584-
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\\.$#"
2585-
count: 1
2586-
path: ../app/code/core/Mage/GiftMessage/Model/Entity/Attribute/Backend/Boolean/Config.php
2587-
2588-
-
2589-
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\\.$#"
2590-
count: 1
2591-
path: ../app/code/core/Mage/GiftMessage/Model/Entity/Attribute/Backend/Boolean/Config.php
2592-
25932503
-
25942504
message: "#^Call to an undefined method Mage_Eav_Model_Entity_Abstract\\:\\:setGiftMessageId\\(\\)\\.$#"
25952505
count: 1
@@ -2770,11 +2680,6 @@ parameters:
27702680
count: 3
27712681
path: ../app/code/core/Mage/ImportExport/Model/Import/Entity/Product/Type/Grouped.php
27722682

2773-
-
2774-
message: "#^Method Mage_Index_Block_Adminhtml_Process_Edit\\:\\:getHeaderText\\(\\) should return string but return statement is missing\\.$#"
2775-
count: 1
2776-
path: ../app/code/core/Mage/Index/Block/Adminhtml/Process/Edit.php
2777-
27782683
-
27792684
message: "#^Method Mage_Core_Model_Resource\\:\\:getConnection\\(\\) invoked with 2 parameters, 1 required\\.$#"
27802685
count: 1
@@ -2910,11 +2815,6 @@ parameters:
29102815
count: 1
29112816
path: ../app/code/core/Mage/Paygate/controllers/Authorizenet/PaymentController.php
29122817

2913-
-
2914-
message: "#^Method Mage_Payment_Block_Catalog_Product_View_Profile\\:\\:getDateHtml\\(\\) should return string but return statement is missing\\.$#"
2915-
count: 1
2916-
path: ../app/code/core/Mage/Payment/Block/Catalog/Product/View/Profile.php
2917-
29182818
-
29192819
message: "#^Call to an undefined method Mage_Core_Model_Abstract\\:\\:isAvailable\\(\\)\\.$#"
29202820
count: 1
@@ -3240,16 +3140,6 @@ parameters:
32403140
count: 1
32413141
path: ../app/code/core/Mage/Paypal/Model/Observer.php
32423142

3243-
-
3244-
message: "#^Method Mage_Paypal_Model_Payflowlink\\:\\:_getTrxTokenType\\(\\) should return string but return statement is missing\\.$#"
3245-
count: 1
3246-
path: ../app/code/core/Mage/Paypal/Model/Payflowlink.php
3247-
3248-
-
3249-
message: "#^Method Mage_Paypal_Model_Payflowlink\\:\\:initialize\\(\\) should return \\$this\\(Mage_Paypal_Model_Payflowlink\\) but return statement is missing\\.$#"
3250-
count: 1
3251-
path: ../app/code/core/Mage/Paypal/Model/Payflowlink.php
3252-
32533143
-
32543144
message: "#^Variable \\$order in empty\\(\\) always exists and is not falsy\\.$#"
32553145
count: 1
@@ -3275,11 +3165,6 @@ parameters:
32753165
count: 1
32763166
path: ../app/code/core/Mage/Paypal/Model/Payflowpro.php
32773167

3278-
-
3279-
message: "#^Method Mage_Paypal_Model_Payflowpro\\:\\:getConfigPaymentAction\\(\\) should return string but return statement is missing\\.$#"
3280-
count: 1
3281-
path: ../app/code/core/Mage/Paypal/Model/Payflowpro.php
3282-
32833168
-
32843169
message: "#^Variable \\$order in empty\\(\\) always exists and is not falsy\\.$#"
32853170
count: 1
@@ -3310,11 +3195,6 @@ parameters:
33103195
count: 1
33113196
path: ../app/code/core/Mage/Paypal/Model/Standard.php
33123197

3313-
-
3314-
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\\.$#"
3315-
count: 1
3316-
path: ../app/code/core/Mage/Paypal/Model/System/Config/Backend/MerchantCountry.php
3317-
33183198
-
33193199
message: "#^Method Varien_Data_Collection\\:\\:toOptionArray\\(\\) invoked with 1 parameter, 0 required\\.$#"
33203200
count: 1
@@ -3500,11 +3380,6 @@ parameters:
35003380
count: 1
35013381
path: ../app/code/core/Mage/Sales/Block/Order/Details.php
35023382

3503-
-
3504-
message: "#^Method Mage_Sales_Model_Billing_Agreement\\:\\:getStatusLabel\\(\\) should return string but return statement is missing\\.$#"
3505-
count: 1
3506-
path: ../app/code/core/Mage/Sales/Model/Billing/Agreement.php
3507-
35083383
-
35093384
message: "#^Call to an undefined method Varien_Simplexml_Element\\:\\:getClassName\\(\\)\\.$#"
35103385
count: 1
@@ -3640,11 +3515,6 @@ parameters:
36403515
count: 1
36413516
path: ../app/code/core/Mage/Sales/Model/Resource/Order/Address.php
36423517

3643-
-
3644-
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\\.$#"
3645-
count: 1
3646-
path: ../app/code/core/Mage/Sales/Model/Resource/Order/Invoice/Collection.php
3647-
36483518
-
36493519
message: "#^Call to an undefined method Mage_Core_Model_Abstract\\:\\:isFailsafe\\(\\)\\.$#"
36503520
count: 1
@@ -3940,11 +3810,6 @@ parameters:
39403810
count: 1
39413811
path: ../app/code/core/Mage/Widget/Model/Widget/Instance.php
39423812

3943-
-
3944-
message: "#^Method Mage_Wishlist_Block_Customer_Wishlist_Item_Column\\:\\:_beforeChildToHtml\\(\\) should return string but return statement is missing\\.$#"
3945-
count: 1
3946-
path: ../app/code/core/Mage/Wishlist/Block/Customer/Wishlist/Item/Column.php
3947-
39483813
-
39493814
message: "#^Method Mage_Wishlist_Model_Item\\:\\:save\\(\\) should return \\$this\\(Mage_Wishlist_Model_Item\\) but return statement is missing\\.$#"
39503815
count: 1

app/code/core/Mage/Adminhtml/Block/Review/Grid/Renderer/Type.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,23 @@
2727
*/
2828
class Mage_Adminhtml_Block_Review_Grid_Renderer_Type extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
2929
{
30+
/**
31+
* @param Mage_Catalog_Model_Product $row
32+
* @return string
33+
*/
3034
public function render(Varien_Object $row)
3135
{
3236
if (is_null($row->getCustomerId())) {
3337
if ($row->getStoreId() == Mage_Core_Model_App::ADMIN_STORE_ID) {
3438
return Mage::helper('review')->__('Administrator');
35-
} else {
36-
return Mage::helper('review')->__('Guest');
3739
}
38-
} elseif ($row->getCustomerId() > 0) {
40+
return Mage::helper('review')->__('Guest');
41+
}
42+
43+
if ($row->getCustomerId() > 0) {
3944
return Mage::helper('review')->__('Customer');
4045
}
41-
//return ($row->getCustomerId() ? Mage::helper('review')->__('Customer') : Mage::helper('review')->__('Guest'));
46+
47+
return '';
4248
}
4349
}

app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Options.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,6 @@ public function render(Varien_Object $row)
5757
return $this->escapeHtml($value);
5858
}
5959
}
60+
return '';
6061
}
6162
}

app/code/core/Mage/Adminhtml/Helper/Catalog/Product/Composite.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public function renderUpdateResult($controller, Varien_Object $updateResult)
5555

5656
$this->_initUpdateResultLayout($controller);
5757
$controller->renderLayout();
58+
return $this;
5859
}
5960

6061
/**
@@ -142,5 +143,6 @@ public function renderConfigureResult($controller, Varien_Object $configureResul
142143

143144
$this->_initConfigureResultLayout($controller, $isOk, $productType);
144145
$controller->renderLayout();
146+
return $this;
145147
}
146148
}

app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Encrypted.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ class Mage_Adminhtml_Model_System_Config_Backend_Encrypted extends Mage_Core_Mod
2929
{
3030
/**
3131
* Decrypt value after loading
32-
*
3332
*/
3433
protected function _afterLoad()
3534
{
3635
$value = (string)$this->getValue();
3736
if (!empty($value) && ($decrypted = Mage::helper('core')->decrypt($value))) {
3837
$this->setValue($decrypted);
3938
}
39+
return $this;
4040
}
4141

4242
/**

app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Serialized.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
*/
2626
class Mage_Adminhtml_Model_System_Config_Backend_Serialized extends Mage_Core_Model_Config_Data
2727
{
28+
/**
29+
* @return $this
30+
*/
2831
protected function _afterLoad()
2932
{
3033
if (!is_array($this->getValue())) {
@@ -40,6 +43,7 @@ protected function _afterLoad()
4043
}
4144
$this->setValue($unserializedValue);
4245
}
46+
return $this;
4347
}
4448

4549
/**

0 commit comments

Comments
 (0)