Code Modernization: Silence the deprecation warnings for missing return type in `WP_Theme`.

This fixes the "Deprecated: Return type of `WP_Theme::[METHODNAME]($offset)` should be compatible with `ArrayAccess::[METHODNAME](): type`" warnings on PHP 8.1.

PHP native interfaces now have declared return types and methods in classes implementing these interfaces need to either have the return type declared (in a covariant compatible manner with the PHP native interface method declaration), or need to silence the deprecation warning using the `#[ReturnTypeWillChange]` attribute.

Follow-up to [51517].

Props jrf.
See #53635.
Built from https://develop.svn.wordpress.org/trunk@51529


git-svn-id: http://core.svn.wordpress.org/trunk@51140 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2021-08-02 22:31:56 +00:00
parent 9a4280c75f
commit 3c14324dc6
2 changed files with 5 additions and 1 deletions

View File

@ -556,6 +556,7 @@ final class WP_Theme implements ArrayAccess {
* @param mixed $offset
* @param mixed $value
*/
#[ReturnTypeWillChange]
public function offsetSet( $offset, $value ) {}
/**
@ -565,6 +566,7 @@ final class WP_Theme implements ArrayAccess {
*
* @param mixed $offset
*/
#[ReturnTypeWillChange]
public function offsetUnset( $offset ) {}
/**
@ -575,6 +577,7 @@ final class WP_Theme implements ArrayAccess {
* @param mixed $offset
* @return bool
*/
#[ReturnTypeWillChange]
public function offsetExists( $offset ) {
static $keys = array(
'Name',
@ -616,6 +619,7 @@ final class WP_Theme implements ArrayAccess {
* @param mixed $offset
* @return mixed
*/
#[ReturnTypeWillChange]
public function offsetGet( $offset ) {
switch ( $offset ) {
case 'Name':

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.9-alpha-51528';
$wp_version = '5.9-alpha-51529';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.