src/ArrayObject.php
public function filterCallback(callable $fn): ArrayObjectInterface
    {
        return new static(
            array_values(
                array_filter(
                    $this->isCollection() ? $this->data : [$this->data],
                    function($item) use ($fn) {
                        return $fn($this->box($item));
                    }
                )
            )
        );
    }
public function filterCallback(callable $fn): ArrayObjectInterface
    {
        return new static(
            array_values(
                array_filter(
                    $this->isCollection() ? $this->data : [$this->data],
                    function($item) use ($fn) {
                        return $fn($this->box($item));
                    }
                )
            )
        );
    }
public function filterCallback ( callable $ fn ) : ArrayObjectInterface { return new static ( array_values ( array_filter ( $ this -> isCollection ( ) ? $ this -> data : [ $ this -> data ] , function ( $ item ) use ( $ fn ) { return $ fn ( $ this -> box ( $ item ) ) ; } ) ) ) ; }
Return a new collection by filtering the data via a callback.

@param callable|\Closure $fn

@return ArrayObjectInterface
Return a new collection by filtering the data via a callback .