Changes
This commit is contained in:
@@ -26,13 +26,11 @@ class Collection implements \Countable, \IteratorAggregate, \ArrayAccess
|
||||
}
|
||||
|
||||
// https://www.php.net/manual/en/class.iteratoraggregate.php
|
||||
public function getIterator()
|
||||
public function getIterator(): \Generator
|
||||
{
|
||||
return (function () {
|
||||
while (list($key, $val) = each($this->items)) {
|
||||
yield $key => $val;
|
||||
}
|
||||
})();
|
||||
foreach ($this->items as $key => $val) {
|
||||
yield $key => $val;
|
||||
}
|
||||
}
|
||||
|
||||
// https://www.php.net/manual/en/class.arrayaccess.php
|
||||
@@ -120,7 +118,7 @@ class Collection implements \Countable, \IteratorAggregate, \ArrayAccess
|
||||
}
|
||||
}
|
||||
|
||||
return $this->items;
|
||||
return $this;
|
||||
}
|
||||
|
||||
function first()
|
||||
|
||||
Reference in New Issue
Block a user