Skip to content

Commit a6315ec

Browse files
committed
Fixes to launch Magento with PHP 8.1
1 parent 0af0fba commit a6315ec

File tree

17 files changed

+72
-0
lines changed

17 files changed

+72
-0
lines changed

lib/internal/Magento/Framework/Api/Search/Document.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ public function setCustomAttributes(array $attributes)
7070
* @return \ArrayIterator
7171
* @since 100.1.0
7272
*/
73+
#[\ReturnTypeWillChange]
7374
public function getIterator()
7475
{
7576
$attributes = (array)$this->getCustomAttributes();

lib/internal/Magento/Framework/App/Cache/Frontend/Pool.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ protected function _getCacheSettings()
9797
*
9898
* @return \Magento\Framework\Cache\FrontendInterface
9999
*/
100+
#[\ReturnTypeWillChange]
100101
public function current()
101102
{
102103
$this->_initialize();
@@ -106,6 +107,7 @@ public function current()
106107
/**
107108
* @inheritdoc
108109
*/
110+
#[\ReturnTypeWillChange]
109111
public function key()
110112
{
111113
$this->_initialize();
@@ -115,6 +117,7 @@ public function key()
115117
/**
116118
* @inheritdoc
117119
*/
120+
#[\ReturnTypeWillChange]
118121
public function next()
119122
{
120123
$this->_initialize();
@@ -124,6 +127,7 @@ public function next()
124127
/**
125128
* @inheritdoc
126129
*/
130+
#[\ReturnTypeWillChange]
127131
public function rewind()
128132
{
129133
$this->_initialize();
@@ -133,6 +137,7 @@ public function rewind()
133137
/**
134138
* @inheritdoc
135139
*/
140+
#[\ReturnTypeWillChange]
136141
public function valid()
137142
{
138143
$this->_initialize();

lib/internal/Magento/Framework/App/RouterList.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ protected function getRouterInstance($routerId)
6060
* @link http://php.net/manual/en/iterator.current.php
6161
* @return RouterInterface
6262
*/
63+
#[\ReturnTypeWillChange]
6364
public function current()
6465
{
6566
return $this->getRouterInstance($this->key());
@@ -71,6 +72,7 @@ public function current()
7172
* @link http://php.net/manual/en/iterator.next.php
7273
* @return void Any returned value is ignored.
7374
*/
75+
#[\ReturnTypeWillChange]
7476
public function next()
7577
{
7678
next($this->routerList);
@@ -82,6 +84,7 @@ public function next()
8284
* @link http://php.net/manual/en/iterator.key.php
8385
* @return string|int|null
8486
*/
87+
#[\ReturnTypeWillChange]
8588
public function key()
8689
{
8790
return key($this->routerList);
@@ -94,6 +97,7 @@ public function key()
9497
* @return boolean The return value will be casted to boolean and then evaluated.
9598
* Returns true on success or false on failure.
9699
*/
100+
#[\ReturnTypeWillChange]
97101
public function valid()
98102
{
99103
return !!current($this->routerList);
@@ -105,6 +109,7 @@ public function valid()
105109
* @link http://php.net/manual/en/iterator.rewind.php
106110
* @return void Any returned value is ignored.
107111
*/
112+
#[\ReturnTypeWillChange]
108113
public function rewind()
109114
{
110115
reset($this->routerList);

lib/internal/Magento/Framework/Backup/Filesystem/Iterator/File.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class File extends \SplFileObject
2424
*
2525
* @return string
2626
*/
27+
#[\ReturnTypeWillChange]
2728
public function current()
2829
{
2930
return $this->_currentStatement;
@@ -34,6 +35,7 @@ public function current()
3435
*
3536
* @return void
3637
*/
38+
#[\ReturnTypeWillChange]
3739
public function next()
3840
{
3941
$this->_currentStatement = '';
@@ -53,6 +55,7 @@ public function next()
5355
*
5456
* @return void
5557
*/
58+
#[\ReturnTypeWillChange]
5659
public function rewind()
5760
{
5861
parent::rewind();

lib/internal/Magento/Framework/Backup/Filesystem/Iterator/Filter.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public function __construct(Iterator $iterator, array $filters)
3939
*
4040
* @return bool
4141
*/
42+
#[\ReturnTypeWillChange]
4243
public function accept()
4344
{
4445
$current = str_replace('\\', '/', $this->current()->__toString());

lib/internal/Magento/Framework/Config/CompositeFileIterator.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public function __construct(ReadFactory $readFactory, array $paths, FileIterator
3434
/**
3535
* @inheritDoc
3636
*/
37+
#[\ReturnTypeWillChange]
3738
public function rewind()
3839
{
3940
$this->existingIterator->rewind();
@@ -43,6 +44,7 @@ public function rewind()
4344
/**
4445
* @inheritDoc
4546
*/
47+
#[\ReturnTypeWillChange]
4648
public function current()
4749
{
4850
if ($this->existingIterator->valid()) {
@@ -55,6 +57,7 @@ public function current()
5557
/**
5658
* @inheritDoc
5759
*/
60+
#[\ReturnTypeWillChange]
5861
public function key()
5962
{
6063
if ($this->existingIterator->valid()) {
@@ -67,6 +70,7 @@ public function key()
6770
/**
6871
* @inheritDoc
6972
*/
73+
#[\ReturnTypeWillChange]
7074
public function next()
7175
{
7276
if ($this->existingIterator->valid()) {
@@ -79,6 +83,7 @@ public function next()
7983
/**
8084
* @inheritDoc
8185
*/
86+
#[\ReturnTypeWillChange]
8287
public function valid()
8388
{
8489
return $this->existingIterator->valid() || parent::valid();
@@ -95,6 +100,7 @@ public function toArray()
95100
/**
96101
* @inheritDoc
97102
*/
103+
#[\ReturnTypeWillChange]
98104
public function count()
99105
{
100106
return $this->existingIterator->count() + parent::count();

lib/internal/Magento/Framework/Config/FileIterator.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public function __construct(ReadFactory $readFactory, array $paths)
5555
*
5656
* @return void
5757
*/
58+
#[\ReturnTypeWillChange]
5859
public function rewind()
5960
{
6061
reset($this->paths);
@@ -65,6 +66,7 @@ public function rewind()
6566
*
6667
* @return string
6768
*/
69+
#[\ReturnTypeWillChange]
6870
public function current()
6971
{
7072
$fileRead = $this->fileReadFactory->create($this->key(), DriverPool::FILE);
@@ -76,6 +78,7 @@ public function current()
7678
*
7779
* @return mixed
7880
*/
81+
#[\ReturnTypeWillChange]
7982
public function key()
8083
{
8184
return current($this->paths);
@@ -86,6 +89,7 @@ public function key()
8689
*
8790
* @return void
8891
*/
92+
#[\ReturnTypeWillChange]
8993
public function next()
9094
{
9195
next($this->paths);
@@ -96,6 +100,7 @@ public function next()
96100
*
97101
* @return bool
98102
*/
103+
#[\ReturnTypeWillChange]
99104
public function valid()
100105
{
101106
return (bool) $this->key();
@@ -106,6 +111,7 @@ public function valid()
106111
*
107112
* @return array
108113
*/
114+
#[\ReturnTypeWillChange]
109115
public function toArray()
110116
{
111117
$result = [];
@@ -120,6 +126,7 @@ public function toArray()
120126
*
121127
* @return int
122128
*/
129+
#[\ReturnTypeWillChange]
123130
public function count()
124131
{
125132
return count($this->paths);

lib/internal/Magento/Framework/Data/Collection.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,7 @@ protected function _toOptionArray($valueField = 'id', $labelField = 'name', $add
780780
*
781781
* @return array
782782
*/
783+
#[\ReturnTypeWillChange]
783784
public function toOptionArray()
784785
{
785786
return $this->_toOptionArray();
@@ -834,6 +835,7 @@ public function getItemById($idValue)
834835
*
835836
* @return \ArrayIterator
836837
*/
838+
#[\ReturnTypeWillChange]
837839
public function getIterator()
838840
{
839841
$this->load();
@@ -845,6 +847,7 @@ public function getIterator()
845847
*
846848
* @return int
847849
*/
850+
#[\ReturnTypeWillChange]
848851
public function count()
849852
{
850853
$this->load();

lib/internal/Magento/Framework/Data/Form/Element/Collection.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public function __construct(AbstractForm $container)
4545
*
4646
* @return \ArrayIterator
4747
*/
48+
#[\ReturnTypeWillChange]
4849
public function getIterator()
4950
{
5051
return new \ArrayIterator($this->_elements);
@@ -57,6 +58,7 @@ public function getIterator()
5758
* @param mixed $value
5859
* @return void
5960
*/
61+
#[\ReturnTypeWillChange]
6062
public function offsetSet($key, $value)
6163
{
6264
$this->_elements[$key] = $value;
@@ -68,6 +70,7 @@ public function offsetSet($key, $value)
6870
* @param mixed $key
6971
* @return AbstractElement
7072
*/
73+
#[\ReturnTypeWillChange]
7174
public function offsetGet($key)
7275
{
7376
return $this->_elements[$key];
@@ -79,6 +82,7 @@ public function offsetGet($key)
7982
* @param mixed $key
8083
* @return void
8184
*/
85+
#[\ReturnTypeWillChange]
8286
public function offsetUnset($key)
8387
{
8488
unset($this->_elements[$key]);
@@ -90,6 +94,7 @@ public function offsetUnset($key)
9094
* @param mixed $key
9195
* @return boolean
9296
*/
97+
#[\ReturnTypeWillChange]
9398
public function offsetExists($key)
9499
{
95100
return isset($this->_elements[$key]);
@@ -167,6 +172,7 @@ public function remove($elementId)
167172
*
168173
* @return int
169174
*/
175+
#[\ReturnTypeWillChange]
170176
public function count()
171177
{
172178
return count($this->_elements);

lib/internal/Magento/Framework/Data/SearchResultIterator.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public function __construct(AbstractSearchResult $searchResult, QueryInterface $
4545
/**
4646
* @return array|mixed
4747
*/
48+
#[\ReturnTypeWillChange]
4849
public function current()
4950
{
5051
return $this->current;
@@ -53,6 +54,7 @@ public function current()
5354
/**
5455
* @return void
5556
*/
57+
#[\ReturnTypeWillChange]
5658
public function next()
5759
{
5860
++$this->key;
@@ -62,6 +64,7 @@ public function next()
6264
/**
6365
* @return int|mixed
6466
*/
67+
#[\ReturnTypeWillChange]
6568
public function key()
6669
{
6770
return $this->key;
@@ -70,6 +73,7 @@ public function key()
7073
/**
7174
* @return bool
7275
*/
76+
#[\ReturnTypeWillChange]
7377
public function valid()
7478
{
7579
return !empty($this->current);
@@ -78,6 +82,7 @@ public function valid()
7882
/**
7983
* @return void
8084
*/
85+
#[\ReturnTypeWillChange]
8186
public function rewind()
8287
{
8388
$this->current = null;

lib/internal/Magento/Framework/Data/Tree/Node/Collection.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public function getNodes()
5454
*
5555
* @return \ArrayIterator
5656
*/
57+
#[\ReturnTypeWillChange]
5758
public function getIterator()
5859
{
5960
return new \ArrayIterator($this->_nodes);
@@ -66,6 +67,7 @@ public function getIterator()
6667
* @param mixed $value
6768
* @return void
6869
*/
70+
#[\ReturnTypeWillChange]
6971
public function offsetSet($key, $value)
7072
{
7173
$this->_nodes[$key] = $value;
@@ -76,6 +78,7 @@ public function offsetSet($key, $value)
7678
* @param string $key
7779
* @return mixed
7880
*/
81+
#[\ReturnTypeWillChange]
7982
public function offsetGet($key)
8083
{
8184
return $this->_nodes[$key];
@@ -86,6 +89,7 @@ public function offsetGet($key)
8689
* @param string $key
8790
* @return void
8891
*/
92+
#[\ReturnTypeWillChange]
8993
public function offsetUnset($key)
9094
{
9195
unset($this->_nodes[$key]);
@@ -96,6 +100,7 @@ public function offsetUnset($key)
96100
* @param string $key
97101
* @return bool
98102
*/
103+
#[\ReturnTypeWillChange]
99104
public function offsetExists($key)
100105
{
101106
return isset($this->_nodes[$key]);
@@ -139,6 +144,7 @@ public function delete($node)
139144
*
140145
* @return int
141146
*/
147+
#[\ReturnTypeWillChange]
142148
public function count()
143149
{
144150
return count($this->_nodes);

0 commit comments

Comments
 (0)