Conversation
|
You can't do this for some types, for example |
|
Looks like the method is called a lot of times. The number of times should correspond to the number of functions/methods inside the project. Maybe the type could be cached in reflection layer in more places. |
the method is called once per parameter and once per return type. so it is called way more often then methods/functions contained in the project beeing scanned. |
|
Yeah that's what I meant of course, but we should verify it's not called more often (I suspect it is, definitely for closures and arrow functions, maybe even normal functions and methods). |
running phpstan on
microsoft/microsoft-graphshows a bottleneck onTypeCombinator::addNullinParserNodeTypeToPHPStanType->resolve.since we are in a very low level method we can just return
new UnionTypeand prevent calls toisSuperTypeOfandunionwhich shaves of a few seconds