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
Intersections appear not to be templated properly #2581
Comments
PHPStan is confused because you're creating intersection from two classes. If you make MockObject an interface, it works: https://phpstan.org/r/9149e4de-55cc-45e5-a1ac-13d6bdd9d750 Your playground link (missing from the description): https://phpstan.org/r/10bd4532-0406-4a64-a82c-5f317372fa7c There should probably be a rule that checks if the final return type after inferring types isn't NeverType... |
What is happening here is that |
It’s not spotted in this case because the NeverType rule is called on method declaration but here it happens in a specific method call. |
@ondrejmirtes After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-No errors
+26: Return type of call to function mock contains unresolvable type.
+27: Return type of call to function mock contains unresolvable type.
+28: Return type of call to function mock contains unresolvable type. Full report
|
Implemented: phpstan/phpstan-src@58c29fd |
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. |
Code snippet that reproduces the problem
Expected output
Method (A&MockObject)::notFoo does not exist
Actual output
No issues
The text was updated successfully, but these errors were encountered: