-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Application meta broken in laravel 11 #1633
Comments
This change also breaks the return type of the app() helper when parameters are provided. |
An easy fix for this would be to add the definition of the function with the old docblock when generating .phpstorm.meta.php file: /**
* Get the available container instance.
*
* @param string|null $abstract
* @param array $parameters
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Foundation\Application|mixed
*/
function app($abstract = null, array $parameters = []) {} |
I think it's a PHPstorm bug; https://youtrack.jetbrains.com/issue/WI-78351 |
I'm not sure about PHPstom, but in vscode with intelephense extension meta overrides are not used if method has a phpdoc with templates used. So calling app() with a string parameter will always return mixed because overrides are not used in this case. |
Versions:
Description:
In laravel 11 the docblock return type of app() function has changed using generics. Now when called without arguments his return type is \Illuminate\Foundation\Application.
Before it was \Illuminate\Contracts\Foundation\Application|\Illuminate\Foundation\Application
With this change overrides in .phpstorm.meta.php are not working when calling app()->make(...).

Manually adding the Contract type to the return variable makes it work again:

The text was updated successfully, but these errors were encountered: