-
Notifications
You must be signed in to change notification settings - Fork 3
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
Stubs loses "use" statements #8
Comments
You should always typehint in phpdoc block with FQCN. |
Right. A rule I forgot. Thanks! |
Not actually true (anymore): https://docs.phpdoc.org/3.0/guide/guides/types.html |
It's not that it is not supported but highly misleading if you put only the last word from the FQCN in PHPDoc. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Looking at its activities, I'm not sure if this project is still maintained.
However, would still like to report an issue hoping for a fix :)
When exporting a class which has one or more "use" statements, these are not included in the stub.
This issue cases PHPStan to think that a returned value (which is the scope of the namespace of one of these "use" statements) is not defined.
In other words, this:
Is stubbed as:
PHPStan, when validating the stub, shows
Return typehint of method WPML\LIB\WP\Hooks::onAction() has invalid type WPML\LIB\WP\Promise.
because it obviously assumesPromise
is part of\WPML\LIB\WP
.Manually adding the missing "use" statements, the error goes away.
The problem is that I've hundred of stubs like these :(
The text was updated successfully, but these errors were encountered: