Switch DI container from illuminate/container to entropy/entropy - #8362
Merged
Conversation
TomasVotruba
force-pushed
the
switch-container-illuminate-to-entropy
branch
from
August 22, 2026 20:58
cf23a49 to
cb29b00
Compare
TomasVotruba
marked this pull request as ready for review
August 22, 2026 21:27
TomasVotruba
force-pushed
the
switch-container-illuminate-to-entropy
branch
2 times, most recently
from
August 22, 2026 22:04
d7c10ad to
2c5d712
Compare
Replace the Illuminate container with entropy/entropy. RectorConfig extends Entropy\Container\Container and reuses the container's own primitives: - register() makes a factory-less service discoverable by contract, so findByContract() returns it without any tag layer (tag/tagged/autotag gone) - findByContract() returns a plain 0-indexed list, so variadic spreads such as new NodeTraverser(...$visitors) stay positional - afterResolving() runs setter injection once after a service is built, drained at the outermost make() so aggregate cycles (type mappers <-> the collection they belong to) resolve without a loop - forgetByContract() drops a service from the container; RectorConfig extends it to clear its own bookkeeping, so skip()/test reset need no reflection Removed along the way: the giveTagged() contextual-binding API, service aliases (the one alias was already backed by a factory), the RegisteredService value object, and the ContainerMemento reflection helper. No WeakMap, to keep the source downgradable; service build failures propagate as entropy throws them.
TomasVotruba
force-pushed
the
switch-container-illuminate-to-entropy
branch
from
August 22, 2026 22:04
2c5d712 to
630dafc
Compare
Member
Author
|
Seems ready, lets give it a go 👍 |
This was referenced Aug 23, 2026
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.
Swaps the dependency-injection container from
illuminate/containertoentropy/entropy.RectorConfignow extendsEntropy\Container\Containerand bridges the former Illuminate surface, so configs and rules keep working unchanged.What changed
tagged()/findByContract()return a plain 0-indexed list. entropy keys results by class-string; variadic spreads such asnew NodeTraverser(...$visitors)need a positional list, not name-keyed args.when()->needs()->giveTagged()is a no-op shim. entropy injects tagged collections from the constructor docblock instead:array(notiterable) and carry no default value.afterResolvingdraining. Callbacks are drained only when the outermostmake()unwinds, so aggregate cycles (a service and the collection it belongs to, e.g. the type mappers andPHPStanStaticTypeMapper) resolve without looping.WeakMap-tracked "already injected" set.spl_object_idis recycled after an object is freed; keying by the object itself stops a rebuilt rule from wrongly skipping setter injection ($currentFileProvider must not be accessed before initialization).ServiceCreationFailedExceptionnames the failing service and keeps the root cause asprevious, preserving the previous container's error output.Performance (build + resolve, 79 services, warmup + 5 iterations)
utils/bench-container.phpmeasures the same boot both ways:illuminate/containerentropy/entropyPeak memory during boot drops by roughly 6 MB; wall time is comparable to faster (varies with load).
Checks
composer complete-check(ECS, PHPStan level 8, PHPUnit) greencomposer rectorgreentests/(690) andrules-tests/(4588) green