-
-
Notifications
You must be signed in to change notification settings - Fork 864
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
Return from declare() block is ignored #9309
Comments
You win "the most surprising issue of 2023" award! :) https://twitter.com/OndrejMirtes/status/1657300073196265473 |
@hocker1 After the latest push in 1.11.x, PHPStan now reports different result with your code snippet: @@ @@
-4: Function a() should return int but return statement is missing.
+No errors |
@ondrejmirtes this is fixed now |
@mad-briller If you want to do the God's work, please send regression tests for these fixed issues: #5266, #9309, #9394, #6922. Thank you. |
sorry @ondrejmirtes i've been away from pc for a few days and you beat me to it |
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
PHPStan seems to ignore code inside declare() { ... } blocks.
Code snippet that reproduces the problem
https://phpstan.org/r/626c6650-affc-4827-92ff-9f245ca2eb12
Expected output
I expected PHPStan to report that the code is ok. Instead, it reports that the return statement is missing, which is not true, there is return statement inside the declare() block.
The text was updated successfully, but these errors were encountered: