inertiajs / inertiajs.com

Official Inertia.js website.
https://inertiajs.com
139 stars 105 forks source link

Fix error handling snippet #331

Closed jessarcher closed 6 months ago

jessarcher commented 6 months ago

This PR fixes some issues with the error-handling code snippet for Laravel 11.

The main issue is that the closure did not accept the $request variable, which is used later.

Additionally, the Symfony\Component\HttpFoundation\Response type does not define the status method, so IDEs/static analysis think it's missing. I checked the actual class the closure receives and got Illuminate\Http\Request, where the status method is defined.

The only thing I'm not sure of is whether there is ever a situation where a different response class may be received in the closure, which won't pass the type check and may not contain the status method.