Improve expression resolving of superglobals#3762
Improve expression resolving of superglobals#3762herndlm wants to merge 2 commits intophpstan:2.1.xfrom
Conversation
5d687dc to
95b8360
Compare
|
This pull request has been marked as ready for review. |
|
I'm not a huge fan of this approach. It's going to pollute the output of Could we add these to the scope only when they are narrowed by some assignments or conditions? I think we already do a similar thing for |
smart, why haven't I thought about this :) I pushed something, not sure if it's going in the right direction or not though. |
|
I have a feeling that the stuff accessing |
| } | ||
|
|
||
| /** @return array<string, ExpressionTypeHolder> */ | ||
| private function getNativeSuperglobalTypes(): array |
There was a problem hiding this comment.
you could de-duplicate this method by passing in the expressionTypes via parameter
There was a problem hiding this comment.
right. I stole this basically from getNativeConstantTypes() vs getConstantTypes() which could be adapted in a similar way then. maybe in a follow-up refactor :)
44586ac to
990605a
Compare
990605a to
ce9f61d
Compare
ce9f61d to
eaac5a5
Compare
|
#3871 is doing this in a better way. checked with the tests here which work there as well (except 2 edge cases I'm not sure and are most likely not worth to pursue) |
UPDATE: perf. testing is less relevant, the solution was adapted to lazily add global expression types which should avoid performance issues