Split LazyContainerFactory::create() into named sections - #8233
Merged
Conversation
create() was one 319-line method holding every container registration, split only by comments. Turn each of those comment-delimited sections into a private method, so create() reads as a list of what gets registered. Call order is unchanged, which matters: tagged service lists are consumed in registration order. Also correct a comment left over from removing ClassSkipVoter - UsedSkipCollector is shared by Skipper, PathSkipper and ApplicationFileProcessor, not by "skipper voters", which no longer exist.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
LazyContainerFactoryis 739 lines across three methods, andcreate()is 319 of them — every container registration in one body, separated only by comments like// caching,// tagged services,// node name resolvers.Each of those sections becomes a private method, so
create()now reads as a table of contents:No statement is added, removed, or reordered — the sections are called in exactly their original order. That is deliberate rather than incidental: tagged service lists are consumed in registration order, so moving any block would be a behavior change.
This is one of the few refactors that costs lines rather than saving them:
+40 / -3, all of it method signatures. The win is structural, not size.Verification
Beyond the usual gates, I compared the built container on this branch against
main— the binding keys, aliases, contextual bindings, and the ordered tag lists — and they are identical.To make sure the comparison was real (a shared
vendor/autoloader would otherwise resolve both runs to the same sources), the baseline ran in a separate worktree with a checkout-first autoloader prepended. It loadedmain's factory with 3 methods and noregisterConsole(); this branch's has 12 and does.I also checked that no local variable was shared across the extracted blocks —
$rectorConfigis the only one that flows between them, so extraction cannot change semantics.Drive-by
One stale comment, left over from removing
ClassSkipVoterin #8226:Skip voters no longer exist; the actual consumers are
Skipper,PathSkipperandApplicationFileProcessor.