src/IteratorPipeline/Pipeline.php
public function then(callable $callback, ...$args): self
    {
        $this->iterable = i\type_check(
            $callback($this->iterable, ...$args),
            'iterable',
            new \UnexpectedValueException("Expected step to return an array or Traversable, %s returned")
        );

        return $this->iterable instanceof Pipeline ? $this->iterable : $this;
    }
public function then(callable $callback, ...$args): self
    {
        $this->iterable = i\type_check(
            $callback($this->iterable, ...$args),
            'iterable',
            new \UnexpectedValueException("Expected step to return an array or Traversable, %s returned")
        );

        return $this->iterable instanceof Pipeline ? $this->iterable : $this;
    }
Define the next step via a callback that returns an array or Traversable object.

@param callable $callback
@param mixed    ...$args
@return self