Skip to content

Commit 005b9c3

Browse files
authored
PhpStan: fix wrong params for explode (#5073)
1 parent e6645d2 commit 005b9c3

File tree

3 files changed

+12
-30
lines changed

3 files changed

+12
-30
lines changed

.phpstan.dist.baseline.neon

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3234,12 +3234,6 @@ parameters:
32343234
count: 1
32353235
path: app/code/core/Mage/Eav/Model/Convert/Adapter/Grid.php
32363236

3237-
-
3238-
rawMessage: 'Parameter #2 $string of function explode expects string, array given.'
3239-
identifier: argument.type
3240-
count: 1
3241-
path: app/code/core/Mage/Eav/Model/Convert/Parser/Abstract.php
3242-
32433237
-
32443238
rawMessage: 'Cannot call method lastInsertId() on Varien_Db_Adapter_Interface|false.'
32453239
identifier: method.nonObject
@@ -4800,18 +4794,6 @@ parameters:
48004794
count: 1
48014795
path: app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl.php
48024796

4803-
-
4804-
rawMessage: 'Parameter #1 $shippingDays of method Mage_Usa_Model_Shipping_Carrier_Dhl_Abstract::_determineShippingDay() expects array, string|false given.'
4805-
identifier: argument.type
4806-
count: 1
4807-
path: app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Abstract.php
4808-
4809-
-
4810-
rawMessage: 'Parameter #2 $string of function explode expects string, array given.'
4811-
identifier: argument.type
4812-
count: 1
4813-
path: app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Abstract.php
4814-
48154797
-
48164798
rawMessage: Access to an undefined property Varien_Object::$domestic.
48174799
identifier: property.notFound

app/code/core/Mage/Eav/Model/Convert/Parser/Abstract.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ abstract class Mage_Eav_Model_Convert_Parser_Abstract extends Mage_Dataflow_Mode
1919
protected $_attributeSetsByName;
2020

2121
/**
22-
* @param array $stores
22+
* @param string $stores
2323
* @return array|false
2424
*/
2525
public function getStoreIds($stores)
@@ -52,7 +52,7 @@ public function getStoreIds($stores)
5252
*/
5353
public function getStoreCode($storeId)
5454
{
55-
return Mage::app()->getStore($storeId ? $storeId : 0)->getCode();
55+
return Mage::app()->getStore($storeId ?: 0)->getCode();
5656
}
5757

5858
/**
@@ -67,13 +67,13 @@ public function loadAttributeSets($entityTypeId)
6767
$this->_attributeSetsById = [];
6868
$this->_attributeSetsByName = [];
6969
/**
70-
* @var int $id
70+
* @var int $setId
7171
* @var Mage_Eav_Model_Entity_Attribute_Set $attributeSet
7272
*/
73-
foreach ($attributeSetCollection as $id => $attributeSet) {
73+
foreach ($attributeSetCollection as $setId => $attributeSet) {
7474
$name = $attributeSet->getAttributeSetName();
75-
$this->_attributeSetsById[$id] = $name;
76-
$this->_attributeSetsByName[$name] = $id;
75+
$this->_attributeSetsById[$setId] = $name;
76+
$this->_attributeSetsByName[$name] = $setId;
7777
}
7878

7979
return $this;

app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Abstract.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ protected function _getShipDate($domestic = true)
4646
/**
4747
* Determine shipping day according to configuration settings
4848
*
49-
* @param array $shippingDays
49+
* @param string $shippingDays
5050
* @param string $date
5151
* @return string
5252
*/
@@ -58,13 +58,13 @@ protected function _determineShippingDay($shippingDays, $date)
5858

5959
$shippingDays = explode(',', $shippingDays);
6060

61-
$i = 0;
61+
$index = 0;
6262
$weekday = date('D', strtotime($date));
63-
while (!in_array($weekday, $shippingDays) && $i < 10) {
64-
$i++;
65-
$weekday = date('D', strtotime("$date +$i day"));
63+
while (!in_array($weekday, $shippingDays) && $index < 10) {
64+
$index++;
65+
$weekday = date('D', strtotime("$date +$index day"));
6666
}
6767

68-
return date(self::REQUEST_DATE_FORMAT, strtotime("$date +$i day"));
68+
return date(self::REQUEST_DATE_FORMAT, strtotime("$date +$index day"));
6969
}
7070
}

0 commit comments

Comments
 (0)