diff --git a/core/lib/Drupal/Component/Render/FormattableMarkup.php b/core/lib/Drupal/Component/Render/FormattableMarkup.php index 6cebd3e3a1ac183886dfc1b8f9fa4a7eb99fe1ec..63c4892ce3c40e414f86d5dbe469a7bc28d3f880 100644 --- a/core/lib/Drupal/Component/Render/FormattableMarkup.php +++ b/core/lib/Drupal/Component/Render/FormattableMarkup.php @@ -105,7 +105,8 @@ public function __toString() { * @return int * The length of the string. */ - public function count(): int { + #[\ReturnTypeWillChange] + public function count() { return mb_strlen($this->string); } @@ -115,7 +116,8 @@ public function count(): int { * @return string * The safe string content. */ - public function jsonSerialize(): string { + #[\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 8b569696d6239e7b1022b83d9bdb648c809a2abf..93ed4d2eb0da3cf8f4b725a260aa8bcaa3638f46 100644 --- a/core/lib/Drupal/Component/Render/MarkupTrait.php +++ b/core/lib/Drupal/Component/Render/MarkupTrait.php @@ -58,7 +58,8 @@ public function __toString() { * @return int * The length of the string. */ - public function count(): int { + #[\ReturnTypeWillChange] + public function count() { return mb_strlen($this->string); } @@ -68,7 +69,8 @@ public function count(): int { * @return string * The safe string content. */ - public function jsonSerialize(): string { + #[\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 6f93c7c68d08eba42d092445dfb6088eb9d226d6..f3ef310ce43c7e08f3c474e67b87f65bb9716e1a 100644 --- a/core/lib/Drupal/Component/Utility/DeprecatedArray.php +++ b/core/lib/Drupal/Component/Utility/DeprecatedArray.php @@ -30,7 +30,8 @@ public function __construct(array $values, $message) { /** * {@inheritdoc} */ - public function offsetExists($offset): bool { + #[\ReturnTypeWillChange] + public function offsetExists($offset) { @trigger_error($this->message, E_USER_DEPRECATED); return parent::offsetExists($offset); } @@ -38,7 +39,8 @@ public function offsetExists($offset): bool { /** * {@inheritdoc} */ - public function offsetGet($offset): mixed { + #[\ReturnTypeWillChange] + public function offsetGet($offset) { @trigger_error($this->message, E_USER_DEPRECATED); return parent::offsetGet($offset); } @@ -46,7 +48,8 @@ public function offsetGet($offset): mixed { /** * {@inheritdoc} */ - public function offsetSet($offset, $value): void { + #[\ReturnTypeWillChange] + public function offsetSet($offset, $value) { @trigger_error($this->message, E_USER_DEPRECATED); parent::offsetSet($offset, $value); } @@ -54,7 +57,8 @@ public function offsetSet($offset, $value): void { /** * {@inheritdoc} */ - public function offsetUnset($offset): void { + #[\ReturnTypeWillChange] + public function offsetUnset($offset) { @trigger_error($this->message, E_USER_DEPRECATED); parent::offsetUnset($offset); } @@ -62,7 +66,8 @@ public function offsetUnset($offset): void { /** * {@inheritdoc} */ - public function getIterator(): \ArrayIterator { + #[\ReturnTypeWillChange] + public function getIterator() { @trigger_error($this->message, E_USER_DEPRECATED); return parent::getIterator(); } @@ -70,7 +75,8 @@ public function getIterator(): \ArrayIterator { /** * {@inheritdoc} */ - public function unserialize($serialized): void { + #[\ReturnTypeWillChange] + public function unserialize($serialized) { @trigger_error($this->message, E_USER_DEPRECATED); parent::unserialize($serialized); } @@ -78,7 +84,8 @@ public function unserialize($serialized): void { /** * {@inheritdoc} */ - public function serialize(): string { + #[\ReturnTypeWillChange] + public function serialize() { @trigger_error($this->message, E_USER_DEPRECATED); return parent::serialize(); } @@ -86,7 +93,8 @@ public function serialize(): string { /** * {@inheritdoc} */ - public function count(): int { + #[\ReturnTypeWillChange] + public function count() { @trigger_error($this->message, E_USER_DEPRECATED); return parent::count(); } diff --git a/core/lib/Drupal/Core/Cache/MemoryBackend.php b/core/lib/Drupal/Core/Cache/MemoryBackend.php index 0f1ec5de13715e845270cba7f631900ea22fdb3c..267ccd1b6b1209b1152b90cfc8161a61b220ac9d 100644 --- a/core/lib/Drupal/Core/Cache/MemoryBackend.php +++ b/core/lib/Drupal/Core/Cache/MemoryBackend.php @@ -222,7 +222,7 @@ protected function getRequestTime() { /** * Prevents data stored in memory backends from being serialized. */ - public function __sleep(): array { + public function __sleep() { return ['time']; } diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php index c82bcddfbb78d2dd480c407521c81010379ca22a..ad50387947ff94d31208dab8b928e57964073f1a 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php @@ -340,7 +340,7 @@ public function preSave(EntityStorageInterface $storage) { /** * {@inheritdoc} */ - public function __sleep(): array { + public function __sleep() { $keys_to_unset = []; if ($this instanceof EntityWithPluginCollectionInterface) { // Get the plugin collections first, so that the properties are diff --git a/core/lib/Drupal/Core/Database/Connection.php b/core/lib/Drupal/Core/Database/Connection.php index e4c11093d3b8c8062c635a0cd79bc9105b7b8cde..a5fad548940465781c98948ef8e3b5c3cab7b128 100644 --- a/core/lib/Drupal/Core/Database/Connection.php +++ b/core/lib/Drupal/Core/Database/Connection.php @@ -1916,7 +1916,7 @@ protected static function getSQLState(\Exception $e) { /** * Prevents the database connection from being serialized. */ - public function __sleep(): array { + public function __sleep() { throw new \LogicException('The database connection is not serializable. This probably means you are serializing an object that has an indirect reference to the database connection. Adjust your code so that is not necessary. Alternatively, look at DependencySerializationTrait as a temporary solution.'); } diff --git a/core/lib/Drupal/Core/Database/Query/Query.php b/core/lib/Drupal/Core/Database/Query/Query.php index 98dc1e06ea2aefe175a386ddab08bea59f45d503..37bce1a8f914f1ec48525b16fe2ff90a9baa5c48 100644 --- a/core/lib/Drupal/Core/Database/Query/Query.php +++ b/core/lib/Drupal/Core/Database/Query/Query.php @@ -83,7 +83,7 @@ public function __construct(Connection $connection, $options) { /** * Implements the magic __sleep function to disconnect from the database. */ - public function __sleep(): array { + public function __sleep() { $keys = get_object_vars($this); unset($keys['connection']); return array_keys($keys); @@ -92,7 +92,7 @@ public function __sleep(): array { /** * Implements the magic __wakeup function to reconnect to the database. */ - public function __wakeup(): void { + public function __wakeup() { $this->connection = Database::getConnection($this->connectionTarget, $this->connectionKey); } diff --git a/core/lib/Drupal/Core/DependencyInjection/Container.php b/core/lib/Drupal/Core/DependencyInjection/Container.php index c40fc533ba1207fff2ac2eaca4f9f1e3877f072e..125f593adb3c2b6314dbb1f14075211751a9aeab 100644 --- a/core/lib/Drupal/Core/DependencyInjection/Container.php +++ b/core/lib/Drupal/Core/DependencyInjection/Container.php @@ -12,7 +12,7 @@ class Container extends DrupalContainer { /** * {@inheritdoc} */ - public function __sleep(): array { + public function __sleep() { assert(FALSE, 'The container was serialized.'); return array_keys(get_object_vars($this)); } diff --git a/core/lib/Drupal/Core/DependencyInjection/ContainerBuilder.php b/core/lib/Drupal/Core/DependencyInjection/ContainerBuilder.php index 10e1814c1f3b8ab3d2f8407c99af39080f776ee5..84c529b4dfc399f55f506e902357290db13fbd07 100644 --- a/core/lib/Drupal/Core/DependencyInjection/ContainerBuilder.php +++ b/core/lib/Drupal/Core/DependencyInjection/ContainerBuilder.php @@ -84,7 +84,7 @@ public function setParameter($name, $value) { /** * {@inheritdoc} */ - public function __sleep(): array { + public function __sleep() { assert(FALSE, 'The container was serialized.'); return array_keys(get_object_vars($this)); } diff --git a/core/lib/Drupal/Core/DependencyInjection/DependencySerializationTrait.php b/core/lib/Drupal/Core/DependencyInjection/DependencySerializationTrait.php index c3cc3e34b8b6a90ddfbc0fdd013ca4a9c8b1d665..edb080e94ebccff73c871ff2cb9cdc037ed3a459 100644 --- a/core/lib/Drupal/Core/DependencyInjection/DependencySerializationTrait.php +++ b/core/lib/Drupal/Core/DependencyInjection/DependencySerializationTrait.php @@ -30,7 +30,7 @@ trait DependencySerializationTrait { /** * {@inheritdoc} */ - public function __sleep(): array { + public function __sleep() { $vars = get_object_vars($this); try { $container = \Drupal::getContainer(); @@ -70,7 +70,8 @@ public function __sleep(): array { /** * {@inheritdoc} */ - public function __wakeup(): void { + #[\ReturnTypeWillChange] + public function __wakeup() { // Avoid trying to wakeup if there's nothing to do. if (empty($this->_serviceIds) && empty($this->_entityStorages)) { return; diff --git a/core/lib/Drupal/Core/Entity/ContentEntityBase.php b/core/lib/Drupal/Core/Entity/ContentEntityBase.php index e701667ec5fdf08bec059507fed3de7fe5cc1c68..52b96742567625b154cc1d7408c9db43c09fb14e 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityBase.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityBase.php @@ -546,7 +546,7 @@ protected function clearTranslationCache() { /** * {@inheritdoc} */ - public function __sleep(): array { + public function __sleep() { // Get the values of instantiated field objects, only serialize the values. foreach ($this->fields as $name => $fields) { foreach ($fields as $langcode => $field) { diff --git a/core/lib/Drupal/Core/Entity/EntityBase.php b/core/lib/Drupal/Core/Entity/EntityBase.php index 8a32728bf2b53b21adaf6d0ebf7399e894b3b89a..781417760ce6ec6b12f7a58b13bb15887d66481d 100644 --- a/core/lib/Drupal/Core/Entity/EntityBase.php +++ b/core/lib/Drupal/Core/Entity/EntityBase.php @@ -637,7 +637,7 @@ private function getTypedDataClass(): string { /** * {@inheritdoc} */ - public function __sleep(): array { + public function __sleep() { $this->typedData = NULL; return $this->traitSleep(); } diff --git a/core/lib/Drupal/Core/Entity/EntityDisplayBase.php b/core/lib/Drupal/Core/Entity/EntityDisplayBase.php index 48d70f818ed3ac59e691ce881b7787c9e522b82b..768835903f62dc778771674f05ffd05f933a0cd4 100644 --- a/core/lib/Drupal/Core/Entity/EntityDisplayBase.php +++ b/core/lib/Drupal/Core/Entity/EntityDisplayBase.php @@ -544,7 +544,7 @@ protected function getDefaultRegion() { /** * {@inheritdoc} */ - public function __sleep(): array { + public function __sleep() { // Only store the definition, not external objects or derived data. $keys = array_keys($this->toArray()); // In addition, we need to keep the entity type and the "is new" status. @@ -563,7 +563,7 @@ public function __sleep(): array { /** * {@inheritdoc} */ - public function __wakeup(): void { + public function __wakeup() { // Determine what were the properties from toArray() that were saved in // __sleep(). $keys = $this->_serializedKeys; diff --git a/core/lib/Drupal/Core/Entity/Query/ConditionFundamentals.php b/core/lib/Drupal/Core/Entity/Query/ConditionFundamentals.php index 36ea69861d87795a6decd5f70c628de42d35e514..e176b68588b6b3db3be119fa393838745933e666 100644 --- a/core/lib/Drupal/Core/Entity/Query/ConditionFundamentals.php +++ b/core/lib/Drupal/Core/Entity/Query/ConditionFundamentals.php @@ -65,7 +65,8 @@ public function getConjunction() { /** * {@inheritdoc} */ - public function count(): int { + #[\ReturnTypeWillChange] + public function count() { return count($this->conditions); } diff --git a/core/lib/Drupal/Core/Extension/Dependency.php b/core/lib/Drupal/Core/Extension/Dependency.php index 622be6b7959c81c9af81ed884b3f0ed29593913d..0f305df890173b129cbe980bf27fcd85f4aa424f 100644 --- a/core/lib/Drupal/Core/Extension/Dependency.php +++ b/core/lib/Drupal/Core/Extension/Dependency.php @@ -141,7 +141,7 @@ public static function createFromString($dependency) { * @return array * The properties to serialize. */ - public function __sleep(): array { + public function __sleep() { return ['name', 'project', 'constraintString']; } diff --git a/core/lib/Drupal/Core/Extension/Extension.php b/core/lib/Drupal/Core/Extension/Extension.php index f0c46666613a7562daacc1867b9b51b46f499c13..3ef96ffbd3cd8b648958411e0ec9fc16c13058dc 100644 --- a/core/lib/Drupal/Core/Extension/Extension.php +++ b/core/lib/Drupal/Core/Extension/Extension.php @@ -192,7 +192,7 @@ public function getFileInfo(): \SplFileInfo { * @return array * The names of all variables that should be serialized. */ - public function __sleep(): array { + public function __sleep() { // @todo \Drupal\Core\Extension\ThemeExtensionList is adding custom // properties to the Extension object. $properties = get_object_vars($this); @@ -205,7 +205,7 @@ public function __sleep(): array { /** * Magic method implementation to unserialize the extension object. */ - public function __wakeup(): void { + public function __wakeup() { // Get the app root from the container. While compiling the container we // have to discover all the extension service files in // \Drupal\Core\DrupalKernel::initializeServiceProviders(). This results in diff --git a/core/lib/Drupal/Core/Field/BaseFieldDefinition.php b/core/lib/Drupal/Core/Field/BaseFieldDefinition.php index 811c81edb19f71ed6b759fad3aaf7140cb31fb53..520ff8a70977739ca6810c2f7c2cb2b77f862275 100644 --- a/core/lib/Drupal/Core/Field/BaseFieldDefinition.php +++ b/core/lib/Drupal/Core/Field/BaseFieldDefinition.php @@ -610,7 +610,7 @@ public function getMainPropertyName() { /** * {@inheritdoc} */ - public function __sleep(): array { + public function __sleep() { // Do not serialize the statically cached property definitions. $vars = get_object_vars($this); unset($vars['propertyDefinitions'], $vars['typedDataManager']); diff --git a/core/lib/Drupal/Core/Field/Entity/BaseFieldOverride.php b/core/lib/Drupal/Core/Field/Entity/BaseFieldOverride.php index 1e3cdf81f111eaa9b35c00d5f4293095fd9d9c96..3f16fdad989187cffdaa652c13c0482a8dc6e6ba 100644 --- a/core/lib/Drupal/Core/Field/Entity/BaseFieldOverride.php +++ b/core/lib/Drupal/Core/Field/Entity/BaseFieldOverride.php @@ -259,7 +259,7 @@ public static function loadByName($entity_type_id, $bundle, $field_name) { /** * Implements the magic __sleep() method. */ - public function __sleep(): array { + public function __sleep() { // Only serialize necessary properties, excluding those that can be // recalculated. unset($this->baseFieldDefinition); diff --git a/core/lib/Drupal/Core/Field/FieldConfigBase.php b/core/lib/Drupal/Core/Field/FieldConfigBase.php index 5b21717d9ead794434cd1983783c24b6cd0813b3..ca9a5b5285ead4c5285ec4cf6b7a091b670f6405 100644 --- a/core/lib/Drupal/Core/Field/FieldConfigBase.php +++ b/core/lib/Drupal/Core/Field/FieldConfigBase.php @@ -467,7 +467,7 @@ public function setDefaultValueCallback($callback) { * breaks entity forms in PHP 5.4. * @todo Investigate in https://www.drupal.org/node/1977206. */ - public function __sleep(): array { + public function __sleep() { $properties = get_object_vars($this); // Only serialize necessary properties, excluding those that can be diff --git a/core/lib/Drupal/Core/Plugin/Discovery/RegexRecursiveFilterIterator.php b/core/lib/Drupal/Core/Plugin/Discovery/RegexRecursiveFilterIterator.php index 3a4bd05ac6d1e30b4b3712570ae236b09e3c3ba5..1d86e1bba0264cfbaf4efff6e407e58c2aa9ab61 100644 --- a/core/lib/Drupal/Core/Plugin/Discovery/RegexRecursiveFilterIterator.php +++ b/core/lib/Drupal/Core/Plugin/Discovery/RegexRecursiveFilterIterator.php @@ -23,7 +23,8 @@ public function __construct(\RecursiveIterator $iterator, protected string $rege /** * {@inheritdoc} */ - public function accept(): bool { + #[\ReturnTypeWillChange] + public function accept() { /** @var \SplFileInfo $file_info */ $file_info = $this->getInnerIterator()->current(); if ($file_info->isDir()) { @@ -37,7 +38,8 @@ public function accept(): bool { /** * {@inheritdoc} */ - public function getChildren(): ?\RecursiveFilterIterator { + #[\ReturnTypeWillChange] + public function getChildren() { $children = parent::getChildren(); if ($children instanceof self && empty($children->regex)) { $children->regex = $this->regex; diff --git a/core/lib/Drupal/Core/Site/Settings.php b/core/lib/Drupal/Core/Site/Settings.php index 7516e64b7c73ad766d841236c27a9c0b0fa9bfcc..bc94826079c036992dae5fa51fe52f6412f98173 100644 --- a/core/lib/Drupal/Core/Site/Settings.php +++ b/core/lib/Drupal/Core/Site/Settings.php @@ -86,7 +86,7 @@ private function __clone() { /** * Prevents settings from being serialized. */ - public function __sleep(): array { + public function __sleep() { throw new \LogicException('Settings can not be serialized. This probably means you are serializing an object that has an indirect reference to the Settings object. Adjust your code so that is not necessary.'); } diff --git a/core/lib/Drupal/Core/StringTranslation/PluralTranslatableMarkup.php b/core/lib/Drupal/Core/StringTranslation/PluralTranslatableMarkup.php index b1583e12d0ab5feebb1c8ecc56de364cd0d93e41..d6410b2e5910f9f6f4a428382dd6f75accf52583 100644 --- a/core/lib/Drupal/Core/StringTranslation/PluralTranslatableMarkup.php +++ b/core/lib/Drupal/Core/StringTranslation/PluralTranslatableMarkup.php @@ -140,7 +140,7 @@ protected function getPluralIndex() { /** * {@inheritdoc} */ - public function __sleep(): array { + public function __sleep() { return array_merge(parent::__sleep(), ['count']); } diff --git a/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php b/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php index dce967cfcf0c5fa5daafd46a30716c27a99481d8..8f24cf3cb09cf5437728a61f17d00ac4bc2eb0bd 100644 --- a/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php +++ b/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php @@ -200,7 +200,7 @@ public function render() { /** * Magic __sleep() method to avoid serializing the string translator. */ - public function __sleep(): array { + public function __sleep() { return ['string', 'arguments', 'options']; } @@ -224,7 +224,8 @@ protected function getStringTranslation() { * @return int * The length of the string. */ - public function count(): int { + #[\ReturnTypeWillChange] + public function count() { return mb_strlen($this->render()); } diff --git a/core/lib/Drupal/Core/TypedData/ComplexDataDefinitionBase.php b/core/lib/Drupal/Core/TypedData/ComplexDataDefinitionBase.php index 3b22d5fe58399b1753b25c9212630df6e87fc8f5..0002497e9480daf61512bb3ce83895da8a6809b7 100644 --- a/core/lib/Drupal/Core/TypedData/ComplexDataDefinitionBase.php +++ b/core/lib/Drupal/Core/TypedData/ComplexDataDefinitionBase.php @@ -39,7 +39,7 @@ public function getMainPropertyName() { /** * {@inheritdoc} */ - public function __sleep(): array { + public function __sleep() { // Do not serialize the cached property definitions. $vars = get_object_vars($this); unset($vars['propertyDefinitions'], $vars['typedDataManager']); diff --git a/core/lib/Drupal/Core/TypedData/DataDefinition.php b/core/lib/Drupal/Core/TypedData/DataDefinition.php index 0aaa02abcca89e8a136267d27f81bce414a92f05..a82f819b4cde82b7021259c442c92112de51064d 100644 --- a/core/lib/Drupal/Core/TypedData/DataDefinition.php +++ b/core/lib/Drupal/Core/TypedData/DataDefinition.php @@ -369,7 +369,7 @@ public function toArray() { /** * {@inheritdoc} */ - public function __sleep(): array { + public function __sleep() { // Never serialize the typed data manager. $vars = get_object_vars($this); unset($vars['typedDataManager']); diff --git a/core/modules/field/src/Entity/FieldStorageConfig.php b/core/modules/field/src/Entity/FieldStorageConfig.php index bbd9a0737141a4cb8f057c01d6b01f77d68824fc..b966e763ec50bfdf22556aad0f0d21fe36f98d05 100644 --- a/core/modules/field/src/Entity/FieldStorageConfig.php +++ b/core/modules/field/src/Entity/FieldStorageConfig.php @@ -751,7 +751,7 @@ public function hasData() { * breaks entity forms in PHP 5.4. * @todo Investigate in https://www.drupal.org/node/1977206. */ - public function __sleep(): array { + public function __sleep() { // Only serialize necessary properties, excluding those that can be // recalculated. $properties = get_object_vars($this); diff --git a/core/modules/forum/src/ForumManager.php b/core/modules/forum/src/ForumManager.php index aee4409d242377d03ecd5100566495b2e7d9aee2..79b91b1db39f0226bc30e741b8b35dc5f08ec38b 100644 --- a/core/modules/forum/src/ForumManager.php +++ b/core/modules/forum/src/ForumManager.php @@ -502,7 +502,7 @@ public function unreadTopics($term, $uid) { /** * {@inheritdoc} */ - public function __sleep(): array { + public function __sleep() { $vars = $this->defaultSleep(); // Do not serialize static cache. unset($vars['history'], $vars['index'], $vars['lastPostData'], $vars['forumChildren'], $vars['forumStatistics']); @@ -512,7 +512,7 @@ public function __sleep(): array { /** * {@inheritdoc} */ - public function __wakeup(): void { + public function __wakeup() { $this->defaultWakeup(); // Initialize static cache. $this->history = []; diff --git a/core/modules/jsonapi/src/JsonApiResource/Data.php b/core/modules/jsonapi/src/JsonApiResource/Data.php index bac3a7fc5f39c103ce8c6013f25c0508c203826c..113e3bf559d34ffb6601154e2aab109daea329fe 100644 --- a/core/modules/jsonapi/src/JsonApiResource/Data.php +++ b/core/modules/jsonapi/src/JsonApiResource/Data.php @@ -69,7 +69,8 @@ public function __construct(array $data, $cardinality = -1) { * @return \ArrayIterator * An \ArrayIterator instance */ - public function getIterator(): \ArrayIterator { + #[\ReturnTypeWillChange] + public function getIterator() { return new \ArrayIterator($this->data); } @@ -79,7 +80,8 @@ public function getIterator(): \ArrayIterator { * @return int * The number of parameters */ - public function count(): int { + #[\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 7a352307c99f437273bc6a880ccc5fbbafecf7cf..018f1920940184d19d36eecab2091fab9e39b6a9 100644 --- a/core/modules/jsonapi/src/JsonApiResource/ErrorCollection.php +++ b/core/modules/jsonapi/src/JsonApiResource/ErrorCollection.php @@ -47,7 +47,8 @@ public function __construct(array $errors) { * @return \ArrayIterator * An \ArrayIterator instance */ - public function getIterator(): \ArrayIterator { + #[\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 7a465e2cb0c0425fecb7bd43f7d049d97d72b989..6381dfce5c6aa22538a3a3117241ddaab176ccfa 100644 --- a/core/modules/jsonapi/src/JsonApiResource/LinkCollection.php +++ b/core/modules/jsonapi/src/JsonApiResource/LinkCollection.php @@ -62,7 +62,8 @@ public function __construct(array $links, $context = NULL) { /** * {@inheritdoc} */ - public function getIterator(): \ArrayIterator { + #[\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/src/Normalizer/Value/TemporaryArrayObjectThrowingExceptions.php b/core/modules/jsonapi/src/Normalizer/Value/TemporaryArrayObjectThrowingExceptions.php index d6e766416b0b03d8fb9331756c43118f9185a53a..397dd2c624e7fd073f545fc295d58e6f5480ceb5 100644 --- a/core/modules/jsonapi/src/Normalizer/Value/TemporaryArrayObjectThrowingExceptions.php +++ b/core/modules/jsonapi/src/Normalizer/Value/TemporaryArrayObjectThrowingExceptions.php @@ -34,7 +34,8 @@ public function append($value): void { * This class does not support this action but it must implement it, because * it is extending \ArrayObject. */ - public function asort($flags = SORT_REGULAR): TRUE { + #[\ReturnTypeWillChange] + public function asort($flags = SORT_REGULAR): bool { throw new \Exception('This ' . __CLASS__ . ' does not support this action but it must implement it, because it is extending \ArrayObject.'); } @@ -117,7 +118,8 @@ public function getIteratorClass(): string { * This class does not support this action but it must implement it, because * it is extending \ArrayObject. */ - public function ksort($flags = SORT_REGULAR): TRUE { + #[\ReturnTypeWillChange] + public function ksort($flags = SORT_REGULAR): bool { throw new \Exception('This ' . __CLASS__ . ' does not support this action but it must implement it, because it is extending \ArrayObject.'); } @@ -128,7 +130,8 @@ public function ksort($flags = SORT_REGULAR): TRUE { * This class does not support this action but it must implement it, because * it is extending \ArrayObject. */ - public function natcasesort(): TRUE { + #[\ReturnTypeWillChange] + public function natcasesort(): bool { throw new \Exception('This ' . __CLASS__ . ' does not support this action but it must implement it, because it is extending \ArrayObject.'); } @@ -139,7 +142,8 @@ public function natcasesort(): TRUE { * This class does not support this action but it must implement it, because * it is extending \ArrayObject. */ - public function natsort(): TRUE { + #[\ReturnTypeWillChange] + public function natsort(): bool { throw new \Exception('This ' . __CLASS__ . ' does not support this action but it must implement it, because it is extending \ArrayObject.'); } @@ -170,7 +174,8 @@ public function offsetExists($key): bool { * This class does not support this action but it must implement it, because * it is extending \ArrayObject. */ - public function offsetGet($key): mixed { + #[\ReturnTypeWillChange] + public function offsetGet($key) { throw new \Exception('This ' . __CLASS__ . ' does not support this action but it must implement it, because it is extending \ArrayObject.'); } @@ -245,7 +250,8 @@ public function setIteratorClass($iteratorClass): void { * This class does not support this action but it must implement it, because * it is extending \ArrayObject. */ - public function uasort($callback): TRUE { + #[\ReturnTypeWillChange] + public function uasort($callback): bool { throw new \Exception('This ' . __CLASS__ . ' does not support this action but it must implement it, because it is extending \ArrayObject.'); } @@ -261,7 +267,8 @@ public function uasort($callback): TRUE { * This class does not support this action but it must implement it, because * it is extending \ArrayObject. */ - public function uksort($callback): TRUE { + #[\ReturnTypeWillChange] + public function uksort($callback): bool { throw new \Exception('This ' . __CLASS__ . ' does not support this action but it must implement it, because it is extending \ArrayObject.'); } 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 afd79a9df4fa4b2e4db5f197688f48f823ee1d64..9b4cc275d1bc88e1d9eddb90c5c4f6fc99720d30 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,7 +12,8 @@ class TraversableObject implements \IteratorAggregate { /** * {@inheritdoc} */ - public function getIterator(): \ArrayIterator { + #[\ReturnTypeWillChange] + public function getIterator() { return new \ArrayIterator(); } diff --git a/core/modules/migrate/src/Audit/AuditResult.php b/core/modules/migrate/src/Audit/AuditResult.php index fd77dafe436f11d4bb8f57e39f5c51dc0cc03062..af0f0961c28ab04287d4fc9040e90cb0bdab8e9e 100644 --- a/core/modules/migrate/src/Audit/AuditResult.php +++ b/core/modules/migrate/src/Audit/AuditResult.php @@ -119,7 +119,8 @@ public static function fail(MigrationInterface $migration, array $reasons = []) * * @see \Drupal\Component\Render\MarkupInterface */ - public function count(): int { + #[\ReturnTypeWillChange] + public function count() { return count($this->reasons); } @@ -139,7 +140,8 @@ public function __toString() { * * @return string[] */ - public function jsonSerialize(): 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 80c5da68a5a1e1d6814a2c9e6071dd6c432a590f..1415373eab1092d843d739a9f7d5717a1dc5440d 100644 --- a/core/modules/migrate/src/Plugin/migrate/id_map/NullIdMap.php +++ b/core/modules/migrate/src/Plugin/migrate/id_map/NullIdMap.php @@ -181,33 +181,40 @@ public function getQualifiedMapTableName() { /** * {@inheritdoc} */ - public function rewind(): void { + #[\ReturnTypeWillChange] + public function rewind() { + return NULL; } /** * {@inheritdoc} */ - public function current(): mixed { + #[\ReturnTypeWillChange] + public function current() { return NULL; } /** * {@inheritdoc} */ - public function key(): mixed { + #[\ReturnTypeWillChange] + public function key() { return ''; } /** * {@inheritdoc} */ - public function next(): void { + #[\ReturnTypeWillChange] + public function next() { + return NULL; } /** * {@inheritdoc} */ - public function valid(): bool { + #[\ReturnTypeWillChange] + public function valid() { return FALSE; } diff --git a/core/modules/migrate/src/Plugin/migrate/source/EmbeddedDataSource.php b/core/modules/migrate/src/Plugin/migrate/source/EmbeddedDataSource.php index a61a951f3e055bd13193b6b852db1afa0a606855..158b3a8914d1606672bc5b8f1a6a99bad8c9f437 100644 --- a/core/modules/migrate/src/Plugin/migrate/source/EmbeddedDataSource.php +++ b/core/modules/migrate/src/Plugin/migrate/source/EmbeddedDataSource.php @@ -113,7 +113,8 @@ public function getIds() { /** * {@inheritdoc} */ - public function count($refresh = FALSE): int { + #[\ReturnTypeWillChange] + public function count($refresh = FALSE) { // We do not want this source plugin to have a cacheable count. // @see \Drupal\migrate_cache_counts_test\Plugin\migrate\source\CacheableEmbeddedDataSource return count($this->dataRows); diff --git a/core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php b/core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php index 6dc65aa8f2028fcf089c9fc2686733098ca34d06..3191c7256d4a3494152ed4e16418da8a51df810c 100644 --- a/core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php +++ b/core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php @@ -492,7 +492,8 @@ public function getCurrentIds() { * @return int * The count. */ - public function count($refresh = FALSE): int { + #[\ReturnTypeWillChange] + public function count($refresh = FALSE) { if ($this->skipCount) { return MigrateSourceInterface::NOT_COUNTABLE; } diff --git a/core/modules/migrate/src/Plugin/migrate/source/SqlBase.php b/core/modules/migrate/src/Plugin/migrate/source/SqlBase.php index 57f483e8407f2f1a2d4a99aa2c6f9be3c4c5e148..e5c2b075916f49d8fec68d31df29a2611d1dbc8a 100644 --- a/core/modules/migrate/src/Plugin/migrate/source/SqlBase.php +++ b/core/modules/migrate/src/Plugin/migrate/source/SqlBase.php @@ -469,7 +469,7 @@ protected function mapJoinable() { /** * {@inheritdoc} */ - public function __sleep(): array { + public function __sleep() { return array_diff(parent::__sleep(), ['database']); } diff --git a/core/modules/migrate/tests/modules/migrate_cache_counts_test/src/Plugin/migrate/source/CacheableEmbeddedDataSource.php b/core/modules/migrate/tests/modules/migrate_cache_counts_test/src/Plugin/migrate/source/CacheableEmbeddedDataSource.php index 64f4736822144798f67c3d2247ef09c830ebb2f6..47dd1b733092537013ff5490ab67ee8926d0fc91 100644 --- a/core/modules/migrate/tests/modules/migrate_cache_counts_test/src/Plugin/migrate/source/CacheableEmbeddedDataSource.php +++ b/core/modules/migrate/tests/modules/migrate_cache_counts_test/src/Plugin/migrate/source/CacheableEmbeddedDataSource.php @@ -18,7 +18,8 @@ class CacheableEmbeddedDataSource extends EmbeddedDataSource { /** * {@inheritdoc} */ - public function count($refresh = FALSE): int { + #[\ReturnTypeWillChange] + public function count($refresh = FALSE) { return SourcePluginBase::count($refresh); } diff --git a/core/modules/migrate_drupal/src/Plugin/migrate/source/ContentEntity.php b/core/modules/migrate_drupal/src/Plugin/migrate/source/ContentEntity.php index 5d80f6160a77df322a8c9d6e7a8e04f5f3cdf226..798b1eda6b45c4f058e9e44e27370d394718029a 100644 --- a/core/modules/migrate_drupal/src/Plugin/migrate/source/ContentEntity.php +++ b/core/modules/migrate_drupal/src/Plugin/migrate/source/ContentEntity.php @@ -242,7 +242,8 @@ public function query() { /** * {@inheritdoc} */ - public function count($refresh = FALSE): int { + #[\ReturnTypeWillChange] + public function count($refresh = FALSE) { // If no translations are included, then a simple query is possible. if (!$this->configuration['include_translations']) { return parent::count($refresh); 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 7d89096f8d4effe498eaeb9cec929affc0909874..a4e28b640a2aeb65c372a728836a761bcecb08e9 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,7 +37,8 @@ public function __construct(\SessionHandlerInterface $session_handler, $optional /** * {@inheritdoc} */ - public function open($save_path, $name): bool { + #[\ReturnTypeWillChange] + public function open($save_path, $name) { $trace = \Drupal::service('session_test.session_handler_proxy_trace'); $trace[] = ['BEGIN', $this->optionalArgument, __FUNCTION__]; $result = $this->sessionHandler->open($save_path, $name); @@ -48,7 +49,8 @@ public function open($save_path, $name): bool { /** * {@inheritdoc} */ - public function close(): bool { + #[\ReturnTypeWillChange] + public function close() { $trace = \Drupal::service('session_test.session_handler_proxy_trace'); $trace[] = ['BEGIN', $this->optionalArgument, __FUNCTION__]; $result = $this->sessionHandler->close(); @@ -59,7 +61,8 @@ public function close(): bool { /** * {@inheritdoc} */ - public function read($session_id): string|FALSE { + #[\ReturnTypeWillChange] + public function read($session_id) { $trace = \Drupal::service('session_test.session_handler_proxy_trace'); $trace[] = ['BEGIN', $this->optionalArgument, __FUNCTION__, $session_id]; $result = $this->sessionHandler->read($session_id); @@ -70,7 +73,8 @@ public function read($session_id): string|FALSE { /** * {@inheritdoc} */ - public function write($session_id, $session_data): bool { + #[\ReturnTypeWillChange] + public function write($session_id, $session_data) { $trace = \Drupal::service('session_test.session_handler_proxy_trace'); $trace[] = ['BEGIN', $this->optionalArgument, __FUNCTION__, $session_id]; $result = $this->sessionHandler->write($session_id, $session_data); @@ -81,14 +85,16 @@ public function write($session_id, $session_data): bool { /** * {@inheritdoc} */ - public function destroy($session_id): bool { + #[\ReturnTypeWillChange] + public function destroy($session_id) { return $this->sessionHandler->destroy($session_id); } /** * {@inheritdoc} */ - public function gc($max_lifetime): int|FALSE { + #[\ReturnTypeWillChange] + public function gc($max_lifetime) { return $this->sessionHandler->gc($max_lifetime); } diff --git a/core/modules/taxonomy/src/TermStorage.php b/core/modules/taxonomy/src/TermStorage.php index 25f6fa9b38dcfe74c2d8a3b84fb945a3c23714fe..e121a1744a3ab0ea723d61fe85b469cb589e0dca 100644 --- a/core/modules/taxonomy/src/TermStorage.php +++ b/core/modules/taxonomy/src/TermStorage.php @@ -448,7 +448,7 @@ public function getVocabularyHierarchyType($vid) { /** * {@inheritdoc} */ - public function __sleep(): array { + public function __sleep() { /** @var string[] $vars */ $vars = parent::__sleep(); // Do not serialize static cache. @@ -459,7 +459,7 @@ public function __sleep(): array { /** * {@inheritdoc} */ - public function __wakeup(): void { + public function __wakeup() { parent::__wakeup(); // Initialize static caches. $this->ancestors = []; diff --git a/core/modules/views/src/Entity/View.php b/core/modules/views/src/Entity/View.php index 9c57451d58a9ba2f76c58e394eb5bbf2088e5f04..8fb42eadf47eb18497b612d21fedeb92b727117f 100644 --- a/core/modules/views/src/Entity/View.php +++ b/core/modules/views/src/Entity/View.php @@ -462,7 +462,7 @@ public function isInstallable() { /** * {@inheritdoc} */ - public function __sleep(): array { + public function __sleep() { $keys = parent::__sleep(); unset($keys[array_search('executable', $keys)]); return $keys; diff --git a/core/modules/views/src/ViewExecutable.php b/core/modules/views/src/ViewExecutable.php index 58c18fc51b208e08f4ef486f4bb735f40972839d..7d73d7f21264157723fc672369b42cd5fa7b5ae7 100644 --- a/core/modules/views/src/ViewExecutable.php +++ b/core/modules/views/src/ViewExecutable.php @@ -2499,7 +2499,7 @@ public function getDependencies() { * @return array * The names of all variables that should be serialized. */ - public function __sleep(): array { + public function __sleep() { // Limit to only the required data which is needed to properly restore the // state during unserialization. $this->serializationData = [ @@ -2519,7 +2519,7 @@ public function __sleep(): array { /** * Magic method implementation to unserialize the view executable. */ - public function __wakeup(): void { + public function __wakeup() { // There are cases, like in testing where we don't have a container // available. if (\Drupal::hasContainer() && !empty($this->serializationData)) { diff --git a/core/tests/Drupal/KernelTests/KernelTestBase.php b/core/tests/Drupal/KernelTests/KernelTestBase.php index 236ddf89a43cadc66f4c4904405c0ee9d42415a5..7e3fc2d995f4fca23a42e301e5e04703afc5bf40 100644 --- a/core/tests/Drupal/KernelTests/KernelTestBase.php +++ b/core/tests/Drupal/KernelTests/KernelTestBase.php @@ -1039,7 +1039,7 @@ private static function getModulesToEnable($class) { * * @see vendor/phpunit/phpunit/src/Util/PHP/Template/TestCaseMethod.tpl.dist */ - public function __sleep(): array { + public function __sleep() { return []; } diff --git a/core/tests/Drupal/Tests/BrowserTestBase.php b/core/tests/Drupal/Tests/BrowserTestBase.php index f27fa37a40bd439b5c0f4e48478b6f35a1f3bb0c..fc6173bfc143c06b00d43488cad8513ee2bd2622 100644 --- a/core/tests/Drupal/Tests/BrowserTestBase.php +++ b/core/tests/Drupal/Tests/BrowserTestBase.php @@ -603,7 +603,7 @@ public function installDrupal() { * * @see vendor/phpunit/phpunit/src/Util/PHP/Template/TestCaseMethod.tpl.dist */ - public function __sleep(): array { + public function __sleep() { return []; }