Skip to content

Commit ba9ffe0

Browse files
authored
Fixed Mage_Core_Block_Abstract and more docblock (#2412)
1 parent cf481db commit ba9ffe0

File tree

35 files changed

+242
-267
lines changed

35 files changed

+242
-267
lines changed

.github/phpstan-baseline.neon

Lines changed: 0 additions & 155 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@ parameters:
4545
count: 2
4646
path: ../app/code/core/Mage/Adminhtml/Block/Api/User/Edit/Tab/Roles.php
4747

48-
-
49-
message: "#^Cannot call method addJs\\(\\) on Mage_Core_Block_Abstract\\|false\\.$#"
50-
count: 1
51-
path: ../app/code/core/Mage/Adminhtml/Block/Backup/Dialogs.php
52-
5348
-
5449
message: "#^Method Mage_Adminhtml_Block_Widget_Grid\\:\\:setDefaultSort\\(\\) invoked with 2 parameters, 1 required\\.$#"
5550
count: 1
@@ -70,11 +65,6 @@ parameters:
7065
count: 1
7166
path: ../app/code/core/Mage/Adminhtml/Block/Catalog/Category/Widget/Chooser.php
7267

73-
-
74-
message: "#^Cannot call method addFieldMap\\(\\) on Mage_Core_Block_Abstract\\|false\\.$#"
75-
count: 1
76-
path: ../app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/Main.php
77-
7868
-
7969
message: "#^Method Mage_Adminhtml_Block_Widget_Grid\\:\\:addColumn\\(\\) invoked with 3 parameters, 2 required\\.$#"
8070
count: 1
@@ -120,11 +110,6 @@ parameters:
120110
count: 1
121111
path: ../app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute/Tab/Attributes.php
122112

123-
-
124-
message: "#^Call to an undefined method Mage_Core_Block_Abstract\\:\\:addItem\\(\\)\\.$#"
125-
count: 2
126-
path: ../app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Alerts.php
127-
128113
-
129114
message: "#^Call to an undefined method Varien_Data_Collection\\:\\:addFieldToFilter\\(\\)\\.$#"
130115
count: 2
@@ -430,11 +415,6 @@ parameters:
430415
count: 1
431416
path: ../app/code/core/Mage/Adminhtml/Block/Notification/Grid/Renderer/Severity.php
432417

433-
-
434-
message: "#^Call to an undefined method Mage_Core_Block_Abstract\\:\\:canShow\\(\\)\\.$#"
435-
count: 1
436-
path: ../app/code/core/Mage/Adminhtml/Block/Notification/Toolbar.php
437-
438418
-
439419
message: "#^Access to an undefined property Mage_Adminhtml_Block_Notification_Window\\:\\:\\$_aclResourcePath\\.$#"
440420
count: 1
@@ -495,11 +475,6 @@ parameters:
495475
count: 1
496476
path: ../app/code/core/Mage/Adminhtml/Block/Poll/Grid.php
497477

498-
-
499-
message: "#^Cannot call method addFieldMap\\(\\) on Mage_Core_Block_Abstract\\|false\\.$#"
500-
count: 1
501-
path: ../app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Main.php
502-
503478
-
504479
message: "#^Call to an undefined method Varien_Data_Collection\\:\\:addFieldToFilter\\(\\)\\.$#"
505480
count: 2
@@ -990,11 +965,6 @@ parameters:
990965
count: 1
991966
path: ../app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Run.php
992967

993-
-
994-
message: "#^Call to an undefined method Mage_Core_Block_Abstract\\:\\:addItem\\(\\)\\.$#"
995-
count: 1
996-
path: ../app/code/core/Mage/Adminhtml/Block/System/Email/Template/Edit/Form.php
997-
998968
-
999969
message: "#^Method Mage_Core_Model_Email_Template\\:\\:getProcessedTemplate\\(\\) invoked with 2 parameters, 0\\-1 required\\.$#"
1000970
count: 1
@@ -1130,11 +1100,6 @@ parameters:
11301100
count: 1
11311101
path: ../app/code/core/Mage/Adminhtml/Block/Tag/Tag/Grid.php
11321102

1133-
-
1134-
message: "#^Cannot call method addFieldMap\\(\\) on Mage_Core_Block_Abstract\\|false\\.$#"
1135-
count: 1
1136-
path: ../app/code/core/Mage/Adminhtml/Block/Tax/Rate/Form.php
1137-
11381103
-
11391104
message: "#^Binary operation \"\\*\" between string and 1 results in an error\\.$#"
11401105
count: 1
@@ -1200,11 +1165,6 @@ parameters:
12001165
count: 1
12011166
path: ../app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Options.php
12021167

1203-
-
1204-
message: "#^Cannot call method createFromConfiguration\\(\\) on Mage_Core_Block_Abstract\\|false\\.$#"
1205-
count: 1
1206-
path: ../app/code/core/Mage/Adminhtml/Block/Widget/Grid/Massaction/Item.php
1207-
12081168
-
12091169
message: "#^Call to an undefined method Mage_Adminhtml_Block_Widget_Tab_Interface\\:\\:getSkipGenerateContent\\(\\)\\.$#"
12101170
count: 1
@@ -1355,11 +1315,6 @@ parameters:
13551315
count: 1
13561316
path: ../app/code/core/Mage/Adminhtml/Model/Url.php
13571317

1358-
-
1359-
message: "#^Cannot call method buildNodeName\\(\\) on Mage_Core_Block_Abstract\\|false\\.$#"
1360-
count: 1
1361-
path: ../app/code/core/Mage/Adminhtml/controllers/Catalog/CategoryController.php
1362-
13631318
-
13641319
message: "#^Method Mage_Adminhtml_Catalog_Product_AttributeController\\:\\:preDispatch\\(\\) should return \\$this\\(Mage_Adminhtml_Catalog_Product_AttributeController\\) but return statement is missing\\.$#"
13651320
count: 1
@@ -1415,21 +1370,6 @@ parameters:
14151370
count: 1
14161371
path: ../app/code/core/Mage/Adminhtml/controllers/Sales/Order/CreditmemoController.php
14171372

1418-
-
1419-
message: "#^Cannot call method updateBackButtonUrl\\(\\) on Mage_Core_Block_Abstract\\|false\\.$#"
1420-
count: 1
1421-
path: ../app/code/core/Mage/Adminhtml/controllers/Sales/Order/CreditmemoController.php
1422-
1423-
-
1424-
message: "#^Parameter \\$order of method Mage_Adminhtml_Sales_Order_CreditmemoController\\:\\:_initInvoice\\(\\) has invalid type unknown_type\\.$#"
1425-
count: 1
1426-
path: ../app/code/core/Mage/Adminhtml/controllers/Sales/Order/CreditmemoController.php
1427-
1428-
-
1429-
message: "#^Cannot call method updateBackButtonUrl\\(\\) on Mage_Core_Block_Abstract\\|false\\.$#"
1430-
count: 1
1431-
path: ../app/code/core/Mage/Adminhtml/controllers/Sales/Order/InvoiceController.php
1432-
14331373
-
14341374
message: "#^Undefined variable\\: \\$shippingResponse$#"
14351375
count: 1
@@ -1440,11 +1380,6 @@ parameters:
14401380
count: 1
14411381
path: ../app/code/core/Mage/Adminhtml/controllers/Sales/Order/InvoiceController.php
14421382

1443-
-
1444-
message: "#^Cannot call method updateBackButtonUrl\\(\\) on Mage_Core_Block_Abstract\\|false\\.$#"
1445-
count: 1
1446-
path: ../app/code/core/Mage/Adminhtml/controllers/Sales/Order/ShipmentController.php
1447-
14481383
-
14491384
message: "#^Method Mage_Adminhtml_Controller_Action\\:\\:_setForcedFormKeyActions\\(\\) invoked with 2 parameters, 1 required\\.$#"
14501385
count: 1
@@ -1455,16 +1390,6 @@ parameters:
14551390
count: 4
14561391
path: ../app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php
14571392

1458-
-
1459-
message: "#^Cannot call method initForm\\(\\) on Mage_Core_Block_Abstract\\|false\\.$#"
1460-
count: 1
1461-
path: ../app/code/core/Mage/Adminhtml/controllers/System/ConfigController.php
1462-
1463-
-
1464-
message: "#^Cannot call method initTabs\\(\\) on Mage_Core_Block_Abstract\\|false\\.$#"
1465-
count: 1
1466-
path: ../app/code/core/Mage/Adminhtml/controllers/System/ConfigController.php
1467-
14681393
-
14691394
message: "#^Method Mage_Adminhtml_System_ConfigController\\:\\:_isSectionAllowed\\(\\) should return bool but return statement is missing\\.$#"
14701395
count: 1
@@ -1535,21 +1460,6 @@ parameters:
15351460
count: 1
15361461
path: ../app/code/core/Mage/Adminhtml/controllers/System/StoreController.php
15371462

1538-
-
1539-
message: "#^Cannot call method assign\\(\\) on Mage_Core_Block_Abstract\\|false\\.$#"
1540-
count: 3
1541-
path: ../app/code/core/Mage/Adminhtml/controllers/Tax/RateController.php
1542-
1543-
-
1544-
message: "#^Method Mage_Adminhtml_Tax_RateController\\:\\:deleteAction\\(\\) should return bool but return statement is missing\\.$#"
1545-
count: 1
1546-
path: ../app/code/core/Mage/Adminhtml/controllers/Tax/RateController.php
1547-
1548-
-
1549-
message: "#^Method Mage_Adminhtml_Tax_RateController\\:\\:saveAction\\(\\) should return bool but return statement is missing\\.$#"
1550-
count: 1
1551-
path: ../app/code/core/Mage/Adminhtml/controllers/Tax/RateController.php
1552-
15531463
-
15541464
message: "#^Method Mage_Directory_Model_Country\\:\\:loadByCode\\(\\) invoked with 2 parameters, 1 required\\.$#"
15551465
count: 1
@@ -2125,21 +2035,11 @@ parameters:
21252035
count: 5
21262036
path: ../app/code/core/Mage/Catalog/Block/Product/View/Options/Abstract.php
21272037

2128-
-
2129-
message: "#^Call to an undefined method Mage_Core_Block_Abstract\\:\\:addOption\\(\\)\\.$#"
2130-
count: 1
2131-
path: ../app/code/core/Mage/Catalog/Block/Product/View/Options/Type/Select.php
2132-
21332038
-
21342039
message: "#^Call to an undefined method Mage_Core_Helper_Abstract\\:\\:currencyByStore\\(\\)\\.$#"
21352040
count: 2
21362041
path: ../app/code/core/Mage/Catalog/Block/Product/View/Options/Type/Select.php
21372042

2138-
-
2139-
message: "#^Method Mage_Catalog_Block_Product_View_Options_Type_Select\\:\\:getValuesHtml\\(\\) should return string but return statement is missing\\.$#"
2140-
count: 1
2141-
path: ../app/code/core/Mage/Catalog/Block/Product/View/Options/Type/Select.php
2142-
21432043
-
21442044
message: "#^Variable \\$class might not be defined\\.$#"
21452045
count: 1
@@ -2210,11 +2110,6 @@ parameters:
22102110
count: 1
22112111
path: ../app/code/core/Mage/Catalog/Helper/Product/Flat.php
22122112

2213-
-
2214-
message: "#^Call to an undefined method Mage_Core_Block_Abstract\\:\\:addBodyClass\\(\\)\\.$#"
2215-
count: 3
2216-
path: ../app/code/core/Mage/Catalog/Helper/Product/View.php
2217-
22182113
-
22192114
message: "#^Cannot call method setStoreId\\(\\) on Mage_Core_Model_Resource_Db_Collection_Abstract\\|false\\.$#"
22202115
count: 1
@@ -2860,11 +2755,6 @@ parameters:
28602755
count: 2
28612756
path: ../app/code/core/Mage/Catalog/Model/Resource/Url.php
28622757

2863-
-
2864-
message: "#^Call to an undefined method Mage_Core_Block_Abstract\\:\\:addBodyClass\\(\\)\\.$#"
2865-
count: 1
2866-
path: ../app/code/core/Mage/Catalog/controllers/CategoryController.php
2867-
28682758
-
28692759
message: "#^Call to an undefined method Mage_CatalogIndex_Model_Resource_Attribute\\:\\:checkCount\\(\\)\\.$#"
28702760
count: 1
@@ -3260,11 +3150,6 @@ parameters:
32603150
count: 2
32613151
path: ../app/code/core/Mage/Checkout/Model/Type/Onepage.php
32623152

3263-
-
3264-
message: "#^Call to an undefined method Mage_Core_Block_Abstract\\:\\:addBodyClass\\(\\)\\.$#"
3265-
count: 1
3266-
path: ../app/code/core/Mage/Cms/Block/Page.php
3267-
32683153
-
32693154
message: "#^Call to an undefined method Mage_Core_Helper_Abstract\\:\\:isEnabled\\(\\)\\.$#"
32703155
count: 1
@@ -3945,11 +3830,6 @@ parameters:
39453830
count: 1
39463831
path: ../app/code/core/Mage/Directory/Model/Resource/Country/Collection.php
39473832

3948-
-
3949-
message: "#^Call to an undefined method Mage_Core_Block_Abstract\\:\\:addItem\\(\\)\\.$#"
3950-
count: 2
3951-
path: ../app/code/core/Mage/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable.php
3952-
39533833
-
39543834
message: "#^Call to an undefined method Mage_Catalog_Model_Product_Type_Abstract\\:\\:getLinks\\(\\)\\.$#"
39553835
count: 1
@@ -4600,16 +4480,6 @@ parameters:
46004480
count: 3
46014481
path: ../app/code/core/Mage/ImportExport/Model/Import/Entity/Product/Type/Grouped.php
46024482

4603-
-
4604-
message: "#^Cannot call method addError\\(\\) on Mage_Core_Block_Abstract\\|false\\.$#"
4605-
count: 1
4606-
path: ../app/code/core/Mage/ImportExport/controllers/Adminhtml/ImportController.php
4607-
4608-
-
4609-
message: "#^Method Mage_ImportExport_Block_Adminhtml_Import_Frame_Result\\:\\:addError\\(\\) invoked with 2 parameters, 1 required\\.$#"
4610-
count: 1
4611-
path: ../app/code/core/Mage/ImportExport/controllers/Adminhtml/ImportController.php
4612-
46134483
-
46144484
message: "#^Method Mage_Index_Block_Adminhtml_Process_Edit\\:\\:getHeaderText\\(\\) should return string but return statement is missing\\.$#"
46154485
count: 1
@@ -5590,11 +5460,6 @@ parameters:
55905460
count: 1
55915461
path: ../app/code/core/Mage/Reports/Model/Totals.php
55925462

5593-
-
5594-
message: "#^Cannot call method assign\\(\\) on Mage_Core_Block_Abstract\\|false\\.$#"
5595-
count: 1
5596-
path: ../app/code/core/Mage/Review/Block/Product/View.php
5597-
55985463
-
55995464
message: "#^Comparison operation \"\\=\\=\" between array\\|null and 1 results in an error\\.$#"
56005465
count: 1
@@ -5730,16 +5595,6 @@ parameters:
57305595
count: 2
57315596
path: ../app/code/core/Mage/Sales/Block/Adminhtml/Billing/Agreement/View/Tab/Info.php
57325597

5733-
-
5734-
message: "#^Cannot call method addFieldMap\\(\\) on Mage_Core_Block_Abstract\\|false\\.$#"
5735-
count: 1
5736-
path: ../app/code/core/Mage/Sales/Block/Adminhtml/Report/Filter/Form.php
5737-
5738-
-
5739-
message: "#^Cannot call method addFieldMap\\(\\) on Mage_Core_Block_Abstract\\|false\\.$#"
5740-
count: 1
5741-
path: ../app/code/core/Mage/Sales/Block/Adminhtml/Report/Filter/Form/Coupon.php
5742-
57435598
-
57445599
message: "#^Call to an undefined method Mage_Core_Helper_Abstract\\:\\:formatDate\\(\\)\\.$#"
57455600
count: 3
@@ -5840,11 +5695,6 @@ parameters:
58405695
count: 1
58415696
path: ../app/code/core/Mage/Sales/Model/Entity/Quote/Item/Collection.php
58425697

5843-
-
5844-
message: "#^Cannot call method addFieldMap\\(\\) on Mage_Core_Block_Abstract\\|false\\.$#"
5845-
count: 1
5846-
path: ../app/code/core/Mage/Sales/Model/Observer.php
5847-
58485698
-
58495699
message: "#^Variable \\$oldArea might not be defined\\.$#"
58505700
count: 1
@@ -6475,11 +6325,6 @@ parameters:
64756325
count: 1
64766326
path: ../app/code/core/Mage/Widget/Model/Widget/Instance.php
64776327

6478-
-
6479-
message: "#^Cannot call method initSerializerBlock\\(\\) on Mage_Core_Block_Abstract\\|false\\.$#"
6480-
count: 1
6481-
path: ../app/code/core/Mage/Widget/controllers/Adminhtml/Widget/InstanceController.php
6482-
64836328
-
64846329
message: "#^Method Mage_Wishlist_Block_Customer_Wishlist_Item_Column\\:\\:_beforeChildToHtml\\(\\) should return string but return statement is missing\\.$#"
64856330
count: 1

app/code/core/Mage/Adminhtml/Block/Backup/Dialogs.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,13 @@ class Mage_Adminhtml_Block_Backup_Dialogs extends Mage_Adminhtml_Block_Template
3737
/**
3838
* Include backup.js file in page before rendering
3939
*
40-
* @see Mage_Core_Block_Abstract::_prepareLayout()
40+
* @inheritDoc
4141
*/
4242
protected function _prepareLayout()
4343
{
44-
$this->getLayout()->getBlock('head')->addJs('mage/adminhtml/backup.js');
44+
/** @var Mage_Page_Block_Html_Head $block */
45+
$block = $this->getLayout()->getBlock('head');
46+
$block->addJs('mage/adminhtml/backup.js');
4547
return parent::_prepareLayout();
4648
}
4749
}

