Just like how it was, only different.
Nothing new about Laravel 5.5 using Whoops, But one thing that I wanted to touch on was how to Configure Whoops in Laravel 5.5 to open files with PHP Storm, Or any other supported editor.
My previous example worked until I did a Composer update, I got an error.
My first idea was to dig out the old code with the now classic ($request,
method. To my surprise everything worked fine, That was until Docker/CI tripped an error.
Exception $exception)
[ErrorException]
Declaration of App\Exceptions\Handler::renderExceptionWithWhoops($request,
Exception $exception) should be compatible with Illuminate\Foundation\Excep
tions\Handler::renderExceptionWithWhoops(Exception $e)
Humm…
My renderExceptionWithWhoops
also handled JSON responses and since renderExceptionWithWhoops
is implemented in Laravels Core and no longer accepted $request
they have to be handled independently.
protected function handleWhoopsies($request, Exception $exception)
{
if ($request->ajax()) {
return $this->renderJsonExceptionWithWhoops();
} else {
return $this->renderExceptionWithWhoops($exception);
}
}
Here is the full Gist.
In short because renderExceptionWithWhoops
no longer accepts $request
I created a handler called handleWhoopsies
and let it do the split for me.
This checks if the request is ajax or not and then calls renderJsonExceptionWithWhoops
or calls renderExceptionWithWhoops
as normal.
Composer update and everything seems to work great.
Let me know if you had troubles configuring Whoops and if you found this helpful!