Skip to content

Commit 9fe6bec

Browse files
authored
Fixed PHPStan errors after upgrading to 2.1.39 (#554)
1 parent da72e0c commit 9fe6bec

File tree

10 files changed

+63
-105
lines changed

10 files changed

+63
-105
lines changed

.phpstan.dist.baseline.neon

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9888,18 +9888,6 @@ parameters:
98889888
count: 1
98899889
path: app/code/core/Mage/Checkout/Model/Cart/Customer/Api/V2.php
98909890

9891-
-
9892-
rawMessage: 'Strict comparison using !== between array<string, mixed> and null will always evaluate to true.'
9893-
identifier: notIdentical.alwaysTrue
9894-
count: 2
9895-
path: app/code/core/Mage/Checkout/Model/Cart/Customer/Api/V2.php
9896-
9897-
-
9898-
rawMessage: Unreachable statement - code above always terminates.
9899-
identifier: deadCode.unreachable
9900-
count: 1
9901-
path: app/code/core/Mage/Checkout/Model/Cart/Customer/Api/V2.php
9902-
99039891
-
99049892
rawMessage: 'Parameter #1 $value of method Mage_Sales_Model_Quote_Address::setCollectShippingRates() expects int, true given.'
99059893
identifier: argument.type
@@ -9912,18 +9900,6 @@ parameters:
99129900
count: 1
99139901
path: app/code/core/Mage/Checkout/Model/Cart/Payment/Api/V2.php
99149902

9915-
-
9916-
rawMessage: 'Strict comparison using !== between array<string, mixed> and null will always evaluate to true.'
9917-
identifier: notIdentical.alwaysTrue
9918-
count: 1
9919-
path: app/code/core/Mage/Checkout/Model/Cart/Payment/Api/V2.php
9920-
9921-
-
9922-
rawMessage: Unreachable statement - code above always terminates.
9923-
identifier: deadCode.unreachable
9924-
count: 1
9925-
path: app/code/core/Mage/Checkout/Model/Cart/Payment/Api/V2.php
9926-
99279903
-
99289904
rawMessage: 'Method Mage_Checkout_Model_Observer::loadCustomerQuote() has no return type specified.'
99299905
identifier: missingType.return
@@ -12228,18 +12204,6 @@ parameters:
1222812204
count: 1
1222912205
path: app/code/core/Mage/Customer/Model/Customer/Api/V2.php
1223012206

12231-
-
12232-
rawMessage: 'Strict comparison using !== between array<string, mixed> and null will always evaluate to true.'
12233-
identifier: notIdentical.alwaysTrue
12234-
count: 1
12235-
path: app/code/core/Mage/Customer/Model/Customer/Api/V2.php
12236-
12237-
-
12238-
rawMessage: Unreachable statement - code above always terminates.
12239-
identifier: deadCode.unreachable
12240-
count: 1
12241-
path: app/code/core/Mage/Customer/Model/Customer/Api/V2.php
12242-
1224312207
-
1224412208
rawMessage: Property Mage_Customer_Model_Group::$_taxClassIds has no type specified.
1224512209
identifier: missingType.property

app/code/core/Mage/Adminhtml/Block/System/Email/Template/Grid/Filter/Type.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
class Mage_Adminhtml_Block_System_Email_Template_Grid_Filter_Type extends Mage_Adminhtml_Block_Widget_Grid_Column_Filter_Select
1414
{
1515
protected static $_types = [
16-
null => null,
16+
'' => null,
1717
Mage_Core_Model_Template::TYPE_HTML => 'HTML',
1818
Mage_Core_Model_Template::TYPE_TEXT => 'Text',
1919
];

app/code/core/Mage/Api2/Model/Acl/Global/Rule/Tree.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public function getPostResources()
160160
if ($isAll) {
161161
$resources = [
162162
Mage_Api2_Model_Acl_Global_Rule::RESOURCE_ALL => [
163-
null => $allow,
163+
'' => $allow,
164164
],
165165
];
166166
} else {

app/code/core/Mage/Checkout/Model/Cart/Customer/Api/V2.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@ class Mage_Checkout_Model_Cart_Customer_Api_V2 extends Mage_Checkout_Model_Cart_
2121
#[\Override]
2222
protected function _prepareCustomerData($data)
2323
{
24-
if (($_data = get_object_vars($data)) !== null) {
25-
return parent::_prepareCustomerData($_data);
26-
}
27-
return [];
24+
return parent::_prepareCustomerData(get_object_vars($data));
2825
}
2926

3027
/**
@@ -39,9 +36,7 @@ protected function _prepareCustomerAddressData($data)
3936
if (is_array($data)) {
4037
$dataAddresses = [];
4138
foreach ($data as $addressItem) {
42-
if (($_addressItem = get_object_vars($addressItem)) !== null) {
43-
$dataAddresses[] = $_addressItem;
44-
}
39+
$dataAddresses[] = get_object_vars($addressItem);
4540
}
4641
return parent::_prepareCustomerAddressData($dataAddresses);
4742
}

app/code/core/Mage/Checkout/Model/Cart/Payment/Api/V2.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ class Mage_Checkout_Model_Cart_Payment_Api_V2 extends Mage_Checkout_Model_Cart_P
1919
#[\Override]
2020
protected function _preparePaymentData($data)
2121
{
22-
if (($_data = get_object_vars($data)) !== null) {
23-
return parent::_preparePaymentData($_data);
24-
}
25-
26-
return [];
22+
return parent::_preparePaymentData(get_object_vars($data));
2723
}
2824
}

app/code/core/Mage/Customer/Model/Customer/Api/V2.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ class Mage_Customer_Model_Customer_Api_V2 extends Mage_Customer_Model_Customer_A
2222
#[\Override]
2323
protected function _prepareData($data)
2424
{
25-
if (($objectVars = get_object_vars($data)) !== null) {
26-
return parent::_prepareData($objectVars);
27-
}
28-
return [];
25+
return parent::_prepareData(get_object_vars($data));
2926
}
3027
}

app/code/core/Mage/ImportExport/Model/Resource/Import/Data.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
class Mage_ImportExport_Model_Resource_Import_Data extends Mage_Core_Model_Resource_Db_Abstract implements IteratorAggregate
1414
{
1515
/**
16-
* @var Iterator|null
16+
* @var Iterator<int, array>|null
1717
*/
1818
protected $_iterator = null;
1919

@@ -26,7 +26,7 @@ protected function _construct()
2626
/**
2727
* Retrieve an external iterator
2828
*
29-
* @return Iterator
29+
* @return Iterator<int, array>
3030
*/
3131
#[\ReturnTypeWillChange]
3232
#[\Override]

app/code/core/Mage/Page/Block/Html/Breadcrumbs.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function __construct()
4545
/**
4646
* @param string $crumbName
4747
* @param array $crumbInfo
48-
* @param string|bool $after
48+
* @param string|false $after
4949
* @return $this
5050
*/
5151
public function addCrumb($crumbName, $crumbInfo, $after = false)
@@ -65,7 +65,7 @@ public function addCrumb($crumbName, $crumbInfo, $after = false)
6565
/**
6666
* @param string $crumbName
6767
* @param array $crumbInfo
68-
* @param bool $before
68+
* @param string|false $before
6969
*/
7070
public function addCrumbBefore($crumbName, $crumbInfo, $before = false)
7171
{

app/code/core/Mage/Payment/Model/Restriction/Rule/Condition/Product/Found.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function asXml($containerKey = 'conditions', $itemKey = 'condition')
7272
public function loadAttributeOptions()
7373
{
7474
$this->setAttributeOption([
75-
null => Mage::helper('payment')->__('Please choose a condition to add.'),
75+
'' => Mage::helper('payment')->__('Please choose a condition to add.'),
7676
]);
7777
return $this;
7878
}

0 commit comments

Comments
 (0)