diff --git a/src/Collection.php b/src/Collection.php index d740210..281b0f6 100644 --- a/src/Collection.php +++ b/src/Collection.php @@ -43,7 +43,7 @@ public function __construct(\Closure $valueValidator, array $initialValues = []) public function filter(\Closure $condition): Collection { $collection = new self($this->validator); - foreach ($this->values() as $offset => $value) + foreach ((array) $this as $offset => $value) if ($condition($value)) $collection->offsetSet($offset, $value); @@ -58,7 +58,7 @@ public function filter(\Closure $condition): Collection public function without(\Closure $condition): Collection { $collection = new self($this->validator); - foreach ($this->values() as $offset => $value) + foreach ((array) $this as $offset => $value) if (!$condition($value)) $collection->offsetSet($offset, $value);