From ee5317aaf0d1613829a839542067bc4e52699643 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20Nork=C5=ABnas?= Date: Tue, 28 Apr 2026 08:54:31 +0300 Subject: [PATCH] Add types to Data ArrayAccess methods --- src/Contracts/Data.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/Contracts/Data.php b/src/Contracts/Data.php index 4c734f69..c595f0a7 100644 --- a/src/Contracts/Data.php +++ b/src/Contracts/Data.php @@ -6,29 +6,35 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate { + /** + * @var array + */ protected array $data = []; + /** + * @param array $data + */ public function __construct(array $data = []) { $this->data = $data; } - public function offsetSet($offset, $value): void + public function offsetSet(mixed $offset, mixed $value): void { $this->data[$offset] = $value; } - public function offsetExists($offset): bool + public function offsetExists(mixed $offset): bool { return isset($this->data[$offset]) || \array_key_exists($offset, $this->data); } - public function offsetUnset($offset): void + public function offsetUnset(mixed $offset): void { unset($this->data[$offset]); } - public function offsetGet($offset): mixed + public function offsetGet(mixed $offset): mixed { return $this->data[$offset] ?? null; }