Avoid PHP Warning in TokenGuard since PHP 8.1
SineMah opened this issue · comments
- Passport Version: 11.6
- Laravel Version: 9.19
- PHP Version: 8.1.14
- Database Driver & Version: MySQL 8.0.30
Description:
No Bug atm, it bothers me just a lil bit.
The parameter $credentials can be an empty array.
https://github.com/laravel/passport/blob/11.x/src/Guards/TokenGuard.php#L132
In Line 140
https://github.com/laravel/passport/blob/11.x/src/Guards/TokenGuard.php#L140
It will result in a warning since PHP 8.1
$credentials['request'] ?? null;
// or
Arr::get($credentials, 'request');
// or if there is no problem with a valid default value
app('request');
would do the job
Heya. We'd appreciate a PR here! thanks