Skip to content

Commit dc64a0c

Browse files
committed
Use ReturnTypeWillChange for PHP 7.4 compat
1 parent 27f28fe commit dc64a0c

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

src/wp-includes/rest-api/class-wp-rest-resolvable-route.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ public function __invoke() {
7474
* @param string $key The key to check.
7575
* @return bool True if the key exists, false otherwise.
7676
*/
77-
public function offsetExists( mixed $k ) : bool {
77+
#[ReturnTypeWillChange]
78+
public function offsetExists( mixed $k ) {
7879
$this->__invoke();
7980
return isset( $this->resolved[ $k ] );
8081
}
@@ -87,7 +88,8 @@ public function offsetExists( mixed $k ) : bool {
8788
* @param string $key The key to retrieve.
8889
* @return mixed The value of the key, or null if not set. Returns by reference, so it can be modified if needed.
8990
*/
90-
public function &offsetGet( mixed $k ) : mixed {
91+
#[ReturnTypeWillChange]
92+
public function &offsetGet( mixed $k ) {
9193
$this->__invoke();
9294
return $this->resolved[ $k ];
9395
}
@@ -100,7 +102,8 @@ public function &offsetGet( mixed $k ) : mixed {
100102
* @param string $key The key to set.
101103
* @param mixed $value The value to set.
102104
*/
103-
public function offsetSet( mixed $k, mixed $v ) : void {
105+
#[ReturnTypeWillChange]
106+
public function offsetSet( mixed $k, mixed $v ) {
104107
$this->__invoke();
105108
$this->resolved[ $k ] = $v;
106109
}
@@ -112,7 +115,8 @@ public function offsetSet( mixed $k, mixed $v ) : void {
112115
*
113116
* @param string $key The key to unset.
114117
*/
115-
public function offsetUnset( mixed $k ) : void {
118+
#[ReturnTypeWillChange]
119+
public function offsetUnset( mixed $k ) {
116120
$this->__invoke();
117121
unset( $this->resolved[ $k ] );
118122
}

src/wp-includes/rest-api/class-wp-rest-server.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -957,8 +957,9 @@ public function get_unresolved_routes( $route_namespace = '' ) {
957957
*
958958
* @param array $endpoints The available endpoints. An array of matching regex patterns, each mapped
959959
* to an array of callbacks for the endpoint. These take the format
960-
* `'/path/regex' => array( $callback, $bitmask )` or
961-
* `'/path/regex' => array( array( $callback, $bitmask ).
960+
* `'/path/regex' => array( $callback, $bitmask )`,
961+
* `'/path/regex' => array( array( $callback, $bitmask ), or
962+
* `'/path/regex' => object(WP_REST_Resolvable_Route)
962963
*/
963964
$endpoints = apply_filters( 'rest_endpoints', $endpoints );
964965

0 commit comments

Comments
 (0)