-
-
Notifications
You must be signed in to change notification settings - Fork 863
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
"Method M should return static(T) but returns T" for traits #5132
Comments
It looks like #4860 |
Hello, thank you for your kind words! This is an expected error and has nothing to do with traits, see: https://phpstan.org/r/cd9bdddf-19cc-414c-a86c-e1b2fbb710d2 The error it's trying to prevent: https://3v4l.org/QvcPB |
Thank you for your quick reply. Using the "static" return type was a hack to get IDE autocompletion, but it was a mistake. I fixed IDE autocompletion using the phpdoc @method tag: |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Bug report
The use of the "static" keyword as a return type in a Trait does not seem to be handled properly.
Code snippet that reproduces the problem
https://phpstan.org/r/cb077076-faae-4bbb-b865-ab081d95cb52
Expected output
no error
Did PHPStan help you today? Did it make you happy in any way?
Yes, phpstan is a great tool and we use it at the max level on all our projects...
...with a HUGE baseline that we correct as we go :)
The text was updated successfully, but these errors were encountered: