Skip to content

Fixes to launch Magento with PHP 8.1 - part 2 #34638

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions lib/internal/Magento/Framework/Api/Search/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,31 @@
class Document extends AbstractSimpleObject implements DocumentInterface, \IteratorAggregate
{
/**
* {@inheritdoc}
* @inheritdoc
*/
public function getId()
{
return $this->_get(self::ID);
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function setId($id)
{
return $this->setData(self::ID, $id);
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function getCustomAttribute($attributeCode)
{
return $this->_data[self::CUSTOM_ATTRIBUTES][$attributeCode] ?? null;
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function setCustomAttribute($attributeCode, $attributeValue)
{
Expand All @@ -49,15 +49,15 @@ public function setCustomAttribute($attributeCode, $attributeValue)
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function getCustomAttributes()
{
return $this->_get(self::CUSTOM_ATTRIBUTES);
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function setCustomAttributes(array $attributes)
{
Expand All @@ -70,6 +70,7 @@ public function setCustomAttributes(array $attributes)
* @return \ArrayIterator
* @since 100.1.0
*/
#[\ReturnTypeWillChange]
public function getIterator()
{
$attributes = (array)$this->getCustomAttributes();
Expand Down
5 changes: 5 additions & 0 deletions lib/internal/Magento/Framework/App/Cache/Frontend/Pool.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ protected function _getCacheSettings()
*
* @return \Magento\Framework\Cache\FrontendInterface
*/
#[\ReturnTypeWillChange]
public function current()
{
$this->_initialize();
Expand All @@ -106,6 +107,7 @@ public function current()
/**
* @inheritdoc
*/
#[\ReturnTypeWillChange]
public function key()
{
$this->_initialize();
Expand All @@ -115,6 +117,7 @@ public function key()
/**
* @inheritdoc
*/
#[\ReturnTypeWillChange]
public function next()
{
$this->_initialize();
Expand All @@ -124,6 +127,7 @@ public function next()
/**
* @inheritdoc
*/
#[\ReturnTypeWillChange]
public function rewind()
{
$this->_initialize();
Expand All @@ -133,6 +137,7 @@ public function rewind()
/**
* @inheritdoc
*/
#[\ReturnTypeWillChange]
public function valid()
{
$this->_initialize();
Expand Down
36 changes: 12 additions & 24 deletions lib/internal/Magento/Framework/App/RouterList.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<?php
/**
* Router list
* Used as a container for list of routers
*
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Framework\App;

/** * Used as a container for list of routers.
*/
class RouterList implements RouterListInterface
{
/**
Expand Down Expand Up @@ -55,56 +54,45 @@ protected function getRouterInstance($routerId)
}

/**
* (PHP 5 &gt;= 5.0.0)<br/>
* Return the current element
* @link http://php.net/manual/en/iterator.current.php
* @return RouterInterface
* @inheritdoc
*/
#[\ReturnTypeWillChange]
public function current()
{
return $this->getRouterInstance($this->key());
}

/**
* (PHP 5 &gt;= 5.0.0)<br/>
* Move forward to next element
* @link http://php.net/manual/en/iterator.next.php
* @return void Any returned value is ignored.
* @inheritdoc
*/
#[\ReturnTypeWillChange]
public function next()
{
next($this->routerList);
}

/**
* (PHP 5 &gt;= 5.0.0)<br/>
* Return the key of the current element
* @link http://php.net/manual/en/iterator.key.php
* @return string|int|null
* @inheritdoc
*/
#[\ReturnTypeWillChange]
public function key()
{
return key($this->routerList);
}

/**
* (PHP 5 &gt;= 5.0.0)<br/>
* Checks if current position is valid
* @link http://php.net/manual/en/iterator.valid.php
* @return boolean The return value will be casted to boolean and then evaluated.
* Returns true on success or false on failure.
* @inheritdoc
*/
#[\ReturnTypeWillChange]
public function valid()
{
return !!current($this->routerList);
}

/**
* (PHP 5 &gt;= 5.0.0)<br/>
* Rewind the Iterator to the first element
* @link http://php.net/manual/en/iterator.rewind.php
* @return void Any returned value is ignored.
* @inheritdoc
*/
#[\ReturnTypeWillChange]
public function rewind()
{
reset($this->routerList);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class File extends \SplFileObject
*
* @return string
*/
#[\ReturnTypeWillChange]
public function current()
{
return $this->_currentStatement;
Expand All @@ -34,6 +35,7 @@ public function current()
*
* @return void
*/
#[\ReturnTypeWillChange]
public function next()
{
$this->_currentStatement = '';
Expand All @@ -53,6 +55,7 @@ public function next()
*
* @return void
*/
#[\ReturnTypeWillChange]
public function rewind()
{
parent::rewind();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public function __construct(Iterator $iterator, array $filters)
*
* @return bool
*/
#[\ReturnTypeWillChange]
public function accept()
{
$current = str_replace('\\', '/', $this->current()->__toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public function __construct(ReadFactory $readFactory, array $paths, FileIterator
/**
* @inheritDoc
*/
#[\ReturnTypeWillChange]
public function rewind()
{
$this->existingIterator->rewind();
Expand All @@ -43,6 +44,7 @@ public function rewind()
/**
* @inheritDoc
*/
#[\ReturnTypeWillChange]
public function current()
{
if ($this->existingIterator->valid()) {
Expand All @@ -55,6 +57,7 @@ public function current()
/**
* @inheritDoc
*/
#[\ReturnTypeWillChange]
public function key()
{
if ($this->existingIterator->valid()) {
Expand All @@ -67,6 +70,7 @@ public function key()
/**
* @inheritDoc
*/
#[\ReturnTypeWillChange]
public function next()
{
if ($this->existingIterator->valid()) {
Expand All @@ -79,6 +83,7 @@ public function next()
/**
* @inheritDoc
*/
#[\ReturnTypeWillChange]
public function valid()
{
return $this->existingIterator->valid() || parent::valid();
Expand All @@ -95,6 +100,7 @@ public function toArray()
/**
* @inheritDoc
*/
#[\ReturnTypeWillChange]
public function count()
{
return $this->existingIterator->count() + parent::count();
Expand Down
14 changes: 7 additions & 7 deletions lib/internal/Magento/Framework/Config/FileIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,22 @@
use Magento\Framework\Filesystem\File\ReadFactory;

/**
* Class FileIterator
* @api
* @since 100.0.2
*/
class FileIterator implements \Iterator, \Countable
{
/**
* Paths
*
* @var array
*/
protected $paths = [];

/**
* Position
*
* @var int
*/
protected $position;

/**
* File read factory
*
* @var ReadFactory
*/
protected $fileReadFactory;
Expand All @@ -55,6 +48,7 @@ public function __construct(ReadFactory $readFactory, array $paths)
*
* @return void
*/
#[\ReturnTypeWillChange]
public function rewind()
{
reset($this->paths);
Expand All @@ -65,6 +59,7 @@ public function rewind()
*
* @return string
*/
#[\ReturnTypeWillChange]
public function current()
{
$fileRead = $this->fileReadFactory->create($this->key(), DriverPool::FILE);
Expand All @@ -76,6 +71,7 @@ public function current()
*
* @return mixed
*/
#[\ReturnTypeWillChange]
public function key()
{
return current($this->paths);
Expand All @@ -86,6 +82,7 @@ public function key()
*
* @return void
*/
#[\ReturnTypeWillChange]
public function next()
{
next($this->paths);
Expand All @@ -96,6 +93,7 @@ public function next()
*
* @return bool
*/
#[\ReturnTypeWillChange]
public function valid()
{
return (bool) $this->key();
Expand All @@ -106,6 +104,7 @@ public function valid()
*
* @return array
*/
#[\ReturnTypeWillChange]
public function toArray()
{
$result = [];
Expand All @@ -120,6 +119,7 @@ public function toArray()
*
* @return int
*/
#[\ReturnTypeWillChange]
public function count()
{
return count($this->paths);
Expand Down
3 changes: 3 additions & 0 deletions lib/internal/Magento/Framework/Data/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,7 @@ protected function _toOptionArray($valueField = 'id', $labelField = 'name', $add
*
* @return array
*/
#[\ReturnTypeWillChange]
public function toOptionArray()
{
return $this->_toOptionArray();
Expand Down Expand Up @@ -834,6 +835,7 @@ public function getItemById($idValue)
*
* @return \ArrayIterator
*/
#[\ReturnTypeWillChange]
public function getIterator()
{
$this->load();
Expand All @@ -845,6 +847,7 @@ public function getIterator()
*
* @return int
*/
#[\ReturnTypeWillChange]
public function count()
{
$this->load();
Expand Down
Loading