Use early exit when collecting the registered class loaders - #6282
Conversation
The Coding Standard job is red on 2.2.x after c10897b: the loop collecting ClassLoader ids nests its body in an if, and the boundary lookup nests a foreach in an if. Both read better inverted, and the lookup becomes a named function. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Thank you! |
|
While checking which CI reds were mine, I measured the one remaining base failure and filed it as phpstan/phpstan#15119: Your call which side moves (raise the cap, or find the 30 MB) - I did not want to pick, since the cap doubles as a memory-regression guard. Happy to send either, or to bisect self-analysis peak from 2.2.9 to now if that is the more interesting question. For the record, the rest of the reds on this PR are not from it: the 14 integration jobs are the |
The
Coding Standardjob is red on2.2.xafter c10897b (#6281 - my fault, the fix was on the branch but not in the merged commit):The collect loop is inverted to
if (!isComposerClassLoader(...)) { continue; }, and the boundary lookup - aforeachnested in anif- becomesfindClassLoaderIndex(), which returns early. No behaviour change.Verified:
phpcsover the whole repo reports the error on the current tip and nothing with this change;CollectNewAutoloadFunctionsTest6/6; self-analysis clean;e2e/bug-15102still green.