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

merge-requests/5987/head^2
Dave Long 2024-03-04 16:56:35 +00:00
parent 03b8070a99
commit ea9cc7538b
No known key found for this signature in database
GPG Key ID: ED52AE211E142771
27 changed files with 107 additions and 216 deletions

View File

@ -115,8 +115,7 @@ class ScaffoldFileCollection implements \IteratorAggregate {
/**
* {@inheritdoc}
*/
#[\ReturnTypeWillChange]
public function getIterator() {
public function getIterator(): \ArrayIterator {
return new \ArrayIterator($this->scaffoldFilesByProject);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -43,40 +43,35 @@ class WriteSafeSessionHandler implements \SessionHandlerInterface, WriteSafeSess
/**
* {@inheritdoc}
*/
#[\ReturnTypeWillChange]
public function close() {
public function close(): bool {
return $this->wrappedSessionHandler->close();
}
/**
* {@inheritdoc}
*/
#[\ReturnTypeWillChange]
public function destroy($session_id) {
public function destroy($session_id): bool {
return $this->wrappedSessionHandler->destroy($session_id);
}
/**
* {@inheritdoc}
*/
#[\ReturnTypeWillChange]
public function gc($max_lifetime) {
public function gc($max_lifetime): int|FALSE {
return $this->wrappedSessionHandler->gc($max_lifetime);
}
/**
* {@inheritdoc}
*/
#[\ReturnTypeWillChange]
public function open($save_path, $session_id) {
public function open($save_path, $session_id): bool {
return $this->wrappedSessionHandler->open($save_path, $session_id);
}
/**
* {@inheritdoc}
*/
#[\ReturnTypeWillChange]
public function read($session_id) {
public function read($session_id): string|FALSE {
$value = $this->wrappedSessionHandler->read($session_id);
$this->readSessions[$session_id] = $value;
return $value;
@ -85,8 +80,7 @@ class WriteSafeSessionHandler implements \SessionHandlerInterface, WriteSafeSess
/**
* {@inheritdoc}
*/
#[\ReturnTypeWillChange]
public function write($session_id, $session_data) {
public function write($session_id, $session_data): bool {
// 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,18 +90,17 @@ class Attribute implements \ArrayAccess, \IteratorAggregate, MarkupInterface {
/**
* {@inheritdoc}
*/
#[\ReturnTypeWillChange]
public function offsetGet($name) {
public function offsetGet($name): mixed {
if (isset($this->storage[$name])) {
return $this->storage[$name];
}
return NULL;
}
/**
* {@inheritdoc}
*/
#[\ReturnTypeWillChange]
public function offsetSet($name, $value) {
public function offsetSet($name, $value): void {
$this->storage[$name] = $this->createAttributeValue($name, $value);
}
@ -154,16 +153,14 @@ class Attribute implements \ArrayAccess, \IteratorAggregate, MarkupInterface {
/**
* {@inheritdoc}
*/
#[\ReturnTypeWillChange]
public function offsetUnset($name) {
public function offsetUnset($name): void {
unset($this->storage[$name]);
}
/**
* {@inheritdoc}
*/
#[\ReturnTypeWillChange]
public function offsetExists($name) {
public function offsetExists($name): bool {
return isset($this->storage[$name]);
}
@ -358,8 +355,7 @@ class Attribute implements \ArrayAccess, \IteratorAggregate, MarkupInterface {
/**
* {@inheritdoc}
*/
#[\ReturnTypeWillChange]
public function getIterator() {
public function getIterator(): \ArrayIterator {
return new \ArrayIterator($this->storage);
}
@ -376,8 +372,7 @@ class Attribute implements \ArrayAccess, \IteratorAggregate, MarkupInterface {
* @return string
* The safe string content.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize() {
public function jsonSerialize(): string {
return (string) $this;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -913,8 +913,7 @@ class Sql extends PluginBase implements MigrateIdMapInterface, ContainerFactoryP
*
* This is called before beginning a foreach loop.
*/
#[\ReturnTypeWillChange]
public function rewind() {
public function rewind(): void {
$this->currentRow = NULL;
$fields = [];
foreach ($this->sourceIdFields() as $field) {
@ -935,8 +934,7 @@ class Sql extends PluginBase implements MigrateIdMapInterface, ContainerFactoryP
*
* This is called when entering a loop iteration, returning the current row.
*/
#[\ReturnTypeWillChange]
public function current() {
public function current(): mixed {
return $this->currentRow;
}
@ -947,8 +945,7 @@ 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.
*/
#[\ReturnTypeWillChange]
public function key() {
public function key(): mixed {
return serialize($this->currentKey);
}
@ -992,8 +989,7 @@ class Sql extends PluginBase implements MigrateIdMapInterface, ContainerFactoryP
* This is called at the bottom of the loop implicitly, as well as explicitly
* from rewind().
*/
#[\ReturnTypeWillChange]
public function next() {
public function next(): void {
$this->currentRow = $this->result->fetchAssoc();
$this->currentKey = [];
if ($this->currentRow) {
@ -1011,8 +1007,7 @@ 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.
*/
#[\ReturnTypeWillChange]
public function valid() {
public function valid(): bool {
return $this->currentRow !== FALSE;
}

View File

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

View File

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

View File

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