Repository navigation
feat(core): make the aspect container PSR-11 compatible - #768
Merged
Merged
Conversation
AspectContainer extends Psr\Container\ContainerInterface: getValue() is renamed to get(), has() is inherited with the same signature. ServiceNotFoundException implements NotFoundExceptionInterface, and a container entry of the wrong type throws the new ContainerException (an InvalidConfigurationException implementing ContainerExceptionInterface). psr/container (^1.1 || ^2.0) is a new runtime dependency and is always excluded from weaving. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JzyTe7njn5wEgo3sGxfjYR
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #768 +/- ##
=========================================
Coverage 97.82% 97.82%
Complexity 1847 1847
=========================================
Files 105 105
Lines 4867 4867
=========================================
Hits 4761 4761
Misses 106 106 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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 and why
Makes the aspect container a PSR-11 container, so it can be handed to any code that expects
Psr\Container\ContainerInterface.AspectContainerextendsPsr\Container\ContainerInterface.getValue()is renamed toget(string $id): mixed;has()is inherited (same signature as before). The conditional@return ($id is class-string<T> ? T : mixed)is kept for PHPStan narrowing.ServiceNotFoundExceptionimplementsNotFoundExceptionInterface.Go\Aop\Exception\ContainerException(anInvalidConfigurationExceptionimplementingContainerExceptionInterface) for a container entry of the wrong type ingetService()/ a lazy factory returning the wrong type. Existingcatch (InvalidConfigurationException)/catch (ExceptionInterface)keep working. Invalid registrations (addLazyService()with a non-class id) still throw plainInvalidConfigurationException.psr/container^1.1 || ^2.0(interfaces only; both majors fit the signatures). Added toAspectKernel::RUNTIME_DEPENDENCIESso it is never woven.The::advice()(proxy hot path callsget()directly, no alias),PointcutReference, tests. Generated proxies and compiled advisor caches never referencedgetValue(), so existing caches stay valid.composer test:performance:transformationbefore/after (touchesAspectKernel): ratios 0.10/1.34/0.29 → 0.11/1.35/0.29, within noise.Checklist
type(scope): summary)ContainerTest: PSR interface,NotFoundExceptionInterfaceon unknown id,has()⇒get()doesn't throw for null/eager/lazy entries,ContainerExceptionInterfaceon type mismatch;ExceptionHierarchyTestupdated)composer checkpasses (cs, phpstan level 10, phpunit 3117 tests green withopcache.jit=disable)🤖 Generated with Claude Code
https://claude.ai/code/session_01JzyTe7njn5wEgo3sGxfjYR