Hi
One thing that is buggeing me is that php tools does not recognise that the Laravel methods Auth::user() and auth()->user() returns a User model object and there for one get errors
/warnings like this:
Hi
One thing that is buggeing me is that php tools does not recognise that the Laravel methods Auth::user() and auth()->user() returns a User model object and there for one get errors
/warnings like this:
From what I see, the Auth::user()
method is declared as
/** @method static \Illuminate\Contracts\Auth\Authenticatable|null user()
Would it help to add a more specific type annotation to .phpstorm.meta.php
or _idehelper.php
?
I'm happy to do any annotation, I just think that PHP Tools should be abele to do it on it's own.
I would like to only use VSCode... but phpstorm offers some features e.g. like this :)
My phpstorm doesn't :)
Maybe there's some additional config/meta file?
stripe_id, name is table columns.
Could be the Laravel Idea plugin that do the trick
and the helper files that the plugin is generating is also available to PHP Tools, so it should be possible
I see, The plugin puts the generated helpers into /vendor/ folder (which is, at least, unexpected).
Thank you for pointing me in the right direction.
Still, I don't see where they found out auth()->user()
returns User
model tho :) I'll keep looking, we'll be implementing similar support for Laravel for VSCode anyways.
edit: it seems it's specified in laravel-idea.xml
settings file or there's some other magic
Do you know, is there any way we can find out that auth()->user()
returns our App\Models\User
class?
Just releasing pre-release which handles _ide_helper and _laravel_idea; which helps in most cases, but still this one is missing.
cc @ging-dev
JakubMisek typically it will extend from Illuminate\Foundation\Auth\User
We may handle completion after Illuminate\Contracts\Auth\Authenticatable
(that's what all these methods are returning), assuming it's a user model, and find the class extending Illuminate\Foundation\Auth\User
.
ging-dev nice ...
So the generated .phpstorm.meta
(and maybe ide-helper
, _laravel_idea
) should probably already define the stubs with the correct type? But I don't see it there.