-
Notifications
You must be signed in to change notification settings - Fork 49
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
Detect variable reuse with different type #111
Comments
Even this. $list = [1, 2, 3];
$list = 'apple'; |
It's really easy to implement your custom rule that checks this, but it's hard to not be too annoying, for example in cases like these: $test = null;
if (rand(0, 1)) {
$test = new Foo();
} |
Okay :) so it is up to me? Could you start me up with 2 sentences? |
/** @var Foo|null $test */
$test = null;
if (rand(0, 1)) {
$test = new Foo();
} |
|
Thank you. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Feature request
I think this is okay.
But many developers tend to stuff other type into the same variable.
Could PHPStan warn me when a variable's type changes?
The text was updated successfully, but these errors were encountered: