Skip to content
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

Add support for contingent variables #11

Closed
muglug opened this issue Dec 10, 2016 · 1 comment
Closed

Add support for contingent variables #11

muglug opened this issue Dec 10, 2016 · 1 comment

Comments

@muglug
Copy link
Collaborator

muglug commented Dec 10, 2016

This (bad) code currently emits a PossiblyUndefinedVariable issue. It shouldn't, as Psalm should know that $a is defined whenever $do_thing is !empty.

$do_thing = rand(0, 10) > 5;
if ($do_thing) {
    $a = 1;
}
if ($do_thing) {
    $b = $a;
}

This code should still emit a PossiblyUndefinedVariable issue, because $do_thing is redefined.

$do_thing = rand(0, 10) > 5;
if ($do_thing) {
    $a = 1;
}
$do_thing = rand(0, 10) > 5;
if ($do_thing) {
    $b = $a;
}
@muglug
Copy link
Collaborator Author

muglug commented Apr 12, 2018

Closing, won't support

@muglug muglug closed this as completed Apr 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant