diff --git a/src/Language/AST/NodeList.php b/src/Language/AST/NodeList.php index cede5a4..648f68a 100644 --- a/src/Language/AST/NodeList.php +++ b/src/Language/AST/NodeList.php @@ -114,9 +114,8 @@ class NodeList implements ArrayAccess, IteratorAggregate, Countable */ public function getIterator() { - $count = count($this->nodes); - for ($i = 0; $i < $count; $i++) { - yield $this->offsetGet($i); + foreach ($this->nodes as $key => $_) { + yield $this->offsetGet($key); } }