- 
  Notifications
 You must be signed in to change notification settings 
- Fork 544
Handle condition with always true/false sub-condition #3313
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
Handle condition with always true/false sub-condition #3313
Conversation
You've opened the pull request against the latest branch 1.12.x. If your code is relevant on 1.11.x and you want it to be released sooner, please rebase your pull request and change its target to 1.11.x.
d97af04 to
 072168e  
 Compare
 
 3b4d594 to
 87b3684  
 Compare
 
 There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since bar is an object
$this->scope = $this->scope->assignVariable('bar', new ObjectType('Bar'), new ObjectType('Bar'));
we can be sure foo is an int.
I added the same test with is_int($foo) || is_string($mixed) to reproduce the old behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since array is defined as an non nullable array
$this->scope = $this->scope->assignVariable('array', new ArrayType(new MixedType(), new MixedType()), new ArrayType(new MixedType(), new MixedType()));
we can be sure it's an array.
@VincentLanglet do you remember why you closed this PR?
I think this fix would be useful to fix a few of the ~1200 errors
@VincentLanglet do you remember why you closed this PR?
I think this fix would be useful to fix a few of the ~1200 errors
No I don't... Maybe it wasn't working ?
You can try to reopen it on 2.1.x to see the result of the build
Closes phpstan/phpstan#11276