src/IteratorPipeline/PipelineBuilder.php
public function then(callable $callback, ...$args): self
    {
        $copy = clone $this;

        if ($callback instanceof self) {
            $copy->steps = array_merge($this->steps, $callback->steps);
        } else {
            $copy->steps[] = [$callback, $args];
        }

        return $copy;
    }
public function then(callable $callback, ...$args): self
    {
        $copy = clone $this;

        if ($callback instanceof self) {
            $copy->steps = array_merge($this->steps, $callback->steps);
        } else {
            $copy->steps[] = [$callback, $args];
        }

        return $copy;
    }
Define the next step via a callback that returns an array or Traversable object.

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