-
Notifications
You must be signed in to change notification settings - Fork 0
Support for compiled invoke and contextual bind #33
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✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #33 +/- ##
=============================================
+ Coverage 98.71% 100.00% +1.28%
- Complexity 415 433 +18
=============================================
Files 34 34
Lines 1170 1299 +129
=============================================
+ Hits 1155 1299 +144
+ Misses 15 0 -15 ☔ 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
| if ($this->noReflection) { | ||
| $method->setBody(<<<'PHP' | ||
| $compiledMethod = $this->buildCompiledInvokerMethodName($serviceId, $method); | ||
| if (method_exists($this, $compiledMethod)) { | ||
| return $this->{$compiledMethod}($args); |
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.
Pass instance argument incorrectly when invoking compiled services
The compiled container’s invokeServiceMethod() dispatches compiled invokers with return $this->{$compiledMethod}($args); even though generateMethodInvoker() defines those invoker methods to accept an optional $instance followed by the $args array. When noReflection is enabled (and also in the strict/lenient branches below), the first parameter is therefore an array instead of ?object, which will raise a TypeError before the target method is executed. The call needs to pass both parameters in the proper order (e.g. $this->{$compiledMethod}(null, $args)).
Useful? React with 👍 / 👎.
| if (is_string($target) && class_exists($target)) { | ||
| $contextKey = $target . '::__invoke'; | ||
| if (isset($this->compiledMethodMap[$contextKey])) { | ||
| return $this->{$this->compiledMethodMap[$contextKey]}(null, $arguments); | ||
| } | ||
| throw nNotFoundException::forMissingCompiledInvoker($contextKey); |
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.
Typo throws unknown class in no-reflection invoke path
In the invoke() implementation for no-reflection mode the fallback branch for string class targets uses throw nNotFoundException::forMissingCompiledInvoker($contextKey);. The extra leading n makes PHP look for an undefined symbol and the compiled container will fatally error instead of throwing the intended NotFoundException. This prevents strict/no-reflection invocations from working when a compiled invoker is missing.
Useful? React with 👍 / 👎.
No description provided.