2020 * @package WordPress
2121 * @since 3.6.0
2222 */
23+
2324class Recursive_ArrayAccess implements ArrayAccess {
2425 /**
2526 * Internal data collection.
@@ -61,7 +62,8 @@ public function __clone() {
6162 *
6263 * @return array
6364 */
64- public function toArray () : array {
65+ #[\ReturnTypeWillChange]
66+ public function toArray () {
6567 $ data = $ this ->container ;
6668 foreach ( $ data as $ key => $ value ) {
6769 if ( $ value instanceof self ) {
@@ -83,7 +85,8 @@ public function toArray() : array {
8385 *
8486 * @return boolean true on success or false on failure.
8587 */
86- public function offsetExists ( $ offset ) : bool {
88+ #[\ReturnTypeWillChange]
89+ public function offsetExists ( $ offset ) {
8790 return isset ( $ this ->container [ $ offset ] );
8891 }
8992
@@ -96,7 +99,8 @@ public function offsetExists( $offset ) : bool {
9699 *
97100 * @return mixed Can return all value types.
98101 */
99- public function offsetGet ( $ offset ) : mixed {
102+ #[\ReturnTypeWillChange]
103+ public function offsetGet ( $ offset ) {
100104 return isset ( $ this ->container [ $ offset ] ) ? $ this ->container [ $ offset ] : null ;
101105 }
102106
@@ -110,7 +114,8 @@ public function offsetGet( $offset ) : mixed {
110114 *
111115 * @return void
112116 */
113- public function offsetSet ( $ offset , $ data ) : void {
117+ #[\ReturnTypeWillChange]
118+ public function offsetSet ( $ offset , $ data ) {
114119 if ( is_array ( $ data ) ) {
115120 $ data = new self ( $ data );
116121 }
@@ -131,7 +136,8 @@ public function offsetSet( $offset, $data ) : void {
131136 *
132137 * @return void
133138 */
134- public function offsetUnset ( $ offset ) : void {
139+ #[\ReturnTypeWillChange]
140+ public function offsetUnset ( $ offset ) {
135141 unset( $ this ->container [ $ offset ] );
136142 }
137143}
0 commit comments