src/Stub/Answer/Builder/GeneratorAnswerBuilder.php
public function returns(...$values): Stub
    {
        if (empty($values)) {
            $values = [null];
        }

        $value = $values[0];
        $argumentCount = count($values);
        $copies = [];

        for ($i = 1; $i < $argumentCount; ++$i) {
            $copies[$i] = clone $this;
        }

        if ($value instanceof InstanceHandle) {
            $value = $value->get();
        }

        $this->returnValue = $value;
        $this->returnsArgument = null;
        $this->returnsSelf = false;

        for ($i = 1; $i < $argumentCount; ++$i) {
            $this->stub
                ->doesWith($copies[$i]->answer(), [], true, true, false);

            $copies[$i]->returns($values[$i]);
        }

        return $this->stub;
    }
public function returns(...$values): Stub
    {
        if (empty($values)) {
            $values = [null];
        }

        $value = $values[0];
        $argumentCount = count($values);
        $copies = [];

        for ($i = 1; $i < $argumentCount; ++$i) {
            $copies[$i] = clone $this;
        }

        if ($value instanceof InstanceHandle) {
            $value = $value->get();
        }

        $this->returnValue = $value;
        $this->returnsArgument = null;
        $this->returnsSelf = false;

        for ($i = 1; $i < $argumentCount; ++$i) {
            $this->stub
                ->doesWith($copies[$i]->answer(), [], true, true, false);

            $copies[$i]->returns($values[$i]);
        }

        return $this->stub;
    }
public function returns ( ... $ values ) : Stub { if ( empty ( $ values ) ) { $ values = [ null ] ; } $ value = $ values [ 0 ] ; $ argumentCount = count ( $ values ) ; $ copies = [ ] ; for ( $ i = 1 ; $ i < $ argumentCount ; ++ $ i ) { $ copies [ $ i ] = clone $ this ; } if ( $ value instanceof InstanceHandle ) { $ value = $ value -> get ( ) ; } $ this -> returnValue = $ value ; $ this -> returnsArgument = null ; $ this -> returnsSelf = false ; for ( $ i = 1 ; $ i < $ argumentCount ; ++ $ i ) { $ this -> stub -> doesWith ( $ copies [ $ i ] -> answer ( ) , [ ] , true , true , false ) ; $ copies [ $ i ] -> returns ( $ values [ $ i ] ) ; } return $ this -> stub ; }
End the generator by returning a value.

Calling this method with no arguments is equivalent to calling it with a
single argument of `null`.

@param mixed ...$values The return values.

@return Stub The stub.
End the generator by returning a value .