Replace illuminate/container with entropy container#13
Open
TomasVotruba wants to merge 1 commit into
Open
Conversation
ECSConfig now extends Entropy\Container\Container instead of Illuminate's: - Checkers are registered as container service factories that autowire (via Container::build()) then apply their configuration; collectors receive them through docblock array autowiring / findByContract instead of Laravel tags and contextual bindings (when()->needs()->giveTagged()). - findByContract() is overridden to preserve checker registration order and the documented duplicate-in-set behaviour (discussion #198). - Compiler passes operate on ECSConfig::getCheckerClasses()/removeChecker() instead of Laravel getBindings()/offsetUnset()/tags reflection. - LazyContainerFactory registers custom-factory services via service(); plain services are autowired and cached by the container. Removes the illuminate/container dependency and its patch. entropy/entropy is temporarily pinned to the feature branch (TomasVotruba/entropy#8) via a VCS repository until that PR is merged. symfony/console is intentionally untouched: it remains a transitive dependency of friendsofphp/php-cs-fixer and symplify/easy-parallel, so it cannot be removed from the install tree.
1973b5d to
245e4c8
Compare
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.
Migrates the dependency-injection container from illuminate/container to entropy/entropy's container, and removes
illuminate/container(and its patch) entirely.Uses entropy/entropy
^0.4(0.4.0), which ships the extendable container required here (entropy#8). Scope is DI only — the console/command layer is untouched and still uses symfony/console; a console migration is a separate, later PR.What changed
ECSConfignow extendsEntropy\Container\Container.ECSConfig's own registry (checkerConfiguration+ registration order), exactly as before, and are autowired on demand.make()is overridden: a checker class is returned fully configured (autowired viaparent::make(), then whitespace config +configure()/sniff-property setup applied, built once and shared); every other class is resolved by the parent container.findByContract()is overridden to return checkers in registration order, keeping duplicates (a class declared in both a set and explicitly appears twice, sharing one instance, last config wins — discussion #198) and honouring compiler-pass removals.ECSConfig::getCheckerClasses()/removeChecker()instead ofgetBindings()/offsetUnset()/ tags reflection.LazyContainerFactoryregisters custom-factory services withservice(); output formatters are eager-autowired (make()) soOutputFormatterCollectorcan collect them by contract.FileHashComputerhashesgetCheckerConfiguration()(checkers + their config) instead ofgetBindings().FixerFileProcessor,SniffFileProcessor,OutputFormatterCollector) keep their@param X[]docblocks and are autowired through docblock array injection.illuminate/containerfromcomposer.jsonand deletedpatches/illuminate-container-container-php.patch.tomasvotruba/class-leakto^2.1.7(first release compatible with entropy^0.4).No new container primitives
Checkers and output formatters are built with entropy's existing
make()(reflection autowiring) — nobuild()/ factory-bypass method is needed. This avoids registering a service factory keyed by a class only to re-construct that same class inside it.Scope note — symfony/console is NOT removed
symfony/consoleis a transitive dependency offriendsofphp/php-cs-fixerandsymplify/easy-parallel, so it cannot be removed from the install tree. This PR is container-only.Verification
All green locally (PHP 8.4): PHPStan level 8, Rector (dry-run),
bin/ecs check, PHPUnit (94 tests),class-leak check bin src. End-to-endbin/ecs checkverified.