idea-php-laravel-plugin
idea-php-laravel-plugin copied to clipboard
Support for typehinting var in $var = app(Foo::class);
Hello,
I was wondering if support for the return of app()
can be added.
app()
can be used for getting an injected model, and it is quite common to use it in situations where dependency injection via controller or constructor is not possible.
I would love to see this autocompleted:
class Foo {
public function getBar() {
return 1;
}
}
$foo = app(Foo::class);
// $foo is not recognized as Foo::class, therefore getBar() is not autocompleted
$foo->getBar();
// Current workaround is adding the following comment:
/** @var Foo $foo */
$foo = app(Foo::class);
$foo->getBar();
Would this be something that can be added?
Thank you
@stemis you can run php artisan ide-helper:meta It will help :)
@adelf That helped, thanks!