src/Stub/Answer/Builder/GeneratorAnswerBuilder.php
public function yields($keyOrValue = null, $value = null): self
    {
        $argumentCount = func_num_args();

        if ($argumentCount > 1) {
            $hasKey = true;
            $hasValue = true;
            $key = $keyOrValue;
        } elseif ($argumentCount > 0) {
            $hasKey = false;
            $hasValue = true;
            $key = null;
            $value = $keyOrValue;
        } else {
            $hasKey = false;
            $hasValue = false;
            $key = null;
        }

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

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

        $this->iterations[] = new GeneratorYieldIteration(
            $this->requests,
            $hasKey,
            $key,
            $hasValue,
            $value
        );
        $this->requests = [];

        return $this;
    }
public function yields($keyOrValue = null, $value = null): self
    {
        $argumentCount = func_num_args();

        if ($argumentCount > 1) {
            $hasKey = true;
            $hasValue = true;
            $key = $keyOrValue;
        } elseif ($argumentCount > 0) {
            $hasKey = false;
            $hasValue = true;
            $key = null;
            $value = $keyOrValue;
        } else {
            $hasKey = false;
            $hasValue = false;
            $key = null;
        }

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

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

        $this->iterations[] = new GeneratorYieldIteration(
            $this->requests,
            $hasKey,
            $key,
            $hasValue,
            $value
        );
        $this->requests = [];

        return $this;
    }
public function yields ( $ keyOrValue = null , $ value = null ) : self { $ argumentCount = func_num_args ( ) ; if ( $ argumentCount > 1 ) { $ hasKey = true ; $ hasValue = true ; $ key = $ keyOrValue ; } elseif ( $ argumentCount > 0 ) { $ hasKey = false ; $ hasValue = true ; $ key = null ; $ value = $ keyOrValue ; } else { $ hasKey = false ; $ hasValue = false ; $ key = null ; } if ( $ key instanceof InstanceHandle ) { $ key = $ key -> get ( ) ; } if ( $ value instanceof InstanceHandle ) { $ value = $ value -> get ( ) ; } $ this -> iterations [ ] = new GeneratorYieldIteration ( $ this -> requests , $ hasKey , $ key , $ hasValue , $ value ) ; $ this -> requests = [ ] ; return $ this ; }
Add a yielded value to the answer.

If both `$keyOrValue` and `$value` are supplied, the stub will yield like
`yield $keyOrValue => $value;`.

If only `$keyOrValue` is supplied, the stub will yield like
`yield $keyOrValue;`.

If no arguments are supplied, the stub will yield like `yield;`.

@param mixed $keyOrValue The key or value.
@param mixed $value      The value.

@return $this This builder.
Add a yielded value to the answer .