diff --git a/lib/internal/Magento/Framework/Api/Search/Document.php b/lib/internal/Magento/Framework/Api/Search/Document.php index c1edec9860f67..555b1525013ce 100644 --- a/lib/internal/Magento/Framework/Api/Search/Document.php +++ b/lib/internal/Magento/Framework/Api/Search/Document.php @@ -14,7 +14,7 @@ class Document extends AbstractSimpleObject implements DocumentInterface, \IteratorAggregate { /** - * {@inheritdoc} + * @inheritdoc */ public function getId() { @@ -22,7 +22,7 @@ public function getId() } /** - * {@inheritdoc} + * @inheritdoc */ public function setId($id) { @@ -30,7 +30,7 @@ public function setId($id) } /** - * {@inheritdoc} + * @inheritdoc */ public function getCustomAttribute($attributeCode) { @@ -38,7 +38,7 @@ public function getCustomAttribute($attributeCode) } /** - * {@inheritdoc} + * @inheritdoc */ public function setCustomAttribute($attributeCode, $attributeValue) { @@ -49,7 +49,7 @@ public function setCustomAttribute($attributeCode, $attributeValue) } /** - * {@inheritdoc} + * @inheritdoc */ public function getCustomAttributes() { @@ -57,7 +57,7 @@ public function getCustomAttributes() } /** - * {@inheritdoc} + * @inheritdoc */ public function setCustomAttributes(array $attributes) { @@ -70,6 +70,7 @@ public function setCustomAttributes(array $attributes) * @return \ArrayIterator * @since 100.1.0 */ + #[\ReturnTypeWillChange] public function getIterator() { $attributes = (array)$this->getCustomAttributes(); diff --git a/lib/internal/Magento/Framework/App/Cache/Frontend/Pool.php b/lib/internal/Magento/Framework/App/Cache/Frontend/Pool.php index daa7cba20139d..dff5d4cc1576d 100644 --- a/lib/internal/Magento/Framework/App/Cache/Frontend/Pool.php +++ b/lib/internal/Magento/Framework/App/Cache/Frontend/Pool.php @@ -97,6 +97,7 @@ protected function _getCacheSettings() * * @return \Magento\Framework\Cache\FrontendInterface */ + #[\ReturnTypeWillChange] public function current() { $this->_initialize(); @@ -106,6 +107,7 @@ public function current() /** * @inheritdoc */ + #[\ReturnTypeWillChange] public function key() { $this->_initialize(); @@ -115,6 +117,7 @@ public function key() /** * @inheritdoc */ + #[\ReturnTypeWillChange] public function next() { $this->_initialize(); @@ -124,6 +127,7 @@ public function next() /** * @inheritdoc */ + #[\ReturnTypeWillChange] public function rewind() { $this->_initialize(); @@ -133,6 +137,7 @@ public function rewind() /** * @inheritdoc */ + #[\ReturnTypeWillChange] public function valid() { $this->_initialize(); diff --git a/lib/internal/Magento/Framework/App/RouterList.php b/lib/internal/Magento/Framework/App/RouterList.php index 75ea8766c960f..ec8da3864fef9 100644 --- a/lib/internal/Magento/Framework/App/RouterList.php +++ b/lib/internal/Magento/Framework/App/RouterList.php @@ -1,13 +1,12 @@ - * 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 >= 5.0.0)
- * 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 >= 5.0.0)
- * 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 >= 5.0.0)
- * 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 >= 5.0.0)
- * 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); diff --git a/lib/internal/Magento/Framework/Backup/Filesystem/Iterator/File.php b/lib/internal/Magento/Framework/Backup/Filesystem/Iterator/File.php index 9602807a8aedb..36eb0c9e5a96d 100644 --- a/lib/internal/Magento/Framework/Backup/Filesystem/Iterator/File.php +++ b/lib/internal/Magento/Framework/Backup/Filesystem/Iterator/File.php @@ -24,6 +24,7 @@ class File extends \SplFileObject * * @return string */ + #[\ReturnTypeWillChange] public function current() { return $this->_currentStatement; @@ -34,6 +35,7 @@ public function current() * * @return void */ + #[\ReturnTypeWillChange] public function next() { $this->_currentStatement = ''; @@ -53,6 +55,7 @@ public function next() * * @return void */ + #[\ReturnTypeWillChange] public function rewind() { parent::rewind(); diff --git a/lib/internal/Magento/Framework/Backup/Filesystem/Iterator/Filter.php b/lib/internal/Magento/Framework/Backup/Filesystem/Iterator/Filter.php index ae7805e716a73..0cf1834ca1247 100644 --- a/lib/internal/Magento/Framework/Backup/Filesystem/Iterator/Filter.php +++ b/lib/internal/Magento/Framework/Backup/Filesystem/Iterator/Filter.php @@ -39,6 +39,7 @@ public function __construct(Iterator $iterator, array $filters) * * @return bool */ + #[\ReturnTypeWillChange] public function accept() { $current = str_replace('\\', '/', $this->current()->__toString()); diff --git a/lib/internal/Magento/Framework/Config/CompositeFileIterator.php b/lib/internal/Magento/Framework/Config/CompositeFileIterator.php index 904afa4f00c49..7ea3c0a3e8c14 100644 --- a/lib/internal/Magento/Framework/Config/CompositeFileIterator.php +++ b/lib/internal/Magento/Framework/Config/CompositeFileIterator.php @@ -34,6 +34,7 @@ public function __construct(ReadFactory $readFactory, array $paths, FileIterator /** * @inheritDoc */ + #[\ReturnTypeWillChange] public function rewind() { $this->existingIterator->rewind(); @@ -43,6 +44,7 @@ public function rewind() /** * @inheritDoc */ + #[\ReturnTypeWillChange] public function current() { if ($this->existingIterator->valid()) { @@ -55,6 +57,7 @@ public function current() /** * @inheritDoc */ + #[\ReturnTypeWillChange] public function key() { if ($this->existingIterator->valid()) { @@ -67,6 +70,7 @@ public function key() /** * @inheritDoc */ + #[\ReturnTypeWillChange] public function next() { if ($this->existingIterator->valid()) { @@ -79,6 +83,7 @@ public function next() /** * @inheritDoc */ + #[\ReturnTypeWillChange] public function valid() { return $this->existingIterator->valid() || parent::valid(); @@ -95,6 +100,7 @@ public function toArray() /** * @inheritDoc */ + #[\ReturnTypeWillChange] public function count() { return $this->existingIterator->count() + parent::count(); diff --git a/lib/internal/Magento/Framework/Config/FileIterator.php b/lib/internal/Magento/Framework/Config/FileIterator.php index 7cf1f34b6deb6..83fc5fa95d7bf 100644 --- a/lib/internal/Magento/Framework/Config/FileIterator.php +++ b/lib/internal/Magento/Framework/Config/FileIterator.php @@ -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; @@ -55,6 +48,7 @@ public function __construct(ReadFactory $readFactory, array $paths) * * @return void */ + #[\ReturnTypeWillChange] public function rewind() { reset($this->paths); @@ -65,6 +59,7 @@ public function rewind() * * @return string */ + #[\ReturnTypeWillChange] public function current() { $fileRead = $this->fileReadFactory->create($this->key(), DriverPool::FILE); @@ -76,6 +71,7 @@ public function current() * * @return mixed */ + #[\ReturnTypeWillChange] public function key() { return current($this->paths); @@ -86,6 +82,7 @@ public function key() * * @return void */ + #[\ReturnTypeWillChange] public function next() { next($this->paths); @@ -96,6 +93,7 @@ public function next() * * @return bool */ + #[\ReturnTypeWillChange] public function valid() { return (bool) $this->key(); @@ -106,6 +104,7 @@ public function valid() * * @return array */ + #[\ReturnTypeWillChange] public function toArray() { $result = []; @@ -120,6 +119,7 @@ public function toArray() * * @return int */ + #[\ReturnTypeWillChange] public function count() { return count($this->paths); diff --git a/lib/internal/Magento/Framework/Data/Collection.php b/lib/internal/Magento/Framework/Data/Collection.php index b8bb57ab03d6c..581abc13dbcd1 100644 --- a/lib/internal/Magento/Framework/Data/Collection.php +++ b/lib/internal/Magento/Framework/Data/Collection.php @@ -780,6 +780,7 @@ protected function _toOptionArray($valueField = 'id', $labelField = 'name', $add * * @return array */ + #[\ReturnTypeWillChange] public function toOptionArray() { return $this->_toOptionArray(); @@ -834,6 +835,7 @@ public function getItemById($idValue) * * @return \ArrayIterator */ + #[\ReturnTypeWillChange] public function getIterator() { $this->load(); @@ -845,6 +847,7 @@ public function getIterator() * * @return int */ + #[\ReturnTypeWillChange] public function count() { $this->load(); diff --git a/lib/internal/Magento/Framework/Data/Form/Element/Collection.php b/lib/internal/Magento/Framework/Data/Form/Element/Collection.php index ced1f4208223d..e1b45feb99a3d 100644 --- a/lib/internal/Magento/Framework/Data/Form/Element/Collection.php +++ b/lib/internal/Magento/Framework/Data/Form/Element/Collection.php @@ -45,6 +45,7 @@ public function __construct(AbstractForm $container) * * @return \ArrayIterator */ + #[\ReturnTypeWillChange] public function getIterator() { return new \ArrayIterator($this->_elements); @@ -57,6 +58,7 @@ public function getIterator() * @param mixed $value * @return void */ + #[\ReturnTypeWillChange] public function offsetSet($key, $value) { $this->_elements[$key] = $value; @@ -68,6 +70,7 @@ public function offsetSet($key, $value) * @param mixed $key * @return AbstractElement */ + #[\ReturnTypeWillChange] public function offsetGet($key) { return $this->_elements[$key]; @@ -79,6 +82,7 @@ public function offsetGet($key) * @param mixed $key * @return void */ + #[\ReturnTypeWillChange] public function offsetUnset($key) { unset($this->_elements[$key]); @@ -90,6 +94,7 @@ public function offsetUnset($key) * @param mixed $key * @return boolean */ + #[\ReturnTypeWillChange] public function offsetExists($key) { return isset($this->_elements[$key]); @@ -121,6 +126,7 @@ public function add(AbstractElement $element, $after = false) if ($currElement->getId() == $after) { $newOrderElements[] = $currElement; $newOrderElements[] = $element; + // phpcs:ignore Magento2.Performance.ForeachArrayMerge $this->_elements = array_merge($newOrderElements, array_slice($this->_elements, $index + 1)); return $element; } @@ -167,6 +173,7 @@ public function remove($elementId) * * @return int */ + #[\ReturnTypeWillChange] public function count() { return count($this->_elements); diff --git a/lib/internal/Magento/Framework/Data/SearchResultIterator.php b/lib/internal/Magento/Framework/Data/SearchResultIterator.php index 62d5b88f0d5c7..4904f53291c6b 100644 --- a/lib/internal/Magento/Framework/Data/SearchResultIterator.php +++ b/lib/internal/Magento/Framework/Data/SearchResultIterator.php @@ -7,9 +7,6 @@ use Magento\Framework\DB\QueryInterface; -/** - * Class SearchResultIterator - */ class SearchResultIterator implements \Iterator { /** @@ -43,16 +40,20 @@ public function __construct(AbstractSearchResult $searchResult, QueryInterface $ } /** + * @inheritdoc + * * @return array|mixed */ + #[\ReturnTypeWillChange] public function current() { return $this->current; } /** - * @return void + * @inheritdoc */ + #[\ReturnTypeWillChange] public function next() { ++$this->key; @@ -60,24 +61,29 @@ public function next() } /** + * @inheritdoc + * * @return int|mixed */ + #[\ReturnTypeWillChange] public function key() { return $this->key; } /** - * @return bool + * @inheritdoc */ + #[\ReturnTypeWillChange] public function valid() { return !empty($this->current); } /** - * @return void + * @inheritdoc */ + #[\ReturnTypeWillChange] public function rewind() { $this->current = null; diff --git a/lib/internal/Magento/Framework/Data/Tree/Node/Collection.php b/lib/internal/Magento/Framework/Data/Tree/Node/Collection.php index cf6529988eb44..e35a2ac5d991e 100644 --- a/lib/internal/Magento/Framework/Data/Tree/Node/Collection.php +++ b/lib/internal/Magento/Framework/Data/Tree/Node/Collection.php @@ -3,18 +3,14 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -/** - * Tree node collection - * - * @author Magento Core Team - */ namespace Magento\Framework\Data\Tree\Node; use Magento\Framework\Data\Tree; use Magento\Framework\Data\Tree\Node; /** + * Tree node collection + * * @api * @since 100.0.2 */ @@ -54,6 +50,7 @@ public function getNodes() * * @return \ArrayIterator */ + #[\ReturnTypeWillChange] public function getIterator() { return new \ArrayIterator($this->_nodes); @@ -66,6 +63,7 @@ public function getIterator() * @param mixed $value * @return void */ + #[\ReturnTypeWillChange] public function offsetSet($key, $value) { $this->_nodes[$key] = $value; @@ -73,9 +71,11 @@ public function offsetSet($key, $value) /** * Implementation of \ArrayAccess:offsetGet() + * * @param string $key * @return mixed */ + #[\ReturnTypeWillChange] public function offsetGet($key) { return $this->_nodes[$key]; @@ -83,9 +83,11 @@ public function offsetGet($key) /** * Implementation of \ArrayAccess:offsetUnset() + * * @param string $key * @return void */ + #[\ReturnTypeWillChange] public function offsetUnset($key) { unset($this->_nodes[$key]); @@ -93,9 +95,11 @@ public function offsetUnset($key) /** * Implementation of \ArrayAccess:offsetExists() + * * @param string $key * @return bool */ + #[\ReturnTypeWillChange] public function offsetExists($key) { return isset($this->_nodes[$key]); @@ -103,6 +107,7 @@ public function offsetExists($key) /** * Adds a node to this node + * * @param Node $node * @return Node */ @@ -139,6 +144,7 @@ public function delete($node) * * @return int */ + #[\ReturnTypeWillChange] public function count() { return count($this->_nodes); diff --git a/lib/internal/Magento/Framework/DataObject.php b/lib/internal/Magento/Framework/DataObject.php index 0e7e96808d67f..ecd2d65bff42e 100644 --- a/lib/internal/Magento/Framework/DataObject.php +++ b/lib/internal/Magento/Framework/DataObject.php @@ -503,6 +503,7 @@ public function debug($data = null, &$objects = []) * @return void * @link http://www.php.net/manual/en/arrayaccess.offsetset.php */ + #[\ReturnTypeWillChange] public function offsetSet($offset, $value) { $this->_data[$offset] = $value; @@ -515,6 +516,7 @@ public function offsetSet($offset, $value) * @return bool * @link http://www.php.net/manual/en/arrayaccess.offsetexists.php */ + #[\ReturnTypeWillChange] public function offsetExists($offset) { return isset($this->_data[$offset]) || array_key_exists($offset, $this->_data); @@ -527,6 +529,7 @@ public function offsetExists($offset) * @return void * @link http://www.php.net/manual/en/arrayaccess.offsetunset.php */ + #[\ReturnTypeWillChange] public function offsetUnset($offset) { unset($this->_data[$offset]); @@ -539,6 +542,7 @@ public function offsetUnset($offset) * @return mixed * @link http://www.php.net/manual/en/arrayaccess.offsetget.php */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { if (isset($this->_data[$offset])) { diff --git a/lib/internal/Magento/Framework/Phrase.php b/lib/internal/Magento/Framework/Phrase.php index 3034dfc30a9e2..1f53b0a2b71d8 100644 --- a/lib/internal/Magento/Framework/Phrase.php +++ b/lib/internal/Magento/Framework/Phrase.php @@ -1,7 +1,5 @@ render(); diff --git a/lib/internal/Magento/Framework/Session/SaveHandler.php b/lib/internal/Magento/Framework/Session/SaveHandler.php index 5891b8880b627..c21ccab042373 100644 --- a/lib/internal/Magento/Framework/Session/SaveHandler.php +++ b/lib/internal/Magento/Framework/Session/SaveHandler.php @@ -76,6 +76,7 @@ public function __construct( * @param string $name * @return bool */ + #[\ReturnTypeWillChange] public function open($savePath, $name) { return $this->callSafely('open', $savePath, $name); @@ -86,6 +87,7 @@ public function open($savePath, $name) * * @return bool */ + #[\ReturnTypeWillChange] public function close() { return $this->callSafely('close'); @@ -97,6 +99,7 @@ public function close() * @param string $sessionId * @return string */ + #[\ReturnTypeWillChange] public function read($sessionId) { return $this->callSafely('read', $sessionId); @@ -110,6 +113,7 @@ public function read($sessionId) * @return bool * @throws LocalizedException */ + #[\ReturnTypeWillChange] public function write($sessionId, $data) { $sessionMaxSize = $this->sessionMaxSizeConfig->getSessionMaxSize(); @@ -136,6 +140,7 @@ public function write($sessionId, $data) * @param string $sessionId * @return bool */ + #[\ReturnTypeWillChange] public function destroy($sessionId) { return $this->callSafely('destroy', $sessionId); @@ -148,6 +153,7 @@ public function destroy($sessionId) * @return bool * @SuppressWarnings(PHPMD.ShortMethodName) */ + #[\ReturnTypeWillChange] public function gc($maxLifetime) { return $this->callSafely('gc', $maxLifetime); diff --git a/lib/internal/Magento/Framework/Session/SaveHandler/DbTable.php b/lib/internal/Magento/Framework/Session/SaveHandler/DbTable.php index 2f5a5a8610bf9..6f1bb9442978b 100644 --- a/lib/internal/Magento/Framework/Session/SaveHandler/DbTable.php +++ b/lib/internal/Magento/Framework/Session/SaveHandler/DbTable.php @@ -83,6 +83,7 @@ protected function checkConnection() * @return bool * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ + #[\ReturnTypeWillChange] public function open($savePath, $sessionName) { return true; @@ -93,6 +94,7 @@ public function open($savePath, $sessionName) * * @return bool */ + #[\ReturnTypeWillChange] public function close() { return true; @@ -104,6 +106,7 @@ public function close() * @param string $sessionId * @return string */ + #[\ReturnTypeWillChange] public function read($sessionId) { // need to use write connection to get the most fresh DB sessions @@ -131,6 +134,7 @@ public function read($sessionId) * @param string $sessionData * @return bool */ + #[\ReturnTypeWillChange] public function write($sessionId, $sessionData) { $hashedSessionId = $this->encryptor->hash($sessionId); @@ -158,6 +162,7 @@ public function write($sessionId, $sessionData) * @param string $sessionId * @return bool */ + #[\ReturnTypeWillChange] public function destroy($sessionId) { $where = ['session_id = ?' => $this->encryptor->hash($sessionId)]; @@ -172,6 +177,7 @@ public function destroy($sessionId) * @return bool * @SuppressWarnings(PHPMD.ShortMethodName) */ + #[\ReturnTypeWillChange] public function gc($maxLifeTime) { $where = ['session_expires < ?' => time() - $maxLifeTime]; diff --git a/lib/internal/Magento/Framework/Session/SaveHandler/Native.php b/lib/internal/Magento/Framework/Session/SaveHandler/Native.php index 95238482e19ce..207af54e9abf6 100644 --- a/lib/internal/Magento/Framework/Session/SaveHandler/Native.php +++ b/lib/internal/Magento/Framework/Session/SaveHandler/Native.php @@ -12,13 +12,15 @@ class Native extends \SessionHandler { /** * Workaround for php7 session_regenerate_id error + * * @see https://bugs.php.net/bug.php?id=71187 * * @param string $sessionId * @return string */ + #[\ReturnTypeWillChange] public function read($sessionId) { - return (string)parent::read($sessionId); + return (string) parent::read($sessionId); } } diff --git a/lib/internal/Magento/Framework/Session/SaveHandler/Redis.php b/lib/internal/Magento/Framework/Session/SaveHandler/Redis.php index cd1cef5da6ddd..d4ace455cdd8b 100644 --- a/lib/internal/Magento/Framework/Session/SaveHandler/Redis.php +++ b/lib/internal/Magento/Framework/Session/SaveHandler/Redis.php @@ -76,6 +76,7 @@ private function getConnection() * @return bool * @throws SessionException */ + #[\ReturnTypeWillChange] public function open($savePath, $sessionName) { return $this->getConnection()->open($savePath, $sessionName); @@ -85,17 +86,21 @@ public function open($savePath, $sessionName) * Fetch session data * * @param string $sessionId - * @return string - * @throws ConcurrentConnectionsExceededException + * @return string|false * @throws SessionException */ + #[\ReturnTypeWillChange] public function read($sessionId) { + $result = false; + try { - return $this->getConnection()->read($sessionId); + $result = $this->getConnection()->read($sessionId); } catch (ConcurrentConnectionsExceededException $e) { require $this->filesystem->getDirectoryRead(DirectoryList::PUB)->getAbsolutePath('errors/503.php'); } + + return $result; } /** @@ -106,6 +111,7 @@ public function read($sessionId) * @return boolean * @throws SessionException */ + #[\ReturnTypeWillChange] public function write($sessionId, $sessionData) { return $this->getConnection()->write($sessionId, $sessionData); @@ -118,6 +124,7 @@ public function write($sessionId, $sessionData) * @return boolean * @throws SessionException */ + #[\ReturnTypeWillChange] public function destroy($sessionId) { return $this->getConnection()->destroy($sessionId); @@ -129,6 +136,7 @@ public function destroy($sessionId) * @return bool * @throws SessionException */ + #[\ReturnTypeWillChange] public function close() { return $this->getConnection()->close(); @@ -142,6 +150,7 @@ public function close() * @throws SessionException * @SuppressWarnings(PHPMD.ShortMethodName) */ + #[\ReturnTypeWillChange] public function gc($maxLifeTime) { return $this->getConnection()->gc($maxLifeTime);