Skip to content

Commit b4c70bb

Browse files
authored
Remove mixed type usage to support PHP7 (#2856)
1 parent 6899151 commit b4c70bb

File tree

6 files changed

+37
-58
lines changed

6 files changed

+37
-58
lines changed

lib/Varien/Data/Form/Element/Collection.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ public function offsetSet($key, $value): void
8080
* @param mixed $key
8181
* @return mixed
8282
*/
83-
public function offsetGet($key): mixed
83+
#[\ReturnTypeWillChange]
84+
public function offsetGet($key)
8485
{
8586
return $this->_elements[$key];
8687
}

lib/Varien/Data/Tree/Node/Collection.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ public function offsetSet($key, $value): void
7979
* @param string $key
8080
* @return mixed|Varien_Data_Tree_Node
8181
*/
82-
public function offsetGet($key): mixed
82+
#[\ReturnTypeWillChange]
83+
public function offsetGet($key)
8384
{
8485
return $this->_nodes[$key];
8586
}

lib/Varien/Db/Tree/NodeSet.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,14 @@ public function next()
7474
}
7575
}
7676

77-
public function key(): mixed
77+
#[\ReturnTypeWillChange]
78+
public function key()
7879
{
7980
return $this->_current;
8081
}
8182

82-
public function current(): mixed
83+
#[\ReturnTypeWillChange]
84+
public function current()
8385
{
8486
return $this->_nodes[$this->_current];
8587
}

lib/Varien/Object.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,8 @@ public function offsetUnset($offset): void
871871
* @param string $offset
872872
* @return mixed
873873
*/
874-
public function offsetGet($offset): mixed
874+
#[\ReturnTypeWillChange]
875+
public function offsetGet($offset)
875876
{
876877
return isset($this->_data[$offset]) ? $this->_data[$offset] : null;
877878
}

phpstan.dist.baseline.neon

Lines changed: 27 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,11 +1135,6 @@ parameters:
11351135
count: 1
11361136
path: app/code/core/Mage/Api/Model/Wsdl/Config/Element.php
11371137

1138-
-
1139-
message: "#^Return type \\(array\\) of method Mage_Api_Model_Wsdl_Config_Element\\:\\:getChildren\\(\\) should be compatible with return type \\(RecursiveIterator\\|null\\) of method RecursiveIterator\\<string,static\\(SimpleXMLElement\\)\\>\\:\\:getChildren\\(\\)$#"
1140-
count: 1
1141-
path: app/code/core/Mage/Api/Model/Wsdl/Config/Element.php
1142-
11431138
-
11441139
message: "#^Property Mage_Api2_Block_Adminhtml_Attribute_Tab_Resource\\:\\:\\$_treeModel \\(Mage_Api2_Model_Acl_Global_Rule_Tree\\) does not accept default value of type false\\.$#"
11451140
count: 1
@@ -2130,11 +2125,6 @@ parameters:
21302125
count: 1
21312126
path: app/code/core/Mage/Catalog/Model/Product/Flat/Indexer.php
21322127

2133-
-
2134-
message: "#^Binary operation \"\\*\" between string and 1024 results in an error\\.$#"
2135-
count: 3
2136-
path: app/code/core/Mage/Catalog/Model/Product/Image.php
2137-
21382128
-
21392129
message: "#^Negated boolean expression is always false\\.$#"
21402130
count: 1
@@ -3140,16 +3130,6 @@ parameters:
31403130
count: 1
31413131
path: app/code/core/Mage/Core/Controller/Request/Http.php
31423132

3143-
-
3144-
message: "#^Result of && is always false\\.$#"
3145-
count: 1
3146-
path: app/code/core/Mage/Core/Controller/Request/Http.php
3147-
3148-
-
3149-
message: "#^Strict comparison using \\=\\=\\= between string and false will always evaluate to false\\.$#"
3150-
count: 1
3151-
path: app/code/core/Mage/Core/Controller/Request/Http.php
3152-
31533133
-
31543134
message: "#^Strict comparison using \\=\\=\\= between string and null will always evaluate to false\\.$#"
31553135
count: 2
@@ -3646,7 +3626,7 @@ parameters:
36463626
path: app/code/core/Mage/Core/Model/Resource/Setup.php
36473627

36483628
-
3649-
message: "#^Binary operation \"\\.\" between string and array results in an error\\.$#"
3629+
message: "#^Binary operation \"\\.\" between \\(string\\|false\\) and array results in an error\\.$#"
36503630
count: 1
36513631
path: app/code/core/Mage/Core/Model/Resource/Setup/Query/Modifier.php
36523632

@@ -5065,16 +5045,6 @@ parameters:
50655045
count: 2
50665046
path: app/code/core/Mage/Log/Model/Resource/Log.php
50675047

