Skip to content

Commit 5d31af7

Browse files
authored
phpstan: fix comparison for get_object_vars (#5271)
1 parent 6c5ca0f commit 5d31af7

File tree

4 files changed

+10
-40
lines changed

4 files changed

+10
-40
lines changed

.phpstan.dist.baseline.neon

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3300,36 +3300,12 @@ parameters:
33003300
count: 4
33013301
path: app/code/core/Mage/Checkout/Model/Cart/Customer/Api.php
33023302

3303-
-
3304-
rawMessage: 'Strict comparison using !== between array<string, mixed> and null will always evaluate to true.'
3305-
identifier: notIdentical.alwaysTrue
3306-
count: 2
3307-
path: app/code/core/Mage/Checkout/Model/Cart/Customer/Api/V2.php
3308-
3309-
-
3310-
rawMessage: Unreachable statement - code above always terminates.
3311-
identifier: deadCode.unreachable
3312-
count: 1
3313-
path: app/code/core/Mage/Checkout/Model/Cart/Customer/Api/V2.php
3314-
33153303
-
33163304
rawMessage: 'Construct empty() is not allowed. Use more strict comparison.'
33173305
identifier: empty.notAllowed
33183306
count: 4
33193307
path: app/code/core/Mage/Checkout/Model/Cart/Payment/Api.php
33203308

3321-
-
3322-
rawMessage: 'Strict comparison using !== between array<string, mixed> and null will always evaluate to true.'
3323-
identifier: notIdentical.alwaysTrue
3324-
count: 1
3325-
path: app/code/core/Mage/Checkout/Model/Cart/Payment/Api/V2.php
3326-
3327-
-
3328-
rawMessage: Unreachable statement - code above always terminates.
3329-
identifier: deadCode.unreachable
3330-
count: 1
3331-
path: app/code/core/Mage/Checkout/Model/Cart/Payment/Api/V2.php
3332-
33333309
-
33343310
rawMessage: 'Construct empty() is not allowed. Use more strict comparison.'
33353311
identifier: empty.notAllowed
@@ -4458,18 +4434,6 @@ parameters:
44584434
count: 1
44594435
path: app/code/core/Mage/Customer/Model/Customer.php
44604436

4461-
-
4462-
rawMessage: 'Strict comparison using !== between array<string, mixed> and null will always evaluate to true.'
4463-
identifier: notIdentical.alwaysTrue
4464-
count: 1
4465-
path: app/code/core/Mage/Customer/Model/Customer/Api/V2.php
4466-
4467-
-
4468-
rawMessage: Unreachable statement - code above always terminates.
4469-
identifier: deadCode.unreachable
4470-
count: 1
4471-
path: app/code/core/Mage/Customer/Model/Customer/Api/V2.php
4472-
44734437
-
44744438
rawMessage: 'Construct empty() is not allowed. Use more strict comparison.'
44754439
identifier: empty.notAllowed
@@ -7584,6 +7548,12 @@ parameters:
75847548
count: 1
75857549
path: app/code/core/Mage/Weee/Model/Tax.php
75867550

7551+
-
7552+
rawMessage: If condition is always false.
7553+
identifier: if.alwaysFalse
7554+
count: 1
7555+
path: app/code/core/Mage/Weee/Model/Total/Quote/Weee.php
7556+
75877557
-
75887558
rawMessage: PHPDoc type Mage_Weee_Helper_Data of property Mage_Weee_Model_Total_Quote_Weee::$_helper is not the same as PHPDoc type Mage_Tax_Helper_Data of overridden property Mage_Tax_Model_Sales_Total_Quote_Tax::$_helper.
75897559
identifier: property.phpDocType

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Mage_Checkout_Model_Cart_Customer_Api_V2 extends Mage_Checkout_Model_Cart_
2222
*/
2323
protected function _prepareCustomerData($data)
2424
{
25-
if (($_data = get_object_vars($data)) !== null) {
25+
if (($_data = get_object_vars($data)) !== []) {
2626
return parent::_prepareCustomerData($_data);
2727
}
2828

@@ -40,7 +40,7 @@ protected function _prepareCustomerAddressData($data)
4040
if (is_array($data)) {
4141
$dataAddresses = [];
4242
foreach ($data as $addressItem) {
43-
if (($_addressItem = get_object_vars($addressItem)) !== null) {
43+
if (($_addressItem = get_object_vars($addressItem)) !== []) {
4444
$dataAddresses[] = $_addressItem;
4545
}
4646
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Mage_Checkout_Model_Cart_Payment_Api_V2 extends Mage_Checkout_Model_Cart_P
2020
*/
2121
protected function _preparePaymentData($data)
2222
{
23-
if (($_data = get_object_vars($data)) !== null) {
23+
if (($_data = get_object_vars($data)) !== []) {
2424
return parent::_preparePaymentData($_data);
2525
}
2626

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Mage_Customer_Model_Customer_Api_V2 extends Mage_Customer_Model_Customer_A
2323
*/
2424
protected function _prepareData($data)
2525
{
26-
if (($objectVars = get_object_vars($data)) !== null) {
26+
if (($objectVars = get_object_vars($data)) !== []) {
2727
return parent::_prepareData($objectVars);
2828
}
2929

0 commit comments

Comments
 (0)