77use ArrayIterator ;
88
99/**
10- * ArrayAccessTrait provides the implementation for {@see \IteratorAggregate}, {@see \ArrayAccess}
10+ * ` ArrayAccessTrait` provides the implementation for {@see \IteratorAggregate}, {@see \ArrayAccess}
1111 * and {@see \Countable}.
1212 *
13- * Note that ArrayAccessTrait requires the class using it contain a property named `data` which should be an array.
14- * The data will be exposed by ArrayAccessTrait to support accessing the class object like an array.
13+ * Note that ` ArrayAccessTrait` requires the class using it contain a property named `data` which should be an array.
14+ * The data will be exposed by ` ArrayAccessTrait` to support accessing the class object like an array.
1515 *
1616 * @property array $data
1717 */
@@ -44,10 +44,8 @@ public function count(): int
4444 * This method is required by the interface {@see \ArrayAccess}.
4545 *
4646 * @param mixed $offset The offset to check on.
47- *
48- * @return bool
4947 */
50- public function offsetExists ($ offset ): bool
48+ public function offsetExists (mixed $ offset ): bool
5149 {
5250 return isset ($ this ->data [$ offset ]);
5351 }
@@ -59,8 +57,7 @@ public function offsetExists($offset): bool
5957 *
6058 * @return mixed The element at the offset, null if no element is found at the offset.
6159 */
62- #[\ReturnTypeWillChange]
63- public function offsetGet ($ offset )
60+ public function offsetGet (mixed $ offset ): mixed
6461 {
6562 return $ this ->data [$ offset ] ?? null ;
6663 }
@@ -71,7 +68,7 @@ public function offsetGet($offset)
7168 * @param mixed $offset The offset to set element.
7269 * @param mixed $value The element value.
7370 */
74- public function offsetSet ($ offset , $ value ): void
71+ public function offsetSet (mixed $ offset , mixed $ value ): void
7572 {
7673 if ($ offset === null ) {
7774 $ this ->data [] = $ value ;
@@ -85,7 +82,7 @@ public function offsetSet($offset, $value): void
8582 *
8683 * @param mixed $offset The offset to unset element.
8784 */
88- public function offsetUnset ($ offset ): void
85+ public function offsetUnset (mixed $ offset ): void
8986 {
9087 unset($ this ->data [$ offset ]);
9188 }
0 commit comments