src/Collection.php
public function filter(callable $condition)
    {
        $items = [];

        foreach ($this->items as $item) {
            if ($condition($item)) {
                $items[] = $item;
            }
        }

        $col = new static($this->type);
        $col->setItemsFromTrustedSource($items);

        return $col;
    }
public function filter(callable $condition)
    {
        $items = [];

        foreach ($this->items as $item) {
            if ($condition($item)) {
                $items[] = $item;
            }
        }

        $col = new static($this->type);
        $col->setItemsFromTrustedSource($items);

        return $col;
    }
{@inheritdoc}