protected function withAddedStep(string $stage, callable $step, bool $replace = false)
    {
        $clone = clone $this;

        if ($replace) {
            $clone->stages[$stage] = [];
        }

        $clone->stages[$stage][] = $step;

        return $clone;
    }
protected function withAddedStep(string $stage, callable $step, bool $replace = false)
    {
        $clone = clone $this;

        if ($replace) {
            $clone->stages[$stage] = [];
        }

        $clone->stages[$stage][] = $step;

        return $clone;
    }
protected function withAddedStep ( string $ stage , callable $ step , bool $ replace = false ) { $ clone = clone $ this ; if ( $ replace ) { $ clone -> stages [ $ stage ] = [ ] ; } $ clone -> stages [ $ stage ] [ ] = $ step ; return $ clone ; }
Create a clone with a new step

@param string   $stage
@param callable $step
@param bool     $replace
@return static
Create a clone with a new step