// framework/src/Illuminate/Http/Client/Response.php
public function throw()
{
$callback = func_get_arg(0);
if ($this->serverError() || $this->clientError()) {
if ($callback && is_callable($callback)) {
$callback($this, $exception = new RequestException($this));
}
throw $exception;
}
return $this;
}
It will throw Argument 0 not passed to function if no argument is passed.
Http::get('https://www.laravel.com')->throw()->body();
This code will throw the Argument 0 not passed to function in Laravel 8.7.1
Thanks for reporting this. I also posted some details about it here: https://github.com/laravel/framework/commit/d034e2c55c6502fa0c2bebb6cbf99c5e685beaa5#r42849328
Any reason not to do public function throw($callback = null) instead of using func_get_arg(0)?
@MiniCodeMonkey , changing the method signature would be a breaking change for users that are extending this class, and as breaking change it would only be released on Laravel 9.
So the approach allows us to add this new feature without introducing a BC.
Ah. That totally makes sense. Thanks for clarifying!
On September 30, 2020, GitHub notifications@github.com wrote:
@MiniCodeMonkey https://github.com/MiniCodeMonkey , changing the
method signature would be a breaking change for users that are
extending this class, and as breaking change it would only be released
on Laravel 9.
So the approach allows us to add this new feature without introducing
a BC.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
@taylorotwell, https://github.com/laravel/framework/pull/34597 fix accepted. Tell me, when is the patch release planned?
@andrey-helldar releases are done on Tuesdays.

Most helpful comment
@andrey-helldar releases are done on Tuesdays.