Replies: 3 comments
|
Glade you like it. Feel free to create an issue for this and share a code snippet for replicating the issue. Most helpers do not need any special support code as long as the PHP engine has proper support for annotations, but the auth() one is a bit of a special case. Try using it like this instead: auth()->guard()->user()->Another option is: auth('web')->user()->(assuming your configured auth guard is 'web') |
|
This isn't really a phpantom bug. The You can fix it by getting a // Option 1: pass the guard name — the helper then returns a Guard
Route::get('/user', fn () => auth('web')->user() ?? response()->json(null, 401));
// Option 2: call guard() first
Route::get('/user', fn () => auth()->guard()->user() ?? response()->json(null, 401));
// Option 3: use the facade, which has @method annotations
Route::get('/user', fn () => Auth::user() ?? response()->json(null, 401));Any of these makes the warning go away. FWIW, PHPStan without Larastan flags plain |
|
I agree with @DMNCDLPRT but it's such a common issue that we went the long route and now figure out what it can return based on your configuration, this means it doesn't run in to the same false positive as systems that probe the running application but does surface ambgious results if your configuration isn't tightened down. For anyone following this here it was addressed yesterday and will be part of the next release (probably 0.10.0 somewhere between Sunday and Wednesday: #298 |
Uh oh!
There was an error while loading. Please reload this page.
Hey there!
Awesome job building this, excited to move from PHP Tools to this given the huge speed and performance wins. I did notice this:

Is there any support coming or is this something I need to enable to get working? Thank you
All reactions