Skip to content

InstanceOf: fix uncertainty#211

Closed
hrach wants to merge 2 commits intophpstan:masterfrom
hrach:instance_of
Closed

InstanceOf: fix uncertainty#211
hrach wants to merge 2 commits intophpstan:masterfrom
hrach:instance_of

Conversation

@hrach
Copy link
Copy Markdown
Contributor

@hrach hrach commented May 22, 2020

@hrach
Copy link
Copy Markdown
Contributor Author

hrach commented May 22, 2020

The second commit reveals the consequences...

the issue is:

  • isSuperType behavior != instanceof behavior
  • but the instanceof resolution is not "stored" anywhere, the typing system doesn't allow this & isSuperType cache doesn't contain the modified behavior of instanceof.

probably something different /shrug

@ondrejmirtes
Copy link
Copy Markdown
Member

Thank you! Merged: c3f3f61

To restore the original behaviour from 13a3e08, we'd have to start remembering the type of the whole Instanceof_ expression in TypeSpecifier, which currently isn't done.

@hrach hrach deleted the instance_of branch May 25, 2020 15:04
hrach added a commit to hrach/phpstan-src that referenced this pull request Jun 9, 2020
Uncertainty of instanceof $object is already handled in
MutatingScope (fixed by phpstan#211).
ondrejmirtes pushed a commit that referenced this pull request Jun 9, 2020
Uncertainty of instanceof $object is already handled in
MutatingScope (fixed by #211).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

False positive with class-string and instanceof FP on dynamic second parameter to instanceof

2 participants