Mutating scope refactor and regression test#1934
Conversation
| assertType('array', $arr); | ||
| assertType("mixed", $arr[$key]); |
There was a problem hiding this comment.
$arr[$key] was mixed~null before this PR
|
This pull request has been marked as ready for review. |
a91acd5 to
c32ad74
Compare
|
This pull request has been marked as ready for review. |
|
@rvanvelzen |
|
I tried to break the logic in #1929 and #1934 and I did it. This example breaks in these PRs: https://phpstan.org/r/704ec47a-e5b0-4d5b-9bf6-037c4b563278 Relying on I guess that's what those failures in phpstan-webmozart-assert are about too. |
|
Thank you for the example. I see, this logic isn't correct... For the phpstan-webmozart-assert failure, I think rvanvelzen's explanation #1929 (comment) is right. (so it should fail as same as arrow function fails) |
|
@ondrejmirtes |
|
I don't think that any changes around the Variables are correct. There's only one bug reported, and that's about function_exists(). So we need to retain this expression, and everything else needs to stay the same. |
|
Also class_exists maybe. |
|
I added the variable related specification logic in the migration of variableTypes and moreSpecificTypes to keep the logic before but I think it's not correct enough This pull request was first intended to fix that issue. |
|
so, I think I can reset this pull request to 93ef0b8 |
|
Made your example explicit that there are non variable expressions that should be invalidated. |
Yeah, sure :) |
f703817 to
2780476
Compare
|
@ondrejmirtes |
|
Thank you! |
Added some regression test for the logic of keeping var related expression types.
Fixed the last test case to work correctly.