Revert "Issue #3425337 by mondrake: Fix root namespace classes DebugClassLoader forward compatibility warnings"

This reverts commit ff7c5de35f.
merge-requests/6822/merge
catch 2024-03-04 15:51:46 +00:00
parent ff7c5de35f
commit 03b8070a99
26 changed files with 214 additions and 106 deletions

View File

@ -19,6 +19,10 @@
%Method "Twig\\TokenParser\\TokenParserInterface::[^"]+" might add "[^"]+" as a native return type declaration in the future. Do the same in (child class|implementation) "[^"]+" now to avoid errors or add an explicit @return annotation to suppress this message%
%Method "WebDriver\\Service\\CurlServiceInterface::[^"]+" might add "[^"]+" as a native return type declaration in the future. Do the same in implementation "[^"]+" now to avoid errors or add an explicit @return annotation to suppress this message%
# Skip root namespace native DebugClassLoader forward compatibility warnings.
# These mostly refer to PHP native classes, could be fixed for PHP 8.1.
%Method "[^\\]+::\w+\(\)" might add "[^"]+" as a native return type declaration in the future. Do the same in (child class|implementation) "[^"]+" now to avoid errors or add an explicit @return annotation to suppress this message%
# The following deprecation is listed for Twig 2 compatibility when unit
# testing using \Symfony\Component\ErrorHandler\DebugClassLoader.
%The "Twig\\Environment::getTemplateClass\(\)" method is considered internal\. It may change without further notice\. You should not extend it from "Drupal\\Core\\Template\\TwigEnvironment"\.%

View File

@ -47,7 +47,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function getName(): string
#[\ReturnTypeWillChange]
public function getName()
{
return $this->staticReflectionParser->getClassName();
}
@ -55,7 +56,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function getDocComment(): string|FALSE
#[\ReturnTypeWillChange]
public function getDocComment()
{
return $this->staticReflectionParser->getDocComment();
}
@ -63,7 +65,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function getNamespaceName(): string
#[\ReturnTypeWillChange]
public function getNamespaceName()
{
return $this->staticReflectionParser->getNamespaceName();
}
@ -91,7 +94,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function getMethod($name): \ReflectionMethod
#[\ReturnTypeWillChange]
public function getMethod($name)
{
throw new ReflectionException('Method not implemented');
}
@ -99,7 +103,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function getProperty($name): \ReflectionProperty
#[\ReturnTypeWillChange]
public function getProperty($name)
{
throw new ReflectionException('Method not implemented');
}
@ -115,7 +120,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function getConstant($name): mixed
#[\ReturnTypeWillChange]
public function getConstant($name)
{
throw new ReflectionException('Method not implemented');
}
@ -123,7 +129,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function getConstructor(): ?\ReflectionMethod
#[\ReturnTypeWillChange]
public function getConstructor()
{
throw new ReflectionException('Method not implemented');
}
@ -131,7 +138,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function getDefaultProperties(): array
#[\ReturnTypeWillChange]
public function getDefaultProperties()
{
throw new ReflectionException('Method not implemented');
}
@ -139,7 +147,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function getEndLine(): int|FALSE
#[\ReturnTypeWillChange]
public function getEndLine()
{
throw new ReflectionException('Method not implemented');
}
@ -147,7 +156,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function getExtension(): ?\ReflectionExtension
#[\ReturnTypeWillChange]
public function getExtension()
{
throw new ReflectionException('Method not implemented');
}
@ -155,7 +165,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function getExtensionName(): string|FALSE
#[\ReturnTypeWillChange]
public function getExtensionName()
{
throw new ReflectionException('Method not implemented');
}
@ -163,7 +174,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function getFileName(): string|FALSE
#[\ReturnTypeWillChange]
public function getFileName()
{
throw new ReflectionException('Method not implemented');
}
@ -171,7 +183,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function getInterfaceNames(): array
#[\ReturnTypeWillChange]
public function getInterfaceNames()
{
throw new ReflectionException('Method not implemented');
}
@ -179,7 +192,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function getInterfaces(): array
#[\ReturnTypeWillChange]
public function getInterfaces()
{
throw new ReflectionException('Method not implemented');
}
@ -187,7 +201,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function getMethods($filter = null): array
#[\ReturnTypeWillChange]
public function getMethods($filter = null)
{
throw new ReflectionException('Method not implemented');
}
@ -195,7 +210,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function getModifiers(): int
#[\ReturnTypeWillChange]
public function getModifiers()
{
throw new ReflectionException('Method not implemented');
}
@ -203,7 +219,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function getParentClass(): \ReflectionClass|FALSE
#[\ReturnTypeWillChange]
public function getParentClass()
{
throw new ReflectionException('Method not implemented');
}
@ -211,7 +228,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function getProperties($filter = null): array
#[\ReturnTypeWillChange]
public function getProperties($filter = null)
{
throw new ReflectionException('Method not implemented');
}
@ -219,7 +237,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function getShortName(): string
#[\ReturnTypeWillChange]
public function getShortName()
{
throw new ReflectionException('Method not implemented');
}
@ -227,7 +246,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function getStartLine(): int|FALSE
#[\ReturnTypeWillChange]
public function getStartLine()
{
throw new ReflectionException('Method not implemented');
}
@ -235,7 +255,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function getStaticProperties(): ?array
#[\ReturnTypeWillChange]
public function getStaticProperties()
{
throw new ReflectionException('Method not implemented');
}
@ -243,7 +264,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function getStaticPropertyValue($name, $default = ''): mixed
#[\ReturnTypeWillChange]
public function getStaticPropertyValue($name, $default = '')
{
throw new ReflectionException('Method not implemented');
}
@ -251,7 +273,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function getTraitAliases(): array
#[\ReturnTypeWillChange]
public function getTraitAliases()
{
throw new ReflectionException('Method not implemented');
}
@ -259,7 +282,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function getTraitNames(): array
#[\ReturnTypeWillChange]
public function getTraitNames()
{
throw new ReflectionException('Method not implemented');
}
@ -267,7 +291,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function getTraits(): array
#[\ReturnTypeWillChange]
public function getTraits()
{
throw new ReflectionException('Method not implemented');
}
@ -275,7 +300,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function hasConstant($name): bool
#[\ReturnTypeWillChange]
public function hasConstant($name)
{
throw new ReflectionException('Method not implemented');
}
@ -283,7 +309,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function hasMethod($name): bool
#[\ReturnTypeWillChange]
public function hasMethod($name)
{
throw new ReflectionException('Method not implemented');
}
@ -291,7 +318,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function hasProperty($name): bool
#[\ReturnTypeWillChange]
public function hasProperty($name)
{
throw new ReflectionException('Method not implemented');
}
@ -299,7 +327,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function implementsInterface($interface): bool
#[\ReturnTypeWillChange]
public function implementsInterface($interface)
{
throw new ReflectionException('Method not implemented');
}
@ -307,7 +336,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function inNamespace(): bool
#[\ReturnTypeWillChange]
public function inNamespace()
{
throw new ReflectionException('Method not implemented');
}
@ -315,7 +345,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function isAbstract(): bool
#[\ReturnTypeWillChange]
public function isAbstract()
{
throw new ReflectionException('Method not implemented');
}
@ -323,7 +354,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function isCloneable(): bool
#[\ReturnTypeWillChange]
public function isCloneable()
{
throw new ReflectionException('Method not implemented');
}
@ -331,7 +363,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function isFinal(): bool
#[\ReturnTypeWillChange]
public function isFinal()
{
throw new ReflectionException('Method not implemented');
}
@ -339,7 +372,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function isInstance($object): bool
#[\ReturnTypeWillChange]
public function isInstance($object)
{
throw new ReflectionException('Method not implemented');
}
@ -347,7 +381,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function isInstantiable(): bool
#[\ReturnTypeWillChange]
public function isInstantiable()
{
throw new ReflectionException('Method not implemented');
}
@ -355,7 +390,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function isInterface(): bool
#[\ReturnTypeWillChange]
public function isInterface()
{
throw new ReflectionException('Method not implemented');
}
@ -363,7 +399,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function isInternal(): bool
#[\ReturnTypeWillChange]
public function isInternal()
{
throw new ReflectionException('Method not implemented');
}
@ -371,7 +408,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function isIterateable(): bool
#[\ReturnTypeWillChange]
public function isIterateable()
{
throw new ReflectionException('Method not implemented');
}
@ -379,7 +417,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function isSubclassOf($class): bool
#[\ReturnTypeWillChange]
public function isSubclassOf($class)
{
throw new ReflectionException('Method not implemented');
}
@ -387,7 +426,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function isTrait(): bool
#[\ReturnTypeWillChange]
public function isTrait()
{
throw new ReflectionException('Method not implemented');
}
@ -395,7 +435,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function isUserDefined(): bool
#[\ReturnTypeWillChange]
public function isUserDefined()
{
throw new ReflectionException('Method not implemented');
}
@ -403,7 +444,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function newInstanceArgs(array $args = []): ?object
#[\ReturnTypeWillChange]
public function newInstanceArgs(array $args = [])
{
throw new ReflectionException('Method not implemented');
}
@ -411,7 +453,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function newInstanceWithoutConstructor(): object
#[\ReturnTypeWillChange]
public function newInstanceWithoutConstructor()
{
throw new ReflectionException('Method not implemented');
}
@ -419,7 +462,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function setStaticPropertyValue($name, $value): void
#[\ReturnTypeWillChange]
public function setStaticPropertyValue($name, $value)
{
throw new ReflectionException('Method not implemented');
}
@ -427,7 +471,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function getConstants(?int $filter = null): array
#[\ReturnTypeWillChange]
public function getConstants(?int $filter = null)
{
throw new ReflectionException('Method not implemented');
}
@ -435,7 +480,8 @@ class StaticReflectionClass extends ReflectionClass
/**
* {@inheritDoc}
*/
public function newInstance(mixed ...$args): object
#[\ReturnTypeWillChange]
public function newInstance(mixed ...$args)
{
throw new ReflectionException('Method not implemented');
}

View File

@ -23,7 +23,8 @@ class RegexDirectoryIterator extends \RegexIterator {
/**
* Implements \RegexIterator::accept().
*/
public function accept(): bool {
#[\ReturnTypeWillChange]
public function accept() {
/** @var \SplFileInfo $file_info */
$file_info = $this->getInnerIterator()->current();
return $file_info->isFile() && preg_match($this->getRegex(), $file_info->getFilename());

View File

@ -142,7 +142,8 @@ abstract class LazyPluginCollection implements \IteratorAggregate, \Countable {
$this->remove($instance_id);
}
public function getIterator(): \ArrayIterator {
#[\ReturnTypeWillChange]
public function getIterator() {
$instances = [];
foreach ($this->getInstanceIds() as $instance_id) {
$instances[$instance_id] = $this->get($instance_id);
@ -153,7 +154,8 @@ abstract class LazyPluginCollection implements \IteratorAggregate, \Countable {
/**
* {@inheritdoc}
*/
public function count(): int {
#[\ReturnTypeWillChange]
public function count() {
return count($this->instanceIds);
}

View File

@ -41,14 +41,16 @@ class HtmlEscapedText implements MarkupInterface, \Countable {
/**
* {@inheritdoc}
*/
public function count(): int {
#[\ReturnTypeWillChange]
public function count() {
return mb_strlen($this->string);
}
/**
* {@inheritdoc}
*/
public function jsonSerialize(): string {
#[\ReturnTypeWillChange]
public function jsonSerialize() {
return $this->__toString();
}

View File

@ -114,7 +114,8 @@ abstract class ArrayElement extends Element implements \IteratorAggregate, Typed
/**
* {@inheritdoc}
*/
public function getIterator(): \ArrayIterator {
#[\ReturnTypeWillChange]
public function getIterator() {
return new \ArrayIterator($this->getElements());
}

View File

@ -90,7 +90,8 @@ class Condition implements ConditionInterface, \Countable {
* size of its conditional array minus one, because one element is the
* conjunction.
*/
public function count(): int {
#[\ReturnTypeWillChange]
public function count() {
return count($this->conditions) - 1;
}

View File

@ -179,7 +179,8 @@ trait InsertTrait {
/**
* {@inheritdoc}
*/
public function count(): int {
#[\ReturnTypeWillChange]
public function count() {
return count($this->insertValues);
}

View File

@ -687,7 +687,8 @@ abstract class ContentEntityBase extends EntityBase implements \IteratorAggregat
/**
* {@inheritdoc}
*/
public function getIterator(): \ArrayIterator {
#[\ReturnTypeWillChange]
public function getIterator() {
return new \ArrayIterator($this->getFields());
}

View File

@ -69,7 +69,8 @@ class ConfigEntityAdapter extends EntityAdapter {
/**
* {@inheritdoc}
*/
public function getIterator(): \ArrayIterator {
#[\ReturnTypeWillChange]
public function getIterator() {
if (isset($this->entity)) {
return $this->getConfigTypedData()->getIterator();
}

View File

@ -162,7 +162,8 @@ class EntityAdapter extends TypedData implements \IteratorAggregate, ComplexData
/**
* {@inheritdoc}
*/
public function getIterator(): \ArrayIterator {
#[\ReturnTypeWillChange]
public function getIterator() {
return $this->entity instanceof \IteratorAggregate ? $this->entity->getIterator() : new \ArrayIterator([]);
}

View File

@ -58,14 +58,16 @@ class GeneratedLink extends BubbleableMetadata implements MarkupInterface, \Coun
/**
* {@inheritdoc}
*/
public function jsonSerialize(): string {
#[\ReturnTypeWillChange]
public function jsonSerialize() {
return $this->__toString();
}
/**
* {@inheritdoc}
*/
public function count(): int {
#[\ReturnTypeWillChange]
public function count() {
return mb_strlen($this->__toString());
}

View File

@ -43,35 +43,40 @@ class WriteSafeSessionHandler implements \SessionHandlerInterface, WriteSafeSess
/**
* {@inheritdoc}
*/
public function close(): bool {
#[\ReturnTypeWillChange]
public function close() {
return $this->wrappedSessionHandler->close();
}
/**
* {@inheritdoc}
*/
public function destroy($session_id): bool {
#[\ReturnTypeWillChange]
public function destroy($session_id) {
return $this->wrappedSessionHandler->destroy($session_id);
}
/**
* {@inheritdoc}
*/
public function gc($max_lifetime): int|FALSE {
#[\ReturnTypeWillChange]
public function gc($max_lifetime) {
return $this->wrappedSessionHandler->gc($max_lifetime);
}
/**
* {@inheritdoc}
*/
public function open($save_path, $session_id): bool {
#[\ReturnTypeWillChange]
public function open($save_path, $session_id) {
return $this->wrappedSessionHandler->open($save_path, $session_id);
}
/**
* {@inheritdoc}
*/
public function read($session_id): string|FALSE {
#[\ReturnTypeWillChange]
public function read($session_id) {
$value = $this->wrappedSessionHandler->read($session_id);
$this->readSessions[$session_id] = $value;
return $value;
@ -80,7 +85,8 @@ class WriteSafeSessionHandler implements \SessionHandlerInterface, WriteSafeSess
/**
* {@inheritdoc}
*/
public function write($session_id, $session_data): bool {
#[\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) {
return TRUE;

View File

@ -90,17 +90,18 @@ class Attribute implements \ArrayAccess, \IteratorAggregate, MarkupInterface {
/**
* {@inheritdoc}
*/
public function offsetGet($name): mixed {
#[\ReturnTypeWillChange]
public function offsetGet($name) {
if (isset($this->storage[$name])) {
return $this->storage[$name];
}
return NULL;
}
/**
* {@inheritdoc}
*/
public function offsetSet($name, $value): void {
#[\ReturnTypeWillChange]
public function offsetSet($name, $value) {
$this->storage[$name] = $this->createAttributeValue($name, $value);
}
@ -153,14 +154,16 @@ class Attribute implements \ArrayAccess, \IteratorAggregate, MarkupInterface {
/**
* {@inheritdoc}
*/
public function offsetUnset($name): void {
#[\ReturnTypeWillChange]
public function offsetUnset($name) {
unset($this->storage[$name]);
}
/**
* {@inheritdoc}
*/
public function offsetExists($name): bool {
#[\ReturnTypeWillChange]
public function offsetExists($name) {
return isset($this->storage[$name]);
}
@ -355,7 +358,8 @@ class Attribute implements \ArrayAccess, \IteratorAggregate, MarkupInterface {
/**
* {@inheritdoc}
*/
public function getIterator(): \ArrayIterator {
#[\ReturnTypeWillChange]
public function getIterator() {
return new \ArrayIterator($this->storage);
}
@ -372,7 +376,8 @@ class Attribute implements \ArrayAccess, \IteratorAggregate, MarkupInterface {
* @return string
* The safe string content.
*/
public function jsonSerialize(): string {
#[\ReturnTypeWillChange]
public function jsonSerialize() {
return (string) $this;
}

View File

@ -35,14 +35,16 @@ class AttributeArray extends AttributeValueBase implements \ArrayAccess, \Iterat
/**
* {@inheritdoc}
*/
public function offsetGet($offset): mixed {
#[\ReturnTypeWillChange]
public function offsetGet($offset) {
return $this->value[$offset];
}
/**
* {@inheritdoc}
*/
public function offsetSet($offset, $value): void {
#[\ReturnTypeWillChange]
public function offsetSet($offset, $value) {
if (isset($offset)) {
$this->value[$offset] = $value;
}
@ -54,14 +56,16 @@ class AttributeArray extends AttributeValueBase implements \ArrayAccess, \Iterat
/**
* {@inheritdoc}
*/
public function offsetUnset($offset): void {
#[\ReturnTypeWillChange]
public function offsetUnset($offset) {
unset($this->value[$offset]);
}
/**
* {@inheritdoc}
*/
public function offsetExists($offset): bool {
#[\ReturnTypeWillChange]
public function offsetExists($offset) {
return isset($this->value[$offset]);
}
@ -77,7 +81,8 @@ class AttributeArray extends AttributeValueBase implements \ArrayAccess, \Iterat
/**
* {@inheritdoc}
*/
public function getIterator(): \ArrayIterator {
#[\ReturnTypeWillChange]
public function getIterator() {
return new \ArrayIterator($this->value);
}

View File

@ -118,7 +118,8 @@ trait ComputedItemListTrait {
/**
* {@inheritdoc}
*/
public function offsetExists($offset): bool {
#[\ReturnTypeWillChange]
public function offsetExists($offset) {
$this->ensureComputedValue();
return parent::offsetExists($offset);
}
@ -126,7 +127,8 @@ trait ComputedItemListTrait {
/**
* {@inheritdoc}
*/
public function getIterator(): \ArrayIterator {
#[\ReturnTypeWillChange]
public function getIterator() {
$this->ensureComputedValue();
return parent::getIterator();
}
@ -134,7 +136,8 @@ trait ComputedItemListTrait {
/**
* {@inheritdoc}
*/
public function count(): int {
#[\ReturnTypeWillChange]
public function count() {
$this->ensureComputedValue();
return parent::count();
}

View File

@ -314,7 +314,8 @@ class DataDefinition implements DataDefinitionInterface, \ArrayAccess {
* This is for BC support only.
* @todo: Remove in https://www.drupal.org/node/1928868.
*/
public function offsetExists($offset): bool {
#[\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.
return array_key_exists($offset, $this->definition) && isset($this->definition[$offset]);
@ -326,7 +327,8 @@ class DataDefinition implements DataDefinitionInterface, \ArrayAccess {
* This is for BC support only.
* @todo: Remove in https://www.drupal.org/node/1928868.
*/
public function &offsetGet($offset): mixed {
#[\ReturnTypeWillChange]
public function &offsetGet($offset) {
if (!isset($this->definition[$offset])) {
$this->definition[$offset] = NULL;
}
@ -339,7 +341,8 @@ class DataDefinition implements DataDefinitionInterface, \ArrayAccess {
* This is for BC support only.
* @todo: Remove in https://www.drupal.org/node/1928868.
*/
public function offsetSet($offset, $value): void {
#[\ReturnTypeWillChange]
public function offsetSet($offset, $value) {
$this->definition[$offset] = $value;
}
@ -349,7 +352,8 @@ class DataDefinition implements DataDefinitionInterface, \ArrayAccess {
* This is for BC support only.
* @todo: Remove in https://www.drupal.org/node/1928868.
*/
public function offsetUnset($offset): void {
#[\ReturnTypeWillChange]
public function offsetUnset($offset) {
unset($this->definition[$offset]);
}

View File

@ -170,7 +170,8 @@ class ItemList extends TypedData implements \IteratorAggregate, ListInterface {
/**
* {@inheritdoc}
*/
public function offsetExists($offset): bool {
#[\ReturnTypeWillChange]
public function offsetExists($offset) {
// We do not want to throw exceptions here, so we do not use get().
return isset($this->list[$offset]);
}
@ -178,21 +179,24 @@ class ItemList extends TypedData implements \IteratorAggregate, ListInterface {
/**
* {@inheritdoc}
*/
public function offsetUnset($offset): void {
#[\ReturnTypeWillChange]
public function offsetUnset($offset) {
$this->removeItem($offset);
}
/**
* {@inheritdoc}
*/
public function offsetGet($offset): mixed {
#[\ReturnTypeWillChange]
public function offsetGet($offset) {
return $this->get($offset);
}
/**
* {@inheritdoc}
*/
public function offsetSet($offset, $value): void {
#[\ReturnTypeWillChange]
public function offsetSet($offset, $value) {
if (!isset($offset)) {
// The [] operator has been used.
$this->appendItem($value);
@ -231,14 +235,16 @@ class ItemList extends TypedData implements \IteratorAggregate, ListInterface {
/**
* {@inheritdoc}
*/
public function getIterator(): \ArrayIterator {
#[\ReturnTypeWillChange]
public function getIterator() {
return new \ArrayIterator($this->list);
}
/**
* {@inheritdoc}
*/
public function count(): int {
#[\ReturnTypeWillChange]
public function count() {
return count($this->list);
}

View File

@ -183,7 +183,8 @@ class Map extends TypedData implements \IteratorAggregate, ComplexDataInterface
/**
* {@inheritdoc}
*/
public function getIterator(): \ArrayIterator {
#[\ReturnTypeWillChange]
public function getIterator() {
return new \ArrayIterator($this->getProperties());
}

View File

@ -30,7 +30,8 @@ class CommentFieldItemList extends FieldItemList {
/**
* {@inheritdoc}
*/
public function offsetExists($offset): bool {
#[\ReturnTypeWillChange]
public function offsetExists($offset) {
// For consistency with what happens in get(), we force offsetExists() to
// be TRUE for delta 0.
if ($offset === 0) {

View File

@ -38,7 +38,8 @@ abstract class SectionStorageBase extends PluginBase implements SectionStorageIn
/**
* {@inheritdoc}
*/
public function count(): int {
#[\ReturnTypeWillChange]
public function count() {
return $this->getSectionList()->count();
}

View File

@ -25,7 +25,8 @@ trait SectionListTrait {
/**
* {@inheritdoc}
*/
public function count(): int {
#[\ReturnTypeWillChange]
public function count() {
if ($this->hasBlankSection()) {
return 0;
}

View File

@ -913,7 +913,8 @@ class Sql extends PluginBase implements MigrateIdMapInterface, ContainerFactoryP
*
* This is called before beginning a foreach loop.
*/
public function rewind(): void {
#[\ReturnTypeWillChange]
public function rewind() {
$this->currentRow = NULL;
$fields = [];
foreach ($this->sourceIdFields() as $field) {
@ -934,7 +935,8 @@ class Sql extends PluginBase implements MigrateIdMapInterface, ContainerFactoryP
*
* This is called when entering a loop iteration, returning the current row.
*/
public function current(): mixed {
#[\ReturnTypeWillChange]
public function current() {
return $this->currentRow;
}
@ -945,7 +947,8 @@ class Sql extends PluginBase implements MigrateIdMapInterface, ContainerFactoryP
* current row. It must be a scalar - we will serialize to fulfill the
* requirement, but using getCurrentKey() is preferable.
*/
public function key(): mixed {
#[\ReturnTypeWillChange]
public function key() {
return serialize($this->currentKey);
}
@ -989,7 +992,8 @@ class Sql extends PluginBase implements MigrateIdMapInterface, ContainerFactoryP
* This is called at the bottom of the loop implicitly, as well as explicitly
* from rewind().
*/
public function next(): void {
#[\ReturnTypeWillChange]
public function next() {
$this->currentRow = $this->result->fetchAssoc();
$this->currentKey = [];
if ($this->currentRow) {
@ -1007,7 +1011,8 @@ class Sql extends PluginBase implements MigrateIdMapInterface, ContainerFactoryP
* This is called at the top of the loop, returning TRUE to process the loop
* and FALSE to terminate it.
*/
public function valid(): bool {
#[\ReturnTypeWillChange]
public function valid() {
return $this->currentRow !== FALSE;
}

View File

@ -343,7 +343,8 @@ abstract class SourcePluginBase extends PluginBase implements MigrateSourceInter
/**
* {@inheritdoc}
*/
public function current(): mixed {
#[\ReturnTypeWillChange]
public function current() {
return $this->currentRow;
}
@ -355,7 +356,8 @@ abstract class SourcePluginBase extends PluginBase implements MigrateSourceInter
* serialize to fulfill the requirement, but using getCurrentIds() is
* preferable.
*/
public function key(): mixed {
#[\ReturnTypeWillChange]
public function key() {
return serialize($this->currentSourceIds);
}
@ -365,7 +367,8 @@ abstract class SourcePluginBase extends PluginBase implements MigrateSourceInter
* Implementation of \Iterator::valid() - called at the top of the loop,
* returning TRUE to process the loop and FALSE to terminate it.
*/
public function valid(): bool {
#[\ReturnTypeWillChange]
public function valid() {
return isset($this->currentRow);
}
@ -376,7 +379,8 @@ abstract class SourcePluginBase extends PluginBase implements MigrateSourceInter
* should implement initializeIterator() to do any class-specific setup for
* iterating source records.
*/
public function rewind(): void {
#[\ReturnTypeWillChange]
public function rewind() {
$this->getIterator()->rewind();
$this->next();
}
@ -384,7 +388,8 @@ abstract class SourcePluginBase extends PluginBase implements MigrateSourceInter
/**
* {@inheritdoc}
*/
public function next(): void {
#[\ReturnTypeWillChange]
public function next() {
$this->currentSourceIds = NULL;
$this->currentRow = NULL;

View File

@ -448,7 +448,8 @@ class MigrateExecutableTest extends MigrateTestCase {
->onlyMethods(get_class_methods($class))
->getMockForAbstractClass();
$source->expects($this->once())
->method('rewind');
->method('rewind')
->willReturn(TRUE);
$source->expects($this->any())
->method('initializeIterator')
->willReturn([]);

View File

@ -11,7 +11,8 @@ class StreamCapturer extends \php_user_filter {
public static $cache = '';
public function filter($in, $out, &$consumed, $closing): int {
#[\ReturnTypeWillChange]
public function filter($in, $out, &$consumed, $closing) {
while ($bucket = stream_bucket_make_writeable($in)) {
self::$cache .= $bucket->data;
// cSpell:disable-next-line