Skip to content

Commit c88869a

Browse files
committed
Fix array null access
1 parent d2d10ea commit c88869a

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

packages/scalars/src/Concern/ArrayAccessTrait.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,13 @@ public function first(?callable $conditions = null): mixed
3232
return null;
3333
}
3434

35-
return $this->storage[array_key_first($this->storage)] ?? null;
35+
$key = array_key_first($this->storage);
36+
37+
if ($key === null) {
38+
return null;
39+
}
40+
41+
return $this->storage[$key] ?? null;
3642
}
3743

3844
/**

0 commit comments

Comments
 (0)