-
Notifications
You must be signed in to change notification settings - Fork 0
Implement strict only mode support in container compilation and resolution #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #32 +/- ##
============================================
- Coverage 99.12% 98.71% -0.41%
- Complexity 403 415 +12
============================================
Files 34 34
Lines 1145 1170 +25
============================================
+ Hits 1135 1155 +20
- Misses 10 15 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting
| private function generateGetMethod(ClassType $class): void | ||
| { | ||
| $method = $class->addMethod('get') | ||
| ->setReturnType('object') | ||
| ->setBody(<<<'PHP' | ||
| ->setReturnType('object'); | ||
|
|
||
| $strictBody = <<<'PHP' | ||
| $instance = $this->applyPreInterceptors($id, $args); | ||
| if ($instance !== null) { | ||
| return $instance; | ||
| } | ||
| if (!isset($this->serviceMap[$id])) { | ||
| throw new NotFoundException($id, 'compiled'); | ||
| } | ||
| $instance = $this->{$this->serviceMap[$id]}($args); | ||
| return $this->applyPostInterceptors($instance); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Preserve parent fallback when strict compiled container resolves services
The strict get() body now throws NotFoundException whenever $id is not in $this->serviceMap, instead of delegating to parent::get(). This means any service bound after compilation (via set() or a provider at runtime) can never be resolved in a strict compiled container even though the base container still allows explicit bindings while merely disallowing unregistered autowiring. As a result a strict compiled container becomes unusable for dynamic registrations, which is not necessary for enforcing strictness because ArgonContainer’s resolver already respects the mode. Consider retaining the parent fallback so registered-but-uncompiled services continue to work while strict mode still prevents autowiring.
Useful? React with 👍 / 👎.
No description provided.