Skip to content

Commit 2ca75e9

Browse files
committed
fix(support): use key() instead of current() in valid()
Bug reproduction: ``` $arr = new ImmutableArray([true, false, true]); foreach ($arr as $value) { // Will only iterate once, stopping at the `false` value } ```
1 parent 65a1c01 commit 2ca75e9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/support/src/Arr/IsIterable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function key(): string|int|null
2424

2525
public function valid(): bool
2626
{
27-
return $this->current() !== false;
27+
return $this->key() !== null;
2828
}
2929

3030
public function rewind(): void

0 commit comments

Comments
 (0)