diff --git a/app/code/Magento/Analytics/Model/ReportXml/ModuleIterator.php b/app/code/Magento/Analytics/Model/ReportXml/ModuleIterator.php index fecbf2033c1ba..2057c52efed17 100644 --- a/app/code/Magento/Analytics/Model/ReportXml/ModuleIterator.php +++ b/app/code/Magento/Analytics/Model/ReportXml/ModuleIterator.php @@ -34,6 +34,7 @@ public function __construct( * * @return array */ + #[\ReturnTypeWillChange] public function current() { $current = parent::current(); diff --git a/app/code/Magento/Analytics/ReportXml/Query.php b/app/code/Magento/Analytics/ReportXml/Query.php index b7c31d4334e20..bc56a01cbc94b 100644 --- a/app/code/Magento/Analytics/ReportXml/Query.php +++ b/app/code/Magento/Analytics/ReportXml/Query.php @@ -53,6 +53,8 @@ public function __construct( } /** + * Returns query select + * * @return Select */ public function getSelect() @@ -61,6 +63,8 @@ public function getSelect() } /** + * Returns Connection name + * * @return string */ public function getConnectionName() @@ -69,6 +73,8 @@ public function getConnectionName() } /** + * Returns configuration + * * @return array */ public function getConfig() @@ -77,11 +83,9 @@ public function getConfig() } /** - * Specify data which should be serialized to JSON - * @link http://php.net/manual/en/jsonserializable.jsonserialize.php - * @return mixed data which can be serialized by json_encode, - * which is a value of any type other than a resource. + * @inheritDoc */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return [ diff --git a/app/code/Magento/Backend/Model/Menu.php b/app/code/Magento/Backend/Model/Menu.php index 0246346ec4d97..9506ac3dc36c9 100644 --- a/app/code/Magento/Backend/Model/Menu.php +++ b/app/code/Magento/Backend/Model/Menu.php @@ -242,7 +242,7 @@ public function getParentItems($itemId) * * @param \Magento\Backend\Model\Menu $menu * @param string $itemId - * @param array &$parents + * @param array $parents * @return bool */ protected function _findParentItems($menu, $itemId, &$parents) @@ -267,6 +267,7 @@ protected function _findParentItems($menu, $itemId, &$parents) * * @return string */ + #[\ReturnTypeWillChange] public function serialize() { return $this->serializer->serialize($this->toArray()); @@ -294,6 +295,7 @@ public function toArray() * @return void * @since 100.2.0 */ + #[\ReturnTypeWillChange] public function unserialize($serialized) { $data = $this->serializer->unserialize($serialized); diff --git a/app/code/Magento/Backend/Model/Menu/Filter/Iterator.php b/app/code/Magento/Backend/Model/Menu/Filter/Iterator.php index b6c61a1362edd..1655c89e5c299 100644 --- a/app/code/Magento/Backend/Model/Menu/Filter/Iterator.php +++ b/app/code/Magento/Backend/Model/Menu/Filter/Iterator.php @@ -17,7 +17,7 @@ class Iterator extends \FilterIterator * * @param \Iterator $iterator */ - public function __construct(\Iterator $iterator) + public function __construct(\Iterator $iterator) // phpcs:ignore Generic.CodeAnalysis.UselessOverridingMethod { parent::__construct($iterator); } @@ -27,6 +27,7 @@ public function __construct(\Iterator $iterator) * * @return bool true if the current element is acceptable, otherwise false. */ + #[\ReturnTypeWillChange] public function accept() { return !($this->current()->isDisabled() || !$this->current()->isAllowed()); diff --git a/app/code/Magento/Backend/Model/Menu/Iterator.php b/app/code/Magento/Backend/Model/Menu/Iterator.php index 7e98da0571263..ac6b57a438af5 100644 --- a/app/code/Magento/Backend/Model/Menu/Iterator.php +++ b/app/code/Magento/Backend/Model/Menu/Iterator.php @@ -17,6 +17,7 @@ class Iterator extends \ArrayIterator * * @return void */ + #[\ReturnTypeWillChange] public function rewind() { $this->ksort(); diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection/ProductLimitation.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection/ProductLimitation.php index 3a42d8ad7dd0b..1a3912b71437f 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection/ProductLimitation.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection/ProductLimitation.php @@ -6,8 +6,6 @@ namespace Magento\Catalog\Model\ResourceModel\Product\Collection; /** - * Class ProductLimitation - * * @api * @since 101.0.0 */ @@ -31,47 +29,61 @@ class ProductLimitation implements \ArrayAccess private $productLimitationFilters = []; /** + * Check if the value is set for the given offset. + * * @param string $offset * @return bool * @since 101.0.0 */ + #[\ReturnTypeWillChange] public function offsetExists($offset) { return array_key_exists($offset, $this->productLimitationFilters); } /** + * Get the value by provided offset. + * * @param string $offset * @return mixed * @since 101.0.0 */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->productLimitationFilters[$offset]; } /** + * Set the given offset to filters. + * * @param string $offset * @param mixed $value * @return void * @since 101.0.0 */ + #[\ReturnTypeWillChange] public function offsetSet($offset, $value) { $this->productLimitationFilters[$offset] = $value; } /** + * Unset the given offset from filters. + * * @param string $offset * @return void * @since 101.0.0 */ + #[\ReturnTypeWillChange] public function offsetUnset($offset) { unset($this->productLimitationFilters[$offset]); } /** + * Returns Store ID. + * * @return int|null * @since 101.0.0 */ @@ -81,6 +93,8 @@ public function getStoreId() } /** + * Returns category ID. + * * @return int|null * @since 101.0.0 */ @@ -90,6 +104,8 @@ public function getCategoryId() } /** + * Returns is category an anchor. + * * @return int|null * @since 101.0.0 */ @@ -99,6 +115,8 @@ public function getCategoryIsAnchor() } /** + * Returns visibility value. + * * @return array|int|null * @since 101.0.0 */ @@ -108,6 +126,8 @@ public function getVisibility() } /** + * Returns website IDs. + * * @return array|int|null * @since 101.0.0 */ @@ -117,6 +137,8 @@ public function getWebsiteIds() } /** + * Returns Store table. + * * @return string|null * @since 101.0.0 */ @@ -137,13 +159,15 @@ public function isUsingPriceIndex() } /** + * Sets 'Use Price' index flag. + * * @param bool $value * @return void * @since 101.0.0 */ public function setUsePriceIndex($value) { - $this->offsetSet('use_price_index', (bool)$value); + $this->offsetSet('use_price_index', (bool) $value); } /** diff --git a/app/code/Magento/Config/Model/Config/Structure/Element/Iterator.php b/app/code/Magento/Config/Model/Config/Structure/Element/Iterator.php index f53ecd710b28c..5f85ebcc7d2fa 100644 --- a/app/code/Magento/Config/Model/Config/Structure/Element/Iterator.php +++ b/app/code/Magento/Config/Model/Config/Structure/Element/Iterator.php @@ -69,6 +69,7 @@ public function setElements(array $elements, $scope) * * @return \Magento\Config\Model\Config\StructureElementInterface */ + #[\ReturnTypeWillChange] public function current() { return $this->_flyweight; @@ -79,6 +80,7 @@ public function current() * * @return void Any returned value is ignored. */ + #[\ReturnTypeWillChange] public function next() { next($this->_elements); @@ -106,6 +108,7 @@ protected function _initFlyweight(array $element) * * @return void */ + #[\ReturnTypeWillChange] public function key() { key($this->_elements); @@ -117,6 +120,7 @@ public function key() * @return bool The return value will be casted to boolean and then evaluated. * Returns true on success or false on failure. */ + #[\ReturnTypeWillChange] public function valid() { return (bool)current($this->_elements); @@ -127,6 +131,7 @@ public function valid() * * @return void Any returned value is ignored. */ + #[\ReturnTypeWillChange] public function rewind() { reset($this->_elements); diff --git a/app/code/Magento/Customer/Model/Indexer/Source.php b/app/code/Magento/Customer/Model/Indexer/Source.php index 89e17e01bb48e..b48e7e5ad9d05 100644 --- a/app/code/Magento/Customer/Model/Indexer/Source.php +++ b/app/code/Magento/Customer/Model/Indexer/Source.php @@ -82,6 +82,7 @@ public function addFieldToFilter($attribute, $condition = null) /** * @inheritdoc */ + #[\ReturnTypeWillChange] public function count() { return $this->customerCollection->getSize(); @@ -92,6 +93,7 @@ public function count() * * @return Traversable */ + #[\ReturnTypeWillChange] public function getIterator() { $this->customerCollection->setPageSize($this->batchSize); diff --git a/app/code/Magento/Customer/Ui/Component/MassAction/Group/Options.php b/app/code/Magento/Customer/Ui/Component/MassAction/Group/Options.php index 16caf346c808c..edc15bc60b4dd 100644 --- a/app/code/Magento/Customer/Ui/Component/MassAction/Group/Options.php +++ b/app/code/Magento/Customer/Ui/Component/MassAction/Group/Options.php @@ -81,6 +81,7 @@ public function __construct( * * @return array */ + #[\ReturnTypeWillChange] public function jsonSerialize() { if ($this->options === null) { diff --git a/app/code/Magento/ImportExport/Model/Import/AbstractSource.php b/app/code/Magento/ImportExport/Model/Import/AbstractSource.php index 41665a71341c1..57fa361ab2f63 100644 --- a/app/code/Magento/ImportExport/Model/Import/AbstractSource.php +++ b/app/code/Magento/ImportExport/Model/Import/AbstractSource.php @@ -7,6 +7,7 @@ use Magento\ImportExport\Model\Import\AbstractEntity; +// phpcs:disable Magento2.Classes.AbstractApi /** * Data source with columns for Magento_ImportExport * @@ -83,6 +84,7 @@ public function getColNames() * * @return array */ + #[\ReturnTypeWillChange] public function current() { $row = $this->_row; @@ -101,6 +103,7 @@ public function current() * * @return void */ + #[\ReturnTypeWillChange] public function next() { $this->_key++; @@ -127,6 +130,7 @@ abstract protected function _getNextRow(); * * @return int -1 if out of bounds, 0 or more otherwise */ + #[\ReturnTypeWillChange] public function key() { return $this->_key; @@ -137,6 +141,7 @@ public function key() * * @return bool */ + #[\ReturnTypeWillChange] public function valid() { return -1 !== $this->_key; @@ -147,6 +152,7 @@ public function valid() * * @return void */ + #[\ReturnTypeWillChange] public function rewind() { $this->_key = -1; @@ -161,6 +167,7 @@ public function rewind() * @return void * @throws \OutOfBoundsException */ + #[\ReturnTypeWillChange] public function seek($position) { if ($position == $this->_key) { diff --git a/app/code/Magento/ImportExport/Model/ResourceModel/Import/Data.php b/app/code/Magento/ImportExport/Model/ResourceModel/Import/Data.php index 6e77016adf361..254050bfb1dc1 100644 --- a/app/code/Magento/ImportExport/Model/ResourceModel/Import/Data.php +++ b/app/code/Magento/ImportExport/Model/ResourceModel/Import/Data.php @@ -56,6 +56,7 @@ protected function _construct() * * @return \Iterator */ + #[\ReturnTypeWillChange] public function getIterator() { $connection = $this->getConnection(); diff --git a/app/code/Magento/Shipping/Model/Simplexml/Element.php b/app/code/Magento/Shipping/Model/Simplexml/Element.php index a0ca9caf1d659..878a875c969be 100644 --- a/app/code/Magento/Shipping/Model/Simplexml/Element.php +++ b/app/code/Magento/Shipping/Model/Simplexml/Element.php @@ -20,6 +20,7 @@ class Element extends \Magento\Framework\Simplexml\Element * @param string $namespace If specified, the namespace to which the attribute belongs. * @return void */ + #[\ReturnTypeWillChange] public function addAttribute($name, $value = null, $namespace = null) { $value = $value !== null ? $this->xmlentities($value) : ''; @@ -34,6 +35,7 @@ public function addAttribute($name, $value = null, $namespace = null) * @param string $namespace If specified, the namespace to which the child element belongs. * @return \Magento\Shipping\Model\Simplexml\Element */ + #[\ReturnTypeWillChange] public function addChild($name, $value = null, $namespace = null) { if ($value !== null) { diff --git a/app/code/Magento/Ui/DataProvider/AbstractDataProvider.php b/app/code/Magento/Ui/DataProvider/AbstractDataProvider.php index 6e4e488619e86..c8a483d26d80c 100644 --- a/app/code/Magento/Ui/DataProvider/AbstractDataProvider.php +++ b/app/code/Magento/Ui/DataProvider/AbstractDataProvider.php @@ -8,7 +8,7 @@ use Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection; use Magento\Framework\View\Element\UiComponent\DataProvider\DataProviderInterface; - // phpcs:disable Magento2.Classes.AbstractApi +// phpcs:disable Magento2.Classes.AbstractApi /** * @inheritdoc * @@ -165,6 +165,7 @@ public function getFieldMetaInfo($fieldSetName, $fieldName) */ public function addFilter(\Magento\Framework\Api\Filter $filter) { + // @phpstan-ignore-next-line as adding return statement cause of backward compatibility issue $this->getCollection()->addFieldToFilter( $filter->getField(), [$filter->getConditionType() => $filter->getValue()] @@ -267,6 +268,7 @@ public function getData() * * @return int */ + #[\ReturnTypeWillChange] public function count() { return $this->getCollection()->count(); diff --git a/app/code/Magento/Ui/Model/Export/SearchResultIterator.php b/app/code/Magento/Ui/Model/Export/SearchResultIterator.php index e84a628e6699e..da0004f405ca5 100644 --- a/app/code/Magento/Ui/Model/Export/SearchResultIterator.php +++ b/app/code/Magento/Ui/Model/Export/SearchResultIterator.php @@ -22,40 +22,45 @@ public function __construct( } /** - * @return array|mixed + * @inheritdoc */ + #[\ReturnTypeWillChange] public function current() { return current($this->items); } /** - * @return int|mixed + * @inheritdoc */ + #[\ReturnTypeWillChange] public function key() { return key($this->items); } /** - * @return void + * @inheritdoc */ + #[\ReturnTypeWillChange] public function next() { next($this->items); } /** - * @return void + * @inheritdoc */ + #[\ReturnTypeWillChange] public function rewind() { reset($this->items); } /** - * @return bool + * @inheritdoc */ + #[\ReturnTypeWillChange] public function valid() { return $this->key() !== null;