From df724f991b1af4d87c8897af2922e0ba826371d5 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 2 Aug 2021 22:30:04 +0000 Subject: [PATCH] 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. git-svn-id: https://develop.svn.wordpress.org/trunk@51529 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/class-wp-theme.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/wp-includes/class-wp-theme.php b/src/wp-includes/class-wp-theme.php index a3c996e59f..d0607528b5 100644 --- a/src/wp-includes/class-wp-theme.php +++ b/src/wp-includes/class-wp-theme.php @@ -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':