mirror of
https://github.com/retailcrm/graphql-php.git
synced 2024-11-24 13:56:04 +03:00
Merge pull request #475 from mll-lab/nodelist-offsets
Use foreach for iterating over NodeList
This commit is contained in:
commit
22e3b0e981
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user