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
Incorrect "variable might not be defined" when using "continue 2" #1283
Comments
|
is it a refactoring which is in progress, or only something planned for the future with no idea about when it will happen ? |
It’s well under way and planned to be included in 0.11 in the upcoming
months.
On Wed, 25 Jul 2018 at 10:12, Christophe Coevoet ***@***.***> wrote:
is it a refactoring which is in progress, or only something planned for
the future with no idea about when it will happen ?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1283 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAGZuBXN7Dipm0XYe-2Y-QkHyzDFS0bzks5uKChagaJpZM4VdPL1>
.
--
Ondřej Mirtes
|
@ondrejmirtes what is the status of this bug, now that the refactoring has landed in 0.11.3 ? |
We are facing same bug with |
@ondrejmirtes any news on that one ? |
@stof If there was any news, this issue would be closed. It's low priority for me. You can always persuade PHPStan with an additional |
Hello, We are getting the same problem it seems, here an example in a more really simple case: Is it or should separate issue bien open ? This is somehow problematic because this leads to making specific code because phpstan cannot see iner declaration in same if condition. @ondrejmirtes what is your recommendation on this please ? Better left the code like this and ignoring the error in config file waiting phpstan handle this, or refactor the code ? Thanks a lot. |
I should add, this is strange because here in the complete exemple: It doesn't complain on line 69 strangely, but complain on line 87 !? |
@Yivan writing in an array does not require the variable to exist in PHP. It will happily create it. |
@stof You are totally right ! My bads. So seems my problem is on the right issue, same than the original post about declaration in if condition. |
Fixed: phpstan/phpstan-src@31fcad6 |
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. |
Summary of a problem or a feature request
When the code is using
continue 2
for a switch inside a loop, the variable defined in all other cases of the switch is still marked as not defined for the code running in the loop after theswitch
block, while it cannot be the case.Code snippet that reproduces the problem
https://phpstan.org/r/7ea8280d7f815b255e3f5528dc5c4262
Expected output
should not detect any issue
The text was updated successfully, but these errors were encountered: