Description
Extension Version
0.1.18
PHP Binary
Docker
Operating System
Windows
What happened?
Trying to get a route parameter via a FormRequest's route() function generate an erroneous warning, I believe the extension thinks the code is trying to use Laravel's global route() helper.
Mimimal Code Sample
// routes/api.php
Route::apiResource('/clients', ClientController::class);
// app/Http/Controllers/ClientController.php
public function show(ClientShowRequest $request, Client $client)
{
return $client;
}
// app/Http/Requests/ClientShowRequest.php
class ClientShowRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
$client = $this->route('client');
return $this->user()->can('viewClient', $client);
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
//
];
}
}