Skip to content

PHP 8.1 deprecation: Return type of WP_CLI\Iterators\Query  #5806

@Soean

Description

@Soean

Bug Report

The Query iterator has a deprecation warning. We should add #[\ReturnTypeWillChange] like in #5743

PHP: 8.1.18
WP CLI: 2.8.1
WordPress 6.2.2

Command: wp site list

Error:

Deprecated: Return type of WP_CLI\Iterators\Query::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /wp-cli/wp-cli/php/WP_CLI/Iterators/Query.php on line 91
Deprecated: Return type of WP_CLI\Iterators\Query::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /wp-cli/wp-cli/php/WP_CLI/Iterators/Query.php on line 99
Deprecated: Return type of WP_CLI\Iterators\Query::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /wp-cli/wp-cli/php/WP_CLI/Iterators/Query.php on line 95
Deprecated: Return type of WP_CLI\Iterators\Query::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /wp-cli/wp-cli/php/WP_CLI/Iterators/Query.php on line 112
Deprecated: Return type of WP_CLI\Iterators\Query::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /wp-cli/wp-cli/php/WP_CLI/Iterators/Query.php on line 104

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions