mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Code Modernization: Silence the deprecation warnings for missing return type in WP_REST_Request.
This fixes the "Deprecated: Return type of `WP_REST_Request::[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], [51529], [51530]. Props jrf. See #53635. git-svn-id: https://develop.svn.wordpress.org/trunk@51531 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -957,6 +957,7 @@ class WP_REST_Request implements ArrayAccess {
|
||||
* @param string $offset Parameter name.
|
||||
* @return bool Whether the parameter is set.
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetExists( $offset ) {
|
||||
$order = $this->get_parameter_order();
|
||||
|
||||
@@ -977,6 +978,7 @@ class WP_REST_Request implements ArrayAccess {
|
||||
* @param string $offset Parameter name.
|
||||
* @return mixed|null Value if set, null otherwise.
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetGet( $offset ) {
|
||||
return $this->get_param( $offset );
|
||||
}
|
||||
@@ -989,6 +991,7 @@ class WP_REST_Request implements ArrayAccess {
|
||||
* @param string $offset Parameter name.
|
||||
* @param mixed $value Parameter value.
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetSet( $offset, $value ) {
|
||||
$this->set_param( $offset, $value );
|
||||
}
|
||||
@@ -1000,6 +1003,7 @@ class WP_REST_Request implements ArrayAccess {
|
||||
*
|
||||
* @param string $offset Parameter name.
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetUnset( $offset ) {
|
||||
$order = $this->get_parameter_order();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user