5068-
-
5069-
message: "#^Method Mage_Media_Model_File_Image\\:\\:getImage\\(\\) should return bool\\|resource but returns GdImage\\.$#"
5070-
count: 1
5071-
path: app/code/core/Mage/Media/Model/File/Image.php
5072-
5073-
-
5074-
message: "#^Method Mage_Media_Model_File_Image\\:\\:getTmpImage\\(\\) should return resource but returns GdImage\\|false\\.$#"
5075-
count: 1
5076-
path: app/code/core/Mage/Media/Model/File/Image.php
5077-
50785048
-
50795049
message: "#^Left side of && is always true\\.$#"
50805050
count: 1
@@ -5196,7 +5166,7 @@ parameters:
51965166
path: app/code/core/Mage/Payment/Model/Method/Abstract.php
51975167

51985168
-
5199-
message: "#^Binary operation \"\\*\\=\" between string and 2 results in an error\\.$#"
5169+
message: "#^Binary operation \"\\-\" between string and int\\<\\-9, 9\\> results in an error\\.$#"
52005170
count: 1
52015171
path: app/code/core/Mage/Payment/Model/Method/Cc.php
52025172

@@ -6900,26 +6870,6 @@ parameters:
69006870
count: 1
69016871
path: app/code/core/Mage/Tax/Model/Sales/Total/Quote/Tax.php
69026872

6903-
-
6904-
message: "#^Binary operation \"\\*\" between string and 1024 results in an error\\.$#"
6905-
count: 1
6906-
path: app/code/core/Mage/Uploader/Helper/File.php
6907-
6908-
-
6909-
message: "#^Binary operation \"\\*\" between string and 1048576 results in an error\\.$#"
6910-
count: 1
6911-
path: app/code/core/Mage/Uploader/Helper/File.php
6912-
6913-
-
6914-
message: "#^Binary operation \"\\*\" between string and 1073741824 results in an error\\.$#"
6915-
count: 1
6916-
path: app/code/core/Mage/Uploader/Helper/File.php
6917-
6918-
-
6919-
message: "#^Binary operation \"\\*\" between string and 1099511627776 results in an error\\.$#"
6920-
count: 1
6921-
path: app/code/core/Mage/Uploader/Helper/File.php
6922-
69236873
-
69246874
message: "#^Property Mage_Shipping_Model_Carrier_Abstract\\:\\:\\$_code \\(string\\) on left side of \\?\\? is not nullable\\.$#"
69256875
count: 1
@@ -7375,6 +7325,11 @@ parameters:
73757325
count: 2
73767326
path: lib/Mage/HTTP/Client/Curl.php
73777327

7328+
-
7329+
message: "#^Property Mage_HTTP_Client_Curl\\:\\:\\$_ch \\(object\\) does not accept resource\\.$#"
7330+
count: 1
7331+
path: lib/Mage/HTTP/Client/Curl.php
7332+
73787333
-
73797334
message: "#^Negated boolean expression is always false\\.$#"
73807335
count: 2
@@ -7745,16 +7700,36 @@ parameters:
77457700
count: 1
77467701
path: lib/Varien/Filter/Template/Tokenizer/Variable.php
77477702

7703+
-
7704+
message: "#^Method Varien_Http_Adapter_Curl\\:\\:_getResource\\(\\) has invalid return type CurlHandle\\.$#"
7705+
count: 1
7706+
path: lib/Varien/Http/Adapter/Curl.php
7707+
7708+
-
7709+
message: "#^Property Varien_Http_Adapter_Curl\\:\\:\\$_resource has unknown class CurlHandle as its type\\.$#"
7710+
count: 1
7711+
path: lib/Varien/Http/Adapter/Curl.php
7712+
77487713
-
77497714
message: "#^Method Varien_Image_Adapter_Abstract\\:\\:backgroundColor\\(\\) should return array but empty return statement found\\.$#"
77507715
count: 2
77517716
path: lib/Varien/Image/Adapter/Abstract.php
77527717

7718+
-
7719+
message: "#^Property Varien_Image_Adapter_Abstract\\:\\:\\$_imageHandler has unknown class GdImage as its type\\.$#"
7720+
count: 1
7721+
path: lib/Varien/Image/Adapter/Abstract.php
7722+
77537723
-
77547724
message: "#^Binary operation \"\\*\\=\" between string and 1024 results in an error\\.$#"
77557725
count: 1
77567726
path: lib/Varien/Image/Adapter/Gd2.php
77577727

7728+
-
7729+
message: "#^Class GdImage not found\\.$#"
7730+
count: 1
7731+
path: lib/Varien/Image/Adapter/Gd2.php
7732+
77587733
-
77597734
message: "#^Result of \\|\\| is always true\\.$#"
77607735
count: 1

phpstan.dist.neon

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ includes:
33
- phpstan.dist.issues.neon
44
- phpstan.dist.baseline.neon
55
parameters:
6-
phpVersion: 80000 # PHP 8.0
76
magentoRootPath: %currentWorkingDirectory%
87
paths:
98
- api.php

0 commit comments

Comments
 (0)