app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/Main.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,8 @@ protected function _prepareForm()
3838
{
3939
parent::_prepareForm();
4040
$attributeObject = $this->getAttributeObject();
41-
/* @var $form Varien_Data_Form */
4241
$form = $this->getForm();
43-
/* @var $fieldset Varien_Data_Form_Element_Fieldset */
42+
/* @var Varien_Data_Form_Element_Fieldset $fieldset */
4443
$fieldset = $form->getElement('base_fieldset');
4544

4645
$fieldset->getElements()
@@ -101,8 +100,8 @@ protected function _prepareForm()
101100
);
102101

103102
if (
104-
$attributeObject->getAttributeCode() == 'status'
105-
|| $attributeObject->getAttributeCode() == 'tax_class_id'
103+
$attributeObject->getAttributeCode() === 'status'
104+
|| $attributeObject->getAttributeCode() === 'tax_class_id'
106105
) {
107106
unset($scopes[Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE]);
108107
}
@@ -240,7 +239,9 @@ protected function _prepareForm()
240239
}
241240

242241
// define field dependencies
243-
$this->setChild('form_after', $this->getLayout()->createBlock('adminhtml/widget_form_element_dependence')
242+
/** @var Mage_Adminhtml_Block_Widget_Form_Element_Dependence $block */
243+
$block = $this->getLayout()->createBlock('adminhtml/widget_form_element_dependence');
244+
$this->setChild('form_after', $block
244245
->addFieldMap("is_wysiwyg_enabled", 'wysiwyg_enabled')
245246
->addFieldMap("is_html_allowed_on_front", 'html_allowed_on_front')
246247
->addFieldMap("frontend_input", 'frontend_input_type')

0 commit comments

Comments
 (0)