Eloquent\Phony\Stub\StubData::throws PHP Метод

throws() публичный Метод

Add an answer that throws an exception.
public throws ( Exceptio\Exception | Erro\Error | string | null $exception = null )
$exception Exceptio\Exception | Erro\Error | string | null The exception, or message, or null to throw a generic exception.
    public function throws($exception = null)
    {
        if (0 === func_num_args()) {
            return $this->doesWith(function () {
                throw new Exception();
            }, array(), false, false, false);
        }
        foreach (func_get_args() as $exception) {
            if (is_string($exception)) {
                $exception = new Exception($exception);
            } elseif ($exception instanceof InstanceHandle) {
                $exception = $exception->get();
            }
            $this->doesWith(function () use($exception) {
                throw $exception;
            }, array(), false, false, false);
        }
        return $this;
    }