refactor: replace the in-tree DI container with internal/container - #218
Merged
Merged
Conversation
Drops src/Service/Container.php in favour of internal/container's ObjectContainer, whose public surface is a superset of the old one. yiisoft/injector leaves the root require and becomes a transitive dependency. Config hydration moved out of a hard-coded namespace check in make() into a container inflector. ConfigInflector and its attributes are ported verbatim from the reference implementation under Buggregator\Trap\Application\Config\Internal (only Testo\Common\ErrorReporter is swapped for the Trap Logger), so the whole subtree can later be extracted into a package or container module by swapping the namespace alone. Config classes now opt in with the #[InflectableConfig] marker attribute instead of relying on their FQCN prefix. Assisted-By: Claude Opus 4.8 (1M context)
7 tasks
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #218 +/- ##
============================================
- Coverage 27.78% 26.91% -0.88%
- Complexity 1403 1411 +8
============================================
Files 159 160 +1
Lines 4373 4411 +38
============================================
- Hits 1215 1187 -28
- Misses 3158 3224 +66 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
roxblnfk
force-pushed
the
feature/internal-container
branch
2 times, most recently
from
September 8, 2026 09:50
06560bd to
9729b3b
Compare
roxblnfk
force-pushed
the
feature/internal-container
branch
from
September 8, 2026 09:54
9729b3b to
bc71895
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.
What was changed
Service\Containeris replaced byinternal/container'sObjectContainer(a superset of the old API);yiisoft/injectordrops from the root require and stays only as a transitive dependency.make()— it is a container inflector (ConfigInflector) registered inBootstrap. Config classes opt in with the#[InflectableConfig]marker attribute instead of relying on their FQCN prefix.ConfigInflectorand its attributes live underBuggregator\Trap\Application\Config\Internal, ported verbatim from the shared reference implementation so the whole subtree can later be extracted into a package or container module by swapping the namespace alone.Why?
Several projects carried their own copy of the same container.
internal/containeris that code, extracted and grown, so Trap moves onto the shared package and keeps config hydration as project code wired back in through an inflector.Review notes
internal/containerrequires PHP>=8.2while Trap still declares>=8.1and tests 8.1 in CI; the package requirement is being lowered to>=8.1separately, so this branch keeps Trap on>=8.1and does not touch the matrix.Testo\Common\ErrorReporter→ the TrapLogger; everything else is a pure namespace swap.Checklist
#[InputOption],#[Env], comma-list arrays)ConfigInflectorTest(moved fromConfigLoaderTest)