Markus Staab
Markus Staab
yeah its something which stood out on the way to analyze the root cause. I had the impression the changes itself improve the code no matter the underlying perf problem,...
> What's the difference with the actual objects being passed there? ```php $enumCases = $types[$i]->getEnumCases(); if (count($enumCases) === 1) { $enumCaseTypes[$types[$i]->describe(VerbosityLevel::cache())] = $types[$i]; unset($types[$i]); continue; } ``` effectively filters for...
I just realized there is another difference. reverting https://github.com/phpstan/phpstan-src/pull/2985 also makes the repro for https://github.com/phpstan/phpstan/issues/10979 report more errors (80 vs. 84)
> So what makes the first code slow? `$types[$i]->getEnumCases()` it gets slow, because of massive repetative calls into reflection, see - https://github.com/phpstan/phpstan/issues/10772#issuecomment-2015131511 (I verified the profile, by re-running the load...
Our progress overlapped :-). I completed https://github.com/phpstan/phpstan-src/pull/3062#issuecomment-2104563512 a few minutes ago which is fast for both cases. It does not require your latest class-reflection caching commit, so you may revert...
Fixed in upstream
While technically possible, I don't think its a good idea to use phpstan-types across library boundaries. I would prefer more strict means like interfaces or classes to type stuff in...
At least thats what I had in mind on how to implement it. Create a new visitor and store in attributes what is required to make the rule work
@ondrejmirtes nice, thank you. one note: I wonder why line 10 did not error: https://phpstan.org/r/24869b6d-8b20-4542-a763-a4192e044b09 all other lines look great
Alternativly we could downgrade the stubs