From f06ad93f536ebb4c656bb978fec47054bc644299 Mon Sep 17 00:00:00 2001 From: Lee Rowlands <lee.rowlands@previousnext.com.au> Date: Fri, 17 Sep 2021 13:12:50 +1000 Subject: [PATCH] Issue #3224523 by alexpott, longwave: [PHP 8.1] Add ReturnTypeWillChange attribute where necessary --- .../Operations/ScaffoldFileCollection.php | 1 + .../Compatibility/Php8/ReflectionClass.php | 2 + .../Doctrine/StaticReflectionClass.php | 44 +++++++++++++++++++ .../FileSystem/RegexDirectoryIterator.php | 1 + .../Component/Plugin/LazyPluginCollection.php | 2 + .../Component/Render/FormattableMarkup.php | 2 + .../Component/Render/HtmlEscapedText.php | 2 + .../Drupal/Component/Render/MarkupTrait.php | 2 + .../Component/Utility/DeprecatedArray.php | 6 +++ .../Core/Config/Schema/ArrayElement.php | 1 + .../Drupal/Core/Database/Query/Condition.php | 1 + .../Core/Database/Query/InsertTrait.php | 1 + .../Core/Database/StatementPrefetch.php | 5 +++ .../Drupal/Core/Database/StatementWrapper.php | 1 + .../DependencySerializationTrait.php | 1 + .../Drupal/Core/Entity/ContentEntityBase.php | 1 + .../Plugin/DataType/ConfigEntityAdapter.php | 1 + .../Entity/Plugin/DataType/EntityAdapter.php | 1 + .../Entity/Query/ConditionFundamentals.php | 1 + .../RecursiveExtensionFilterIterator.php | 2 + core/lib/Drupal/Core/GeneratedLink.php | 2 + .../Core/Routing/LazyRouteCollection.php | 2 + .../Drupal/Core/Session/SessionHandler.php | 6 +++ .../Core/Session/WriteSafeSessionHandler.php | 6 +++ .../StringTranslation/TranslatableMarkup.php | 1 + core/lib/Drupal/Core/Template/Attribute.php | 6 +++ .../Drupal/Core/Template/AttributeArray.php | 5 +++ .../Core/TypedData/ComputedItemListTrait.php | 2 + .../Drupal/Core/TypedData/DataDefinition.php | 4 ++ .../TypedData/Plugin/DataType/ItemList.php | 6 +++ .../Core/TypedData/Plugin/DataType/Map.php | 1 + .../jsonapi/src/JsonApiResource/Data.php | 2 + .../src/JsonApiResource/ErrorCollection.php | 1 + .../src/JsonApiResource/LinkCollection.php | 1 + .../src/TraversableObject.php | 1 + .../SectionStorage/SectionStorageBase.php | 1 + .../layout_builder/src/SectionListTrait.php | 1 + .../modules/migrate/src/Audit/AuditResult.php | 2 + .../src/Plugin/migrate/id_map/NullIdMap.php | 5 +++ .../migrate/src/Plugin/migrate/id_map/Sql.php | 5 +++ .../migrate/source/SourcePluginBase.php | 6 +++ .../src/Session/TestSessionHandlerProxy.php | 6 +++ core/tests/Drupal/Tests/StreamCapturer.php | 1 + 43 files changed, 151 insertions(+) diff --git a/composer/Plugin/Scaffold/Operations/ScaffoldFileCollection.php b/composer/Plugin/Scaffold/Operations/ScaffoldFileCollection.php index 3551b80aea5c..f036d7b5b1c0 100644 --- a/composer/Plugin/Scaffold/Operations/ScaffoldFileCollection.php +++ b/composer/Plugin/Scaffold/Operations/ScaffoldFileCollection.php @@ -115,6 +115,7 @@ protected function checkListHasItemWithContent(array $scaffold_files) { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function getIterator() { return new \ArrayIterator($this->scaffoldFilesByProject); } diff --git a/core/lib/Drupal/Component/Annotation/Doctrine/Compatibility/Php8/ReflectionClass.php b/core/lib/Drupal/Component/Annotation/Doctrine/Compatibility/Php8/ReflectionClass.php index 015939e147c9..878132062857 100644 --- a/core/lib/Drupal/Component/Annotation/Doctrine/Compatibility/Php8/ReflectionClass.php +++ b/core/lib/Drupal/Component/Annotation/Doctrine/Compatibility/Php8/ReflectionClass.php @@ -33,6 +33,7 @@ trait ReflectionClass /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function getConstants(?int $filter = null) { throw new ReflectionException('Method not implemented'); @@ -41,6 +42,7 @@ public function getConstants(?int $filter = null) /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function newInstance(mixed ...$args) { throw new ReflectionException('Method not implemented'); diff --git a/core/lib/Drupal/Component/Annotation/Doctrine/StaticReflectionClass.php b/core/lib/Drupal/Component/Annotation/Doctrine/StaticReflectionClass.php index 0f1ff5888d76..7abdc86b012c 100644 --- a/core/lib/Drupal/Component/Annotation/Doctrine/StaticReflectionClass.php +++ b/core/lib/Drupal/Component/Annotation/Doctrine/StaticReflectionClass.php @@ -49,6 +49,7 @@ public function __construct(StaticReflectionParser $staticReflectionParser) /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function getName() { return $this->staticReflectionParser->getClassName(); @@ -57,6 +58,7 @@ public function getName() /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function getDocComment() { return $this->staticReflectionParser->getDocComment(); @@ -65,6 +67,7 @@ public function getDocComment() /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function getNamespaceName() { return $this->staticReflectionParser->getNamespaceName(); @@ -81,6 +84,7 @@ public function getUseStatements() /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function getMethod($name) { throw new ReflectionException('Method not implemented'); @@ -89,6 +93,7 @@ public function getMethod($name) /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function getProperty($name) { throw new ReflectionException('Method not implemented'); @@ -105,6 +110,7 @@ public static function export($argument, $return = false) /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function getConstant($name) { throw new ReflectionException('Method not implemented'); @@ -113,6 +119,7 @@ public function getConstant($name) /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function getConstructor() { throw new ReflectionException('Method not implemented'); @@ -121,6 +128,7 @@ public function getConstructor() /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function getDefaultProperties() { throw new ReflectionException('Method not implemented'); @@ -129,6 +137,7 @@ public function getDefaultProperties() /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function getEndLine() { throw new ReflectionException('Method not implemented'); @@ -137,6 +146,7 @@ public function getEndLine() /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function getExtension() { throw new ReflectionException('Method not implemented'); @@ -145,6 +155,7 @@ public function getExtension() /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function getExtensionName() { throw new ReflectionException('Method not implemented'); @@ -153,6 +164,7 @@ public function getExtensionName() /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function getFileName() { throw new ReflectionException('Method not implemented'); @@ -161,6 +173,7 @@ public function getFileName() /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function getInterfaceNames() { throw new ReflectionException('Method not implemented'); @@ -169,6 +182,7 @@ public function getInterfaceNames() /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function getInterfaces() { throw new ReflectionException('Method not implemented'); @@ -177,6 +191,7 @@ public function getInterfaces() /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function getMethods($filter = null) { throw new ReflectionException('Method not implemented'); @@ -185,6 +200,7 @@ public function getMethods($filter = null) /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function getModifiers() { throw new ReflectionException('Method not implemented'); @@ -193,6 +209,7 @@ public function getModifiers() /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function getParentClass() { throw new ReflectionException('Method not implemented'); @@ -201,6 +218,7 @@ public function getParentClass() /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function getProperties($filter = null) { throw new ReflectionException('Method not implemented'); @@ -209,6 +227,7 @@ public function getProperties($filter = null) /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function getShortName() { throw new ReflectionException('Method not implemented'); @@ -217,6 +236,7 @@ public function getShortName() /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function getStartLine() { throw new ReflectionException('Method not implemented'); @@ -225,6 +245,7 @@ public function getStartLine() /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function getStaticProperties() { throw new ReflectionException('Method not implemented'); @@ -233,6 +254,7 @@ public function getStaticProperties() /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function getStaticPropertyValue($name, $default = '') { throw new ReflectionException('Method not implemented'); @@ -241,6 +263,7 @@ public function getStaticPropertyValue($name, $default = '') /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function getTraitAliases() { throw new ReflectionException('Method not implemented'); @@ -249,6 +272,7 @@ public function getTraitAliases() /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function getTraitNames() { throw new ReflectionException('Method not implemented'); @@ -257,6 +281,7 @@ public function getTraitNames() /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function getTraits() { throw new ReflectionException('Method not implemented'); @@ -265,6 +290,7 @@ public function getTraits() /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function hasConstant($name) { throw new ReflectionException('Method not implemented'); @@ -273,6 +299,7 @@ public function hasConstant($name) /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function hasMethod($name) { throw new ReflectionException('Method not implemented'); @@ -281,6 +308,7 @@ public function hasMethod($name) /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function hasProperty($name) { throw new ReflectionException('Method not implemented'); @@ -289,6 +317,7 @@ public function hasProperty($name) /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function implementsInterface($interface) { throw new ReflectionException('Method not implemented'); @@ -297,6 +326,7 @@ public function implementsInterface($interface) /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function inNamespace() { throw new ReflectionException('Method not implemented'); @@ -305,6 +335,7 @@ public function inNamespace() /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function isAbstract() { throw new ReflectionException('Method not implemented'); @@ -313,6 +344,7 @@ public function isAbstract() /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function isCloneable() { throw new ReflectionException('Method not implemented'); @@ -321,6 +353,7 @@ public function isCloneable() /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function isFinal() { throw new ReflectionException('Method not implemented'); @@ -329,6 +362,7 @@ public function isFinal() /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function isInstance($object) { throw new ReflectionException('Method not implemented'); @@ -337,6 +371,7 @@ public function isInstance($object) /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function isInstantiable() { throw new ReflectionException('Method not implemented'); @@ -345,6 +380,7 @@ public function isInstantiable() /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function isInterface() { throw new ReflectionException('Method not implemented'); @@ -353,6 +389,7 @@ public function isInterface() /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function isInternal() { throw new ReflectionException('Method not implemented'); @@ -361,6 +398,7 @@ public function isInternal() /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function isIterateable() { throw new ReflectionException('Method not implemented'); @@ -369,6 +407,7 @@ public function isIterateable() /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function isSubclassOf($class) { throw new ReflectionException('Method not implemented'); @@ -377,6 +416,7 @@ public function isSubclassOf($class) /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function isTrait() { throw new ReflectionException('Method not implemented'); @@ -385,6 +425,7 @@ public function isTrait() /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function isUserDefined() { throw new ReflectionException('Method not implemented'); @@ -393,6 +434,7 @@ public function isUserDefined() /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function newInstanceArgs(array $args = []) { throw new ReflectionException('Method not implemented'); @@ -401,6 +443,7 @@ public function newInstanceArgs(array $args = []) /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function newInstanceWithoutConstructor() { throw new ReflectionException('Method not implemented'); @@ -409,6 +452,7 @@ public function newInstanceWithoutConstructor() /** * {@inheritDoc} */ + #[\ReturnTypeWillChange] public function setStaticPropertyValue($name, $value) { throw new ReflectionException('Method not implemented'); diff --git a/core/lib/Drupal/Component/FileSystem/RegexDirectoryIterator.php b/core/lib/Drupal/Component/FileSystem/RegexDirectoryIterator.php index c6c654f2becc..883b02b3953b 100644 --- a/core/lib/Drupal/Component/FileSystem/RegexDirectoryIterator.php +++ b/core/lib/Drupal/Component/FileSystem/RegexDirectoryIterator.php @@ -33,6 +33,7 @@ public function __construct($path, $regex) { /** * Implements \FilterIterator::accept(). */ + #[\ReturnTypeWillChange] public function accept() { /** @var \SplFileInfo $file_info */ $file_info = $this->getInnerIterator()->current(); diff --git a/core/lib/Drupal/Component/Plugin/LazyPluginCollection.php b/core/lib/Drupal/Component/Plugin/LazyPluginCollection.php index 118631fb2e5a..6574c5b3daec 100644 --- a/core/lib/Drupal/Component/Plugin/LazyPluginCollection.php +++ b/core/lib/Drupal/Component/Plugin/LazyPluginCollection.php @@ -142,6 +142,7 @@ public function removeInstanceId($instance_id) { $this->remove($instance_id); } + #[\ReturnTypeWillChange] public function getIterator() { $instances = []; foreach ($this->getInstanceIds() as $instance_id) { @@ -153,6 +154,7 @@ public function getIterator() { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function count() { return count($this->instanceIds); } diff --git a/core/lib/Drupal/Component/Render/FormattableMarkup.php b/core/lib/Drupal/Component/Render/FormattableMarkup.php index e26f90e9b8f7..404cf7e6bdc2 100644 --- a/core/lib/Drupal/Component/Render/FormattableMarkup.php +++ b/core/lib/Drupal/Component/Render/FormattableMarkup.php @@ -105,6 +105,7 @@ public function __toString() { * @return int * The length of the string. */ + #[\ReturnTypeWillChange] public function count() { return mb_strlen($this->string); } @@ -115,6 +116,7 @@ public function count() { * @return string * The safe string content. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return $this->__toString(); } diff --git a/core/lib/Drupal/Component/Render/HtmlEscapedText.php b/core/lib/Drupal/Component/Render/HtmlEscapedText.php index 0ddc4fa4c500..d5121bfb9f28 100644 --- a/core/lib/Drupal/Component/Render/HtmlEscapedText.php +++ b/core/lib/Drupal/Component/Render/HtmlEscapedText.php @@ -41,6 +41,7 @@ public function __toString() { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function count() { return mb_strlen($this->string); } @@ -48,6 +49,7 @@ public function count() { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return $this->__toString(); } diff --git a/core/lib/Drupal/Component/Render/MarkupTrait.php b/core/lib/Drupal/Component/Render/MarkupTrait.php index c7faa81abae7..93ed4d2eb0da 100644 --- a/core/lib/Drupal/Component/Render/MarkupTrait.php +++ b/core/lib/Drupal/Component/Render/MarkupTrait.php @@ -58,6 +58,7 @@ public function __toString() { * @return int * The length of the string. */ + #[\ReturnTypeWillChange] public function count() { return mb_strlen($this->string); } @@ -68,6 +69,7 @@ public function count() { * @return string * The safe string content. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return $this->__toString(); } diff --git a/core/lib/Drupal/Component/Utility/DeprecatedArray.php b/core/lib/Drupal/Component/Utility/DeprecatedArray.php index d8483ea68620..63b5b7f13350 100644 --- a/core/lib/Drupal/Component/Utility/DeprecatedArray.php +++ b/core/lib/Drupal/Component/Utility/DeprecatedArray.php @@ -30,6 +30,7 @@ public function __construct(array $values, $message) { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function offsetExists($offset) { @trigger_error($this->message, E_USER_DEPRECATED); return parent::offsetExists($offset); @@ -38,6 +39,7 @@ public function offsetExists($offset) { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { @trigger_error($this->message, E_USER_DEPRECATED); return parent::offsetGet($offset); @@ -46,6 +48,7 @@ public function offsetGet($offset) { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function offsetSet($offset, $value) { @trigger_error($this->message, E_USER_DEPRECATED); parent::offsetSet($offset, $value); @@ -54,6 +57,7 @@ public function offsetSet($offset, $value) { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function offsetUnset($offset) { @trigger_error($this->message, E_USER_DEPRECATED); parent::offsetUnset($offset); @@ -62,6 +66,7 @@ public function offsetUnset($offset) { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function getIterator() { @trigger_error($this->message, E_USER_DEPRECATED); return parent::getIterator(); @@ -86,6 +91,7 @@ public function serialize() { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function count() { @trigger_error($this->message, E_USER_DEPRECATED); return parent::count(); diff --git a/core/lib/Drupal/Core/Config/Schema/ArrayElement.php b/core/lib/Drupal/Core/Config/Schema/ArrayElement.php index b16cee0aeaaa..fed16db7d0ac 100644 --- a/core/lib/Drupal/Core/Config/Schema/ArrayElement.php +++ b/core/lib/Drupal/Core/Config/Schema/ArrayElement.php @@ -114,6 +114,7 @@ public function onChange($name) { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function getIterator() { return new \ArrayIterator($this->getElements()); } diff --git a/core/lib/Drupal/Core/Database/Query/Condition.php b/core/lib/Drupal/Core/Database/Query/Condition.php index 8c5f207f9412..16793b803403 100644 --- a/core/lib/Drupal/Core/Database/Query/Condition.php +++ b/core/lib/Drupal/Core/Database/Query/Condition.php @@ -101,6 +101,7 @@ public function __construct($conjunction, $trigger_deprecation = TRUE) { * size of its conditional array minus one, because one element is the * conjunction. */ + #[\ReturnTypeWillChange] public function count() { return count($this->conditions) - 1; } diff --git a/core/lib/Drupal/Core/Database/Query/InsertTrait.php b/core/lib/Drupal/Core/Database/Query/InsertTrait.php index f291da1a8103..a429c88eead6 100644 --- a/core/lib/Drupal/Core/Database/Query/InsertTrait.php +++ b/core/lib/Drupal/Core/Database/Query/InsertTrait.php @@ -179,6 +179,7 @@ protected function getInsertPlaceholderFragment(array $nested_insert_values, arr /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function count() { return count($this->insertValues); } diff --git a/core/lib/Drupal/Core/Database/StatementPrefetch.php b/core/lib/Drupal/Core/Database/StatementPrefetch.php index 1f2f1709cb7e..8c083e37babf 100644 --- a/core/lib/Drupal/Core/Database/StatementPrefetch.php +++ b/core/lib/Drupal/Core/Database/StatementPrefetch.php @@ -320,6 +320,7 @@ public function setFetchMode($mode, $a1 = NULL, $a2 = []) { * @return mixed * The current row formatted as requested. */ + #[\ReturnTypeWillChange] public function current() { if (isset($this->currentRow)) { switch ($this->fetchStyle) { @@ -379,6 +380,7 @@ public function current() { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function key() { return $this->currentKey; } @@ -386,6 +388,7 @@ public function key() { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function rewind() { // Nothing to do: our DatabaseStatement can't be rewound. } @@ -393,6 +396,7 @@ public function rewind() { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function next() { if (!empty($this->data)) { $this->currentRow = reset($this->data); @@ -407,6 +411,7 @@ public function next() { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function valid() { return isset($this->currentRow); } diff --git a/core/lib/Drupal/Core/Database/StatementWrapper.php b/core/lib/Drupal/Core/Database/StatementWrapper.php index 4bef35c22d2c..2b3eb40f4636 100644 --- a/core/lib/Drupal/Core/Database/StatementWrapper.php +++ b/core/lib/Drupal/Core/Database/StatementWrapper.php @@ -308,6 +308,7 @@ public function fetchAll($mode = NULL, $column_index = NULL, $constructor_argume /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function getIterator() { return new \ArrayIterator($this->fetchAll()); } diff --git a/core/lib/Drupal/Core/DependencyInjection/DependencySerializationTrait.php b/core/lib/Drupal/Core/DependencyInjection/DependencySerializationTrait.php index 2fc17ccc6d12..c24598689e3c 100644 --- a/core/lib/Drupal/Core/DependencyInjection/DependencySerializationTrait.php +++ b/core/lib/Drupal/Core/DependencyInjection/DependencySerializationTrait.php @@ -64,6 +64,7 @@ public function __sleep() { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function __wakeup() { // Tests in isolation potentially unserialize in the parent process. $phpunit_bootstrap = isset($GLOBALS['__PHPUNIT_BOOTSTRAP']); diff --git a/core/lib/Drupal/Core/Entity/ContentEntityBase.php b/core/lib/Drupal/Core/Entity/ContentEntityBase.php index 3e82c6f95f5f..06eefa9106d7 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityBase.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityBase.php @@ -658,6 +658,7 @@ public function getTranslatableFields($include_computed = TRUE) { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function getIterator() { return new \ArrayIterator($this->getFields()); } diff --git a/core/lib/Drupal/Core/Entity/Plugin/DataType/ConfigEntityAdapter.php b/core/lib/Drupal/Core/Entity/Plugin/DataType/ConfigEntityAdapter.php index 55a8bba0b988..a30106029fcb 100644 --- a/core/lib/Drupal/Core/Entity/Plugin/DataType/ConfigEntityAdapter.php +++ b/core/lib/Drupal/Core/Entity/Plugin/DataType/ConfigEntityAdapter.php @@ -69,6 +69,7 @@ public function onChange($property_name) { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function getIterator() { if (isset($this->entity)) { return $this->getConfigTypedData()->getIterator(); diff --git a/core/lib/Drupal/Core/Entity/Plugin/DataType/EntityAdapter.php b/core/lib/Drupal/Core/Entity/Plugin/DataType/EntityAdapter.php index 3154d1776f86..ddc460ea4e6e 100644 --- a/core/lib/Drupal/Core/Entity/Plugin/DataType/EntityAdapter.php +++ b/core/lib/Drupal/Core/Entity/Plugin/DataType/EntityAdapter.php @@ -160,6 +160,7 @@ public function applyDefaultValue($notify = TRUE) { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function getIterator() { return $this->entity instanceof \IteratorAggregate ? $this->entity->getIterator() : new \ArrayIterator([]); } diff --git a/core/lib/Drupal/Core/Entity/Query/ConditionFundamentals.php b/core/lib/Drupal/Core/Entity/Query/ConditionFundamentals.php index af996a62c1b2..e176b68588b6 100644 --- a/core/lib/Drupal/Core/Entity/Query/ConditionFundamentals.php +++ b/core/lib/Drupal/Core/Entity/Query/ConditionFundamentals.php @@ -65,6 +65,7 @@ public function getConjunction() { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function count() { return count($this->conditions); } diff --git a/core/lib/Drupal/Core/Extension/Discovery/RecursiveExtensionFilterIterator.php b/core/lib/Drupal/Core/Extension/Discovery/RecursiveExtensionFilterIterator.php index 49053dba1807..b61ff4867961 100644 --- a/core/lib/Drupal/Core/Extension/Discovery/RecursiveExtensionFilterIterator.php +++ b/core/lib/Drupal/Core/Extension/Discovery/RecursiveExtensionFilterIterator.php @@ -115,6 +115,7 @@ public function acceptTests($flag = FALSE) { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function getChildren() { $filter = parent::getChildren(); // Pass on the skipped folders list. @@ -127,6 +128,7 @@ public function getChildren() { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function accept() { $name = $this->current()->getFilename(); // FilesystemIterator::SKIP_DOTS only skips '.' and '..', but not hidden diff --git a/core/lib/Drupal/Core/GeneratedLink.php b/core/lib/Drupal/Core/GeneratedLink.php index 62f10a5df70b..3bb89b8ea80b 100644 --- a/core/lib/Drupal/Core/GeneratedLink.php +++ b/core/lib/Drupal/Core/GeneratedLink.php @@ -57,6 +57,7 @@ public function __toString() { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return $this->__toString(); } @@ -64,6 +65,7 @@ public function jsonSerialize() { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function count() { return mb_strlen($this->__toString()); } diff --git a/core/lib/Drupal/Core/Routing/LazyRouteCollection.php b/core/lib/Drupal/Core/Routing/LazyRouteCollection.php index 5f9706efe7fa..52a716b80a2a 100644 --- a/core/lib/Drupal/Core/Routing/LazyRouteCollection.php +++ b/core/lib/Drupal/Core/Routing/LazyRouteCollection.php @@ -23,6 +23,7 @@ public function __construct(RouteProviderInterface $provider) { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function getIterator() { return new \ArrayIterator($this->all()); } @@ -33,6 +34,7 @@ public function getIterator() { * @return int * The number of routes */ + #[\ReturnTypeWillChange] public function count() { return count($this->all()); } diff --git a/core/lib/Drupal/Core/Session/SessionHandler.php b/core/lib/Drupal/Core/Session/SessionHandler.php index eb694921affb..420864e62345 100644 --- a/core/lib/Drupal/Core/Session/SessionHandler.php +++ b/core/lib/Drupal/Core/Session/SessionHandler.php @@ -46,6 +46,7 @@ public function __construct(RequestStack $request_stack, Connection $connection) /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function open($save_path, $name) { return TRUE; } @@ -53,6 +54,7 @@ public function open($save_path, $name) { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function read($sid) { $data = ''; if (!empty($sid)) { @@ -67,6 +69,7 @@ public function read($sid) { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function write($sid, $value) { // The exception handler is not active at this point, so we need to do it // manually. @@ -99,6 +102,7 @@ public function write($sid, $value) { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function close() { return TRUE; } @@ -106,6 +110,7 @@ public function close() { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function destroy($sid) { // Delete session data. $this->connection->delete('sessions') @@ -118,6 +123,7 @@ public function destroy($sid) { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function gc($lifetime) { // Be sure to adjust 'php_value session.gc_maxlifetime' to a large enough // value. For example, if you want user sessions to stay in your database diff --git a/core/lib/Drupal/Core/Session/WriteSafeSessionHandler.php b/core/lib/Drupal/Core/Session/WriteSafeSessionHandler.php index fadf29bffdc1..d18340d754b7 100644 --- a/core/lib/Drupal/Core/Session/WriteSafeSessionHandler.php +++ b/core/lib/Drupal/Core/Session/WriteSafeSessionHandler.php @@ -43,6 +43,7 @@ public function __construct(\SessionHandlerInterface $wrapped_session_handler, $ /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function close() { return $this->wrappedSessionHandler->close(); } @@ -50,6 +51,7 @@ public function close() { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function destroy($session_id) { return $this->wrappedSessionHandler->destroy($session_id); } @@ -57,6 +59,7 @@ public function destroy($session_id) { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function gc($max_lifetime) { return $this->wrappedSessionHandler->gc($max_lifetime); } @@ -64,6 +67,7 @@ public function gc($max_lifetime) { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function open($save_path, $session_id) { return $this->wrappedSessionHandler->open($save_path, $session_id); } @@ -71,6 +75,7 @@ public function open($save_path, $session_id) { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function read($session_id) { $value = $this->wrappedSessionHandler->read($session_id); $this->readSessions[$session_id] = $value; @@ -80,6 +85,7 @@ public function read($session_id) { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function write($session_id, $session_data) { // Only write the session when it has been modified. if (isset($this->readSessions[$session_id]) && $this->readSessions[$session_id] === $session_data) { diff --git a/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php b/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php index dcff3fc3b231..517bfb208356 100644 --- a/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php +++ b/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php @@ -224,6 +224,7 @@ protected function getStringTranslation() { * @return int * The length of the string. */ + #[\ReturnTypeWillChange] public function count() { return mb_strlen($this->render()); } diff --git a/core/lib/Drupal/Core/Template/Attribute.php b/core/lib/Drupal/Core/Template/Attribute.php index cbbe1657f600..1ad25dd9cda8 100644 --- a/core/lib/Drupal/Core/Template/Attribute.php +++ b/core/lib/Drupal/Core/Template/Attribute.php @@ -90,6 +90,7 @@ public function __construct($attributes = []) { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function offsetGet($name) { if (isset($this->storage[$name])) { return $this->storage[$name]; @@ -99,6 +100,7 @@ public function offsetGet($name) { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function offsetSet($name, $value) { $this->storage[$name] = $this->createAttributeValue($name, $value); } @@ -152,6 +154,7 @@ protected function createAttributeValue($name, $value) { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function offsetUnset($name) { unset($this->storage[$name]); } @@ -159,6 +162,7 @@ public function offsetUnset($name) { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function offsetExists($name) { return isset($this->storage[$name]); } @@ -352,6 +356,7 @@ public function __clone() { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function getIterator() { return new \ArrayIterator($this->storage); } @@ -369,6 +374,7 @@ public function storage() { * @return string * The safe string content. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return (string) $this; } diff --git a/core/lib/Drupal/Core/Template/AttributeArray.php b/core/lib/Drupal/Core/Template/AttributeArray.php index ce7186e46f00..71127f00471d 100644 --- a/core/lib/Drupal/Core/Template/AttributeArray.php +++ b/core/lib/Drupal/Core/Template/AttributeArray.php @@ -35,6 +35,7 @@ class AttributeArray extends AttributeValueBase implements \ArrayAccess, \Iterat /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->value[$offset]; } @@ -42,6 +43,7 @@ public function offsetGet($offset) { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function offsetSet($offset, $value) { if (isset($offset)) { $this->value[$offset] = $value; @@ -54,6 +56,7 @@ public function offsetSet($offset, $value) { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function offsetUnset($offset) { unset($this->value[$offset]); } @@ -61,6 +64,7 @@ public function offsetUnset($offset) { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function offsetExists($offset) { return isset($this->value[$offset]); } @@ -77,6 +81,7 @@ public function __toString() { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function getIterator() { return new \ArrayIterator($this->value); } diff --git a/core/lib/Drupal/Core/TypedData/ComputedItemListTrait.php b/core/lib/Drupal/Core/TypedData/ComputedItemListTrait.php index f6660c4cca68..18f05b9ea007 100644 --- a/core/lib/Drupal/Core/TypedData/ComputedItemListTrait.php +++ b/core/lib/Drupal/Core/TypedData/ComputedItemListTrait.php @@ -126,6 +126,7 @@ public function offsetExists($offset) { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function getIterator() { $this->ensureComputedValue(); return parent::getIterator(); @@ -134,6 +135,7 @@ public function getIterator() { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function count() { $this->ensureComputedValue(); return parent::count(); diff --git a/core/lib/Drupal/Core/TypedData/DataDefinition.php b/core/lib/Drupal/Core/TypedData/DataDefinition.php index 47010835c87b..44a8301ef062 100644 --- a/core/lib/Drupal/Core/TypedData/DataDefinition.php +++ b/core/lib/Drupal/Core/TypedData/DataDefinition.php @@ -301,6 +301,7 @@ public function addConstraint($constraint_name, $options = NULL) { * This is for BC support only. * @todo: Remove in https://www.drupal.org/node/1928868. */ + #[\ReturnTypeWillChange] public function offsetExists($offset) { // PHP's array access does not work correctly with isset(), so we have to // bake isset() in here. See https://bugs.php.net/bug.php?id=41727. @@ -313,6 +314,7 @@ public function offsetExists($offset) { * This is for BC support only. * @todo: Remove in https://www.drupal.org/node/1928868. */ + #[\ReturnTypeWillChange] public function &offsetGet($offset) { if (!isset($this->definition[$offset])) { $this->definition[$offset] = NULL; @@ -326,6 +328,7 @@ public function &offsetGet($offset) { * This is for BC support only. * @todo: Remove in https://www.drupal.org/node/1928868. */ + #[\ReturnTypeWillChange] public function offsetSet($offset, $value) { $this->definition[$offset] = $value; } @@ -336,6 +339,7 @@ public function offsetSet($offset, $value) { * This is for BC support only. * @todo: Remove in https://www.drupal.org/node/1928868. */ + #[\ReturnTypeWillChange] public function offsetUnset($offset) { unset($this->definition[$offset]); } diff --git a/core/lib/Drupal/Core/TypedData/Plugin/DataType/ItemList.php b/core/lib/Drupal/Core/TypedData/Plugin/DataType/ItemList.php index 733a4e86d2fe..71fa357778d0 100644 --- a/core/lib/Drupal/Core/TypedData/Plugin/DataType/ItemList.php +++ b/core/lib/Drupal/Core/TypedData/Plugin/DataType/ItemList.php @@ -168,6 +168,7 @@ public function first() { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function offsetExists($offset) { // We do not want to throw exceptions here, so we do not use get(). return isset($this->list[$offset]); @@ -176,6 +177,7 @@ public function offsetExists($offset) { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function offsetUnset($offset) { $this->removeItem($offset); } @@ -183,6 +185,7 @@ public function offsetUnset($offset) { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->get($offset); } @@ -190,6 +193,7 @@ public function offsetGet($offset) { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function offsetSet($offset, $value) { if (!isset($offset)) { // The [] operator has been used. @@ -229,6 +233,7 @@ public function getItemDefinition() { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function getIterator() { return new \ArrayIterator($this->list); } @@ -236,6 +241,7 @@ public function getIterator() { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function count() { return count($this->list); } diff --git a/core/lib/Drupal/Core/TypedData/Plugin/DataType/Map.php b/core/lib/Drupal/Core/TypedData/Plugin/DataType/Map.php index cadebd7d2a1d..72768aa39bdf 100644 --- a/core/lib/Drupal/Core/TypedData/Plugin/DataType/Map.php +++ b/core/lib/Drupal/Core/TypedData/Plugin/DataType/Map.php @@ -181,6 +181,7 @@ public function toArray() { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function getIterator() { return new \ArrayIterator($this->getProperties()); } diff --git a/core/modules/jsonapi/src/JsonApiResource/Data.php b/core/modules/jsonapi/src/JsonApiResource/Data.php index 61cf72ca4068..0e4006206726 100644 --- a/core/modules/jsonapi/src/JsonApiResource/Data.php +++ b/core/modules/jsonapi/src/JsonApiResource/Data.php @@ -69,6 +69,7 @@ public function __construct(array $data, $cardinality = -1) { * @return \ArrayIterator * An \ArrayIterator instance */ + #[\ReturnTypeWillChange] public function getIterator() { return new \ArrayIterator($this->data); } @@ -79,6 +80,7 @@ public function getIterator() { * @return int * The number of parameters */ + #[\ReturnTypeWillChange] public function count() { return count($this->data); } diff --git a/core/modules/jsonapi/src/JsonApiResource/ErrorCollection.php b/core/modules/jsonapi/src/JsonApiResource/ErrorCollection.php index d43febdd6e38..018f19209401 100644 --- a/core/modules/jsonapi/src/JsonApiResource/ErrorCollection.php +++ b/core/modules/jsonapi/src/JsonApiResource/ErrorCollection.php @@ -47,6 +47,7 @@ public function __construct(array $errors) { * @return \ArrayIterator * An \ArrayIterator instance */ + #[\ReturnTypeWillChange] public function getIterator() { return new \ArrayIterator($this->errors); } diff --git a/core/modules/jsonapi/src/JsonApiResource/LinkCollection.php b/core/modules/jsonapi/src/JsonApiResource/LinkCollection.php index 3215888693ce..32ebe6248b44 100644 --- a/core/modules/jsonapi/src/JsonApiResource/LinkCollection.php +++ b/core/modules/jsonapi/src/JsonApiResource/LinkCollection.php @@ -62,6 +62,7 @@ public function __construct(array $links, $context = NULL) { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function getIterator() { assert(!is_null($this->context), 'A LinkCollection is invalid unless a context has been established.'); return new \ArrayIterator($this->links); diff --git a/core/modules/jsonapi/tests/modules/jsonapi_test_data_type/src/TraversableObject.php b/core/modules/jsonapi/tests/modules/jsonapi_test_data_type/src/TraversableObject.php index 79b44fc696c9..9b4cc275d1bc 100644 --- a/core/modules/jsonapi/tests/modules/jsonapi_test_data_type/src/TraversableObject.php +++ b/core/modules/jsonapi/tests/modules/jsonapi_test_data_type/src/TraversableObject.php @@ -12,6 +12,7 @@ class TraversableObject implements \IteratorAggregate { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function getIterator() { return new \ArrayIterator(); } diff --git a/core/modules/layout_builder/src/Plugin/SectionStorage/SectionStorageBase.php b/core/modules/layout_builder/src/Plugin/SectionStorage/SectionStorageBase.php index 41e63d148124..93f8637a564a 100644 --- a/core/modules/layout_builder/src/Plugin/SectionStorage/SectionStorageBase.php +++ b/core/modules/layout_builder/src/Plugin/SectionStorage/SectionStorageBase.php @@ -38,6 +38,7 @@ public function getStorageType() { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function count() { return $this->getSectionList()->count(); } diff --git a/core/modules/layout_builder/src/SectionListTrait.php b/core/modules/layout_builder/src/SectionListTrait.php index 3cb04e0c9647..3a2947b99e18 100644 --- a/core/modules/layout_builder/src/SectionListTrait.php +++ b/core/modules/layout_builder/src/SectionListTrait.php @@ -25,6 +25,7 @@ abstract protected function setSections(array $sections); /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function count() { if ($this->hasBlankSection()) { return 0; diff --git a/core/modules/migrate/src/Audit/AuditResult.php b/core/modules/migrate/src/Audit/AuditResult.php index d5260775e1d4..af0f0961c28a 100644 --- a/core/modules/migrate/src/Audit/AuditResult.php +++ b/core/modules/migrate/src/Audit/AuditResult.php @@ -119,6 +119,7 @@ public static function fail(MigrationInterface $migration, array $reasons = []) * * @see \Drupal\Component\Render\MarkupInterface */ + #[\ReturnTypeWillChange] public function count() { return count($this->reasons); } @@ -139,6 +140,7 @@ public function __toString() { * * @return string[] */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return $this->reasons; } diff --git a/core/modules/migrate/src/Plugin/migrate/id_map/NullIdMap.php b/core/modules/migrate/src/Plugin/migrate/id_map/NullIdMap.php index 622ce19e66c2..1415373eab10 100644 --- a/core/modules/migrate/src/Plugin/migrate/id_map/NullIdMap.php +++ b/core/modules/migrate/src/Plugin/migrate/id_map/NullIdMap.php @@ -181,6 +181,7 @@ public function getQualifiedMapTableName() { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function rewind() { return NULL; } @@ -188,6 +189,7 @@ public function rewind() { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function current() { return NULL; } @@ -195,6 +197,7 @@ public function current() { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function key() { return ''; } @@ -202,6 +205,7 @@ public function key() { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function next() { return NULL; } @@ -209,6 +213,7 @@ public function next() { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function valid() { return FALSE; } diff --git a/core/modules/migrate/src/Plugin/migrate/id_map/Sql.php b/core/modules/migrate/src/Plugin/migrate/id_map/Sql.php index 3aab791bf22e..31dcc222588c 100644 --- a/core/modules/migrate/src/Plugin/migrate/id_map/Sql.php +++ b/core/modules/migrate/src/Plugin/migrate/id_map/Sql.php @@ -887,6 +887,7 @@ public function destroy() { * * This is called before beginning a foreach loop. */ + #[\ReturnTypeWillChange] public function rewind() { $this->currentRow = NULL; $fields = []; @@ -908,6 +909,7 @@ public function rewind() { * * This is called when entering a loop iteration, returning the current row. */ + #[\ReturnTypeWillChange] public function current() { return $this->currentRow; } @@ -919,6 +921,7 @@ public function current() { * current row. It must be a scalar - we will serialize to fulfill the * requirement, but using getCurrentKey() is preferable. */ + #[\ReturnTypeWillChange] public function key() { return serialize($this->currentKey); } @@ -963,6 +966,7 @@ public function currentSource() { * This is called at the bottom of the loop implicitly, as well as explicitly * from rewind(). */ + #[\ReturnTypeWillChange] public function next() { $this->currentRow = $this->result->fetchAssoc(); $this->currentKey = []; @@ -981,6 +985,7 @@ public function next() { * This is called at the top of the loop, returning TRUE to process the loop * and FALSE to terminate it. */ + #[\ReturnTypeWillChange] public function valid() { return $this->currentRow !== FALSE; } diff --git a/core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php b/core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php index ffcfe894d5a7..b79148e3a8ff 100644 --- a/core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php +++ b/core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php @@ -343,6 +343,7 @@ protected function getIterator() { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function current() { return $this->currentRow; } @@ -355,6 +356,7 @@ public function current() { * serialize to fulfill the requirement, but using getCurrentIds() is * preferable. */ + #[\ReturnTypeWillChange] public function key() { return serialize($this->currentSourceIds); } @@ -365,6 +367,7 @@ public function key() { * Implementation of \Iterator::valid() - called at the top of the loop, * returning TRUE to process the loop and FALSE to terminate it. */ + #[\ReturnTypeWillChange] public function valid() { return isset($this->currentRow); } @@ -376,6 +379,7 @@ public function valid() { * should implement initializeIterator() to do any class-specific setup for * iterating source records. */ + #[\ReturnTypeWillChange] public function rewind() { $this->getIterator()->rewind(); $this->next(); @@ -384,6 +388,7 @@ public function rewind() { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function next() { $this->currentSourceIds = NULL; $this->currentRow = NULL; @@ -486,6 +491,7 @@ public function getCurrentIds() { * @return int * The count. */ + #[\ReturnTypeWillChange] public function count($refresh = FALSE) { if ($this->skipCount) { return MigrateSourceInterface::NOT_COUNTABLE; diff --git a/core/modules/system/tests/modules/session_test/src/Session/TestSessionHandlerProxy.php b/core/modules/system/tests/modules/session_test/src/Session/TestSessionHandlerProxy.php index 2d2999e335de..a4e28b640a2a 100644 --- a/core/modules/system/tests/modules/session_test/src/Session/TestSessionHandlerProxy.php +++ b/core/modules/system/tests/modules/session_test/src/Session/TestSessionHandlerProxy.php @@ -37,6 +37,7 @@ public function __construct(\SessionHandlerInterface $session_handler, $optional /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function open($save_path, $name) { $trace = \Drupal::service('session_test.session_handler_proxy_trace'); $trace[] = ['BEGIN', $this->optionalArgument, __FUNCTION__]; @@ -48,6 +49,7 @@ public function open($save_path, $name) { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function close() { $trace = \Drupal::service('session_test.session_handler_proxy_trace'); $trace[] = ['BEGIN', $this->optionalArgument, __FUNCTION__]; @@ -59,6 +61,7 @@ public function close() { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function read($session_id) { $trace = \Drupal::service('session_test.session_handler_proxy_trace'); $trace[] = ['BEGIN', $this->optionalArgument, __FUNCTION__, $session_id]; @@ -70,6 +73,7 @@ public function read($session_id) { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function write($session_id, $session_data) { $trace = \Drupal::service('session_test.session_handler_proxy_trace'); $trace[] = ['BEGIN', $this->optionalArgument, __FUNCTION__, $session_id]; @@ -81,6 +85,7 @@ public function write($session_id, $session_data) { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function destroy($session_id) { return $this->sessionHandler->destroy($session_id); } @@ -88,6 +93,7 @@ public function destroy($session_id) { /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function gc($max_lifetime) { return $this->sessionHandler->gc($max_lifetime); } diff --git a/core/tests/Drupal/Tests/StreamCapturer.php b/core/tests/Drupal/Tests/StreamCapturer.php index 9b8925723a41..4d71bc7505e3 100644 --- a/core/tests/Drupal/Tests/StreamCapturer.php +++ b/core/tests/Drupal/Tests/StreamCapturer.php @@ -9,6 +9,7 @@ class StreamCapturer extends \php_user_filter { public static $cache = ''; + #[\ReturnTypeWillChange] public function filter($in, $out, &$consumed, $closing) { while ($bucket = stream_bucket_make_writeable($in)) { self::$cache .= $bucket->data; -- GitLab