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
False report on return typehint that can be removed #3748
Comments
Yeah, this is a bug and should be fixed: https://phpstan.org/r/7d2c5bb4-aaae-4295-96d1-8aee8e20e6ba Right now you can do it like this: https://phpstan.org/r/c3d1789b-d5d4-4083-9bbe-efdf7e7932a9 |
@gmponos After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-35: Method LampFactory::getState() never returns int so it can be removed from the return typehint.
+35: Method LampFactory::getState() never returns 0 so it can be removed from the return typehint. Full report
|
@gmponos After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-35: Method LampFactory::getState() never returns int so it can be removed from the return typehint.
+35: Method LampFactory::getState() never returns 0 so it can be removed from the return typehint. Full report
|
Fixed by: phpstan/phpstan-src@838d1e4 |
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
Code snippet that reproduces the problem
Initially I have this:
https://phpstan.org/r/4f38a849-8c15-47aa-a6c9-b416aa4f4a64
And I am trying to fix it with this:
https://phpstan.org/r/7d2c5bb4-aaae-4295-96d1-8aee8e20e6ba
but as you can see I get that the typehint should be removed.
I am getting the same error even if I remove the typehint;
https://phpstan.org/r/02b4d43a-d070-491f-8b73-cbf30591f07e
Expected output
No errors reported.
The text was updated successfully, but these errors were encountered: