Skip to content

Commit 63afa1f

Browse files
committed
fixes
1 parent bd0a98d commit 63afa1f

File tree

21 files changed

+136
-203
lines changed

21 files changed

+136
-203
lines changed

.phpstan.dist.baseline.neon

Lines changed: 6 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,6 @@ parameters:
2424
count: 1
2525
path: app/code/core/Mage/Admin/Model/Resource/Acl.php
2626

27-
-
28-
rawMessage: 'Parameter #1 $role of method Mage_Admin_Model_Resource_Roles::_updateRoleUsersAcl() expects Mage_Admin_Model_Roles, Mage_Core_Model_Abstract given.'
29-
identifier: argument.type
30-
count: 1
31-
path: app/code/core/Mage/Admin/Model/Resource/Roles.php
32-
3327
-
3428
rawMessage: 'Call to an undefined method Mage_Admin_Model_Resource_Roles::update().'
3529
identifier: method.notFound
@@ -138,12 +132,6 @@ parameters:
138132
count: 1
139133
path: app/code/core/Mage/Adminhtml/Block/Permissions/Usernroles.php
140134

141-
-
142-
rawMessage: 'Parameter #3 $refValues of method Mage_Adminhtml_Block_Widget_Form_Element_Dependence::addFieldDependence() expects array|string, int given.'
143-
identifier: argument.type
144-
count: 3
145-
path: app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Main.php
146-
147135
-
148136
rawMessage: 'Parameter #1 $collection of method Mage_Adminhtml_Block_Widget_Grid::setCollection() expects Varien_Data_Collection_Db, Mage_Reports_Model_Resource_Report_Collection given.'
149137
identifier: argument.type
@@ -162,12 +150,6 @@ parameters:
162150
count: 1
163151
path: app/code/core/Mage/Adminhtml/Block/Report/Grid/Abstract.php
164152

165-
-
166-
rawMessage: 'Property Mage_Adminhtml_Block_Report_Grid_Abstract::$_columnGroupBy (string) in isset() is not nullable.'
167-
identifier: isset.property
168-
count: 1
169-
path: app/code/core/Mage/Adminhtml/Block/Report/Grid/Abstract.php
170-
171153
-
172154
rawMessage: 'Parameter #1 $value of method Zend_Currency::toCurrency() expects float|int|null, string given.'
173155
identifier: argument.type
@@ -558,18 +540,6 @@ parameters:
558540
count: 1
559541
path: app/code/core/Mage/Adminhtml/controllers/CustomerController.php
560542

561-
-
562-
rawMessage: 'Variable $id in isset() always exists and is not nullable.'
563-
identifier: isset.variable
564-
count: 1
565-
path: app/code/core/Mage/Adminhtml/controllers/Permissions/BlockController.php
566-
567-
-
568-
rawMessage: 'Variable $id in isset() always exists and is not nullable.'
569-
identifier: isset.variable
570-
count: 1
571-
path: app/code/core/Mage/Adminhtml/controllers/Permissions/VariableController.php
572-
573543
-
574544
rawMessage: 'Cannot call method aggregate() on Mage_Core_Model_Resource_Db_Collection_Abstract|false.'
575545
identifier: method.nonObject
@@ -672,12 +642,6 @@ parameters:
672642
count: 4
673643
path: app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php
674644

675-
-
676-
rawMessage: 'Variable $data in isset() always exists and is not nullable.'
677-
identifier: isset.variable
678-
count: 1
679-
path: app/code/core/Mage/Adminhtml/controllers/System/Convert/ProfileController.php
680-
681645
-
682646
rawMessage: 'Cannot call method fetchRates() on Mage_Core_Model_Abstract|false.'
683647
identifier: method.nonObject
@@ -1656,12 +1620,6 @@ parameters:
16561620
count: 1
16571621
path: app/code/core/Mage/Catalog/Model/Resource/Category.php
16581622

1659-
-
1660-
rawMessage: 'Property Mage_Catalog_Model_Resource_Category::$_storeId (int) on left side of ?? is not nullable.'
1661-
identifier: nullCoalesce.property
1662-
count: 1
1663-
path: app/code/core/Mage/Catalog/Model/Resource/Category.php
1664-
16651623
-
16661624
rawMessage: 'Property Mage_Catalog_Model_Resource_Category::$_tree (Varien_Data_Tree_Db) does not accept Varien_Data_Tree_Dbp.'
16671625
identifier: assign.propertyType
@@ -1740,12 +1698,6 @@ parameters:
17401698
count: 1
17411699
path: app/code/core/Mage/Catalog/Model/Resource/Category/Tree.php
17421700

1743-
-
1744-
rawMessage: 'Property Mage_Catalog_Model_Resource_Config::$_storeId (int) on left side of ?? is not nullable.'
1745-
identifier: nullCoalesce.property
1746-
count: 1
1747-
path: app/code/core/Mage/Catalog/Model/Resource/Config.php
1748-
17491701
-
17501702
rawMessage: Binary operation "-" between int and non-falsy-string results in an error.
17511703
identifier: binaryOp.invalid
@@ -1878,12 +1830,6 @@ parameters:
18781830
count: 2
18791831
path: app/code/core/Mage/Catalog/Model/Url.php
18801832

1881-
-
1882-
rawMessage: 'Property Mage_Catalog_Model_Url::$_saveRewritesHistory (bool) on left side of ?? is not nullable.'
1883-
identifier: nullCoalesce.property
1884-
count: 1
1885-
path: app/code/core/Mage/Catalog/Model/Url.php
1886-
18871833
-
18881834
rawMessage: 'Call to an undefined method Mage_CatalogIndex_Model_Resource_Attribute::checkCount().'
18891835
identifier: method.notFound
@@ -2028,12 +1974,6 @@ parameters:
20281974
count: 1
20291975
path: app/code/core/Mage/CatalogSearch/Helper/Data.php
20301976

2031-
-
2032-
rawMessage: 'Property Mage_CatalogSearch_Helper_Data::$_queryText (string) in isset() is not nullable.'
2033-
identifier: isset.property
2034-
count: 1
2035-
path: app/code/core/Mage/CatalogSearch/Helper/Data.php
2036-
20371977
-
20381978
rawMessage: 'Method Mage_CatalogSearch_Model_Advanced::getProductCollection() should return Mage_CatalogSearch_Model_Resource_Advanced_Collection but returns array|float|int|string|false|null.'
20391979
identifier: return.type
@@ -2160,12 +2100,6 @@ parameters:
21602100
count: 1
21612101
path: app/code/core/Mage/Checkout/Model/Type/Onepage.php
21622102

2163-
-
2164-
rawMessage: 'Property Mage_Checkout_Model_Type_Onepage::$_quote (Mage_Sales_Model_Quote) on left side of ?? is not nullable.'
2165-
identifier: nullCoalesce.property
2166-
count: 1
2167-
path: app/code/core/Mage/Checkout/Model/Type/Onepage.php
2168-
21692103
-
21702104
rawMessage: 'Parameter #1 $qty of method Mage_Sales_Model_Quote_Item::setQty() expects float, array|string|null given.'
21712105
identifier: argument.type
@@ -2304,12 +2238,6 @@ parameters:
23042238
count: 1
23052239
path: app/code/core/Mage/Core/Model/Abstract.php
23062240

2307-
-
2308-
rawMessage: 'Property Mage_Core_Model_Abstract::$_isObjectNew (bool) on left side of ?? is not nullable.'
2309-
identifier: nullCoalesce.property
2310-
count: 1
2311-
path: app/code/core/Mage/Core/Model/Abstract.php
2312-
23132241
-
23142242
rawMessage: 'Parameter #1 $group of method Mage_Core_Model_App::_getStoreByGroup() expects int, string given.'
23152243
identifier: argument.type
@@ -2376,18 +2304,6 @@ parameters:
23762304
count: 1
23772305
path: app/code/core/Mage/Core/Model/Design/Config.php
23782306

2379-
-
2380-
rawMessage: 'Property Mage_Core_Model_Design_Fallback::$_store (Mage_Core_Model_Store) on left side of ?? is not nullable.'
2381-
identifier: nullCoalesce.property
2382-
count: 1
2383-
path: app/code/core/Mage/Core/Model/Design/Fallback.php
2384-
2385-
-
2386-
rawMessage: 'Property Mage_Core_Model_Design_Package::$_store (int|Mage_Core_Model_Store|string) on left side of ?? is not nullable.'
2387-
identifier: nullCoalesce.property
2388-
count: 1
2389-
path: app/code/core/Mage/Core/Model/Design/Package.php
2390-
23912307
-
23922308
rawMessage: 'Parameter #1 $policyCode of method Mage_Core_Model_Domainpolicy::_getDomainPolicyByCode() expects string, int given.'
23932309
identifier: argument.type
@@ -2526,30 +2442,12 @@ parameters:
25262442
count: 1
25272443
path: app/code/core/Mage/Core/Model/Resource/Db/Collection/Abstract.php
25282444

2529-
-
2530-
rawMessage: Result of && is always false.
2531-
identifier: booleanAnd.alwaysFalse
2532-
count: 1
2533-
path: app/code/core/Mage/Core/Model/Resource/Db/Collection/Abstract.php
2534-
2535-
-
2536-
rawMessage: 'Variable $alias in isset() always exists and is always null.'
2537-
identifier: isset.variable
2538-
count: 1
2539-
path: app/code/core/Mage/Core/Model/Resource/Db/Collection/Abstract.php
2540-
25412445
-
25422446
rawMessage: Variable $alias might not be defined.
25432447
identifier: variable.undefined
25442448
count: 3
25452449
path: app/code/core/Mage/Core/Model/Resource/Db/Collection/Abstract.php
25462450

2547-
-
2548-
rawMessage: 'Variable $columnsToSelect in isset() always exists and is not nullable.'
2549-
identifier: isset.variable
2550-
count: 1
2551-
path: app/code/core/Mage/Core/Model/Resource/Db/Collection/Abstract.php
2552-
25532451
-
25542452
rawMessage: 'Parameter #1 $date of method Mage_Core_Model_Resource_Db_Collection_Abstract::formatDate() expects int|string|Zend_Date, true given.'
25552453
identifier: argument.type
@@ -3354,12 +3252,6 @@ parameters:
33543252
count: 1
33553253
path: app/code/core/Mage/Install/Model/Installer/Db.php
33563254

3357-
-
3358-
rawMessage: 'Property Mage_Install_Model_Installer_Db_Abstract::$_connection (Varien_Db_Adapter_Interface) in isset() is not nullable.'
3359-
identifier: isset.property
3360-
count: 1
3361-
path: app/code/core/Mage/Install/Model/Installer/Db/Abstract.php
3362-
33633255
-
33643256
rawMessage: Binary operation "+" between non-falsy-string and 1 results in an error.
33653257
identifier: binaryOp.invalid
@@ -3834,12 +3726,6 @@ parameters:
38343726
count: 1
38353727
path: app/code/core/Mage/Rule/Model/Condition/Abstract.php
38363728

3837-
-
3838-
rawMessage: 'Property Mage_Rule_Model_Condition_Abstract::$_inputType (string) on left side of ?? is not nullable.'
3839-
identifier: nullCoalesce.property
3840-
count: 1
3841-
path: app/code/core/Mage/Rule/Model/Condition/Abstract.php
3842-
38433729
-
38443730
rawMessage: 'Method Mage_Rule_Model_Condition_Abstract::loadArray() invoked with 2 parameters, 1 required.'
38453731
identifier: arguments.count
@@ -4068,12 +3954,6 @@ parameters:
40683954
count: 1
40693955
path: app/code/core/Mage/Sales/Model/Quote/Address/Total/Shipping.php
40703956

4071-
-
4072-
rawMessage: 'Variable $addressQty in isset() always exists and is not nullable.'
4073-
identifier: isset.variable
4074-
count: 1
4075-
path: app/code/core/Mage/Sales/Model/Quote/Address/Total/Shipping.php
4076-
40773957
-
40783958
rawMessage: Instanceof between Mage_Sales_Model_Quote_Item_Option and Mage_Sales_Model_Quote_Item_Option will always evaluate to true.
40793959
identifier: instanceof.alwaysTrue
@@ -4428,12 +4308,6 @@ parameters:
44284308
count: 1
44294309
path: app/code/core/Mage/Usa/Helper/Data.php
44304310

4431-
-
4432-
rawMessage: 'Property Mage_Shipping_Model_Carrier_Abstract::$_code (string) on left side of ?? is not nullable.'
4433-
identifier: nullCoalesce.property
4434-
count: 1
4435-
path: app/code/core/Mage/Usa/Model/Shipping/Carrier/Abstract.php
4436-
44374311
-
44384312
rawMessage: Access to an undefined property Mage_Usa_Model_Shipping_Carrier_Dhl::$_rawTrackRequest.
44394313
identifier: property.notFound
@@ -4620,6 +4494,12 @@ parameters:
46204494
count: 1
46214495
path: app/code/core/Mage/Wishlist/Controller/Abstract.php
46224496

4497+
-
4498+
rawMessage: Variable $wishlist might not be defined.
4499+
identifier: variable.undefined
4500+
count: 1
4501+
path: app/code/core/Mage/Wishlist/controllers/IndexController.php
4502+
46234503
-
46244504
rawMessage: 'Call to an undefined method Mage_Core_Block_Abstract::_getUsers().'
46254505
identifier: method.notFound

app/code/core/Mage/Admin/Model/Resource/Roles.php

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,46 +39,50 @@ protected function _construct()
3939
/**
4040
* Process role before saving
4141
*
42+
* @param Mage_Admin_Model_Roles $object
43+
* @throws Mage_Core_Exception
4244
* @return $this
4345
*/
44-
protected function _beforeSave(Mage_Core_Model_Abstract $role)
46+
protected function _beforeSave(Mage_Core_Model_Abstract $object)
4547
{
46-
if ($role->getId() == '') {
47-
if ($role->getIdFieldName()) {
48-
$role->unsetData($role->getIdFieldName());
48+
if ($object->getId() == '') {
49+
if ($object->getIdFieldName()) {
50+
$object->unsetData($object->getIdFieldName());
4951
} else {
50-
$role->unsetData('id');
52+
$object->unsetData('id');
5153
}
5254
}
5355

54-
if ($role->getPid() > 0) {
56+
if ($object->getPid() > 0) {
5557
$select = $this->_getReadAdapter()->select()
5658
->from($this->getMainTable(), ['tree_level'])
5759
->where("{$this->getIdFieldName()} = :pid");
5860

5961
$binds = [
60-
'pid' => (int) $role->getPid(),
62+
'pid' => (int) $object->getPid(),
6163
];
6264

6365
$treeLevel = $this->_getReadAdapter()->fetchOne($select, $binds);
6466
} else {
6567
$treeLevel = 0;
6668
}
6769

68-
$role->setTreeLevel($treeLevel + 1);
69-
$role->setRoleName($role->getName());
70+
$object->setTreeLevel($treeLevel + 1);
71+
$object->setRoleName($object->getName());
7072

7173
return $this;
7274
}
7375

7476
/**
7577
* Process role after saving
7678
*
79+
* @param Mage_Admin_Model_Roles $object
80+
* @throws Zend_Cache_Exception
7781
* @return $this
7882
*/
79-
protected function _afterSave(Mage_Core_Model_Abstract $role)
83+
protected function _afterSave(Mage_Core_Model_Abstract $object)
8084
{
81-
$this->_updateRoleUsersAcl($role);
85+
$this->_updateRoleUsersAcl($object);
8286
Mage::app()->getCache()->clean(
8387
Zend_Cache::CLEANING_MODE_MATCHING_TAG,
8488
[Mage_Adminhtml_Block_Page_Menu::CACHE_TAGS],
@@ -89,19 +93,23 @@ protected function _afterSave(Mage_Core_Model_Abstract $role)
8993
/**
9094
* Process role after deleting
9195
*
96+
* @param Mage_Admin_Model_Roles $object
97+
* @throws Mage_Core_Exception
9298
* @return $this
9399
*/
94-
protected function _afterDelete(Mage_Core_Model_Abstract $role)
100+
protected function _afterDelete(Mage_Core_Model_Abstract $object)
95101
{
96102
$adapter = $this->_getWriteAdapter();
97-
$adapter->delete($this->getMainTable(), ['parent_id = ?' => (int) $role->getId()]);
98-
$adapter->delete($this->_ruleTable, ['role_id = ?' => (int) $role->getId()]);
103+
$adapter->delete($this->getMainTable(), ['parent_id = ?' => (int) $object->getId()]);
104+
$adapter->delete($this->_ruleTable, ['role_id = ?' => (int) $object->getId()]);
99105
return $this;
100106
}
101107

102108
/**
103109
* Get role users
104110
*
111+
* @param Mage_Admin_Model_Roles $role
112+
* @throws Mage_Core_Exception
105113
* @return array
106114
*/
107115
public function getRoleUsers(Mage_Admin_Model_Roles $role)
@@ -118,6 +126,8 @@ public function getRoleUsers(Mage_Admin_Model_Roles $role)
118126
/**
119127
* Update role users
120128
*
129+
* @throws Mage_Core_Exception
130+
* @throws Zend_Db_Adapter_Exception
121131
* @return bool
122132
*/
123133
private function _updateRoleUsersAcl(Mage_Admin_Model_Roles $role)

app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Main.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,17 +249,17 @@ protected function _prepareForm()
249249
->addFieldDependence(
250250
$couponCodeFiled->getName(),
251251
$couponTypeFiled->getName(),
252-
Mage_SalesRule_Model_Rule::COUPON_TYPE_SPECIFIC,
252+
(string) Mage_SalesRule_Model_Rule::COUPON_TYPE_SPECIFIC,
253253
)
254254
->addFieldDependence(
255255
$autoGenerationCheckbox->getName(),
256256
$couponTypeFiled->getName(),
257-
Mage_SalesRule_Model_Rule::COUPON_TYPE_SPECIFIC,
257+
(string) Mage_SalesRule_Model_Rule::COUPON_TYPE_SPECIFIC,
258258
)
259259
->addFieldDependence(
260260
$usesPerCouponFiled->getName(),
261261
$couponTypeFiled->getName(),
262-
Mage_SalesRule_Model_Rule::COUPON_TYPE_SPECIFIC,
262+
(string) Mage_SalesRule_Model_Rule::COUPON_TYPE_SPECIFIC,
263263
));
264264

265265
Mage::dispatchEvent('adminhtml_promo_quote_edit_tab_main_prepare_form', ['form' => $form]);

app/code/core/Mage/Adminhtml/Block/Report/Grid/Abstract.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function __construct()
3636
$this->setFilterVisibility(false);
3737
$this->setPagerVisibility(false);
3838
$this->setUseAjax(false);
39-
if (isset($this->_columnGroupBy)) {
39+
if (!is_null($this->_columnGroupBy)) {
4040
$this->isColumnGrouped($this->_columnGroupBy, true);
4141
}
4242

0 commit comments

Comments
 (0)