Repository navigation
Issue/467 di registry container split - #468
Conversation
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 3 minutes and 34 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughA new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #468 +/- ##
============================================
+ Coverage 82.44% 82.48% +0.03%
- Complexity 2894 2902 +8
============================================
Files 250 251 +1
Lines 7798 7814 +16
============================================
+ Hits 6429 6445 +16
Misses 1369 1369 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/Di/DiRegistry.php`:
- Around line 40-46: The bulk binding method registerDependencies currently
ignores duplicates by checking isRegistered and skipping, but register() throws
on duplicates; change registerDependencies (method name: registerDependencies)
to not silently skip duplicates—either remove the isRegistered check and call
register($concrete, $abstract) for every entry so register() will throw on
duplicates, or explicitly detect duplicates and throw a clear exception (include
$abstract in the message) before calling register; update any tests accordingly
so duplicate bulk bindings surface the same error as single register() calls.
- Around line 61-63: Replace the current class existence check with an
instantiability check: after verifying class_exists($concrete) in the
registration code, instantiate a ReflectionClass for $concrete and call
ReflectionClass::isInstantiable(); if it returns false, throw
DiException::dependencyNotInstantiable($concrete). This ensures abstract classes
or other non-instantiable types are rejected at registration (refer to the
$concrete variable, the registration method where it’s checked,
DiException::dependencyNotInstantiable, and ReflectionClass::isInstantiable).
In `@tests/Unit/Di/DiRegistryTest.php`:
- Around line 49-55: Add a new unit test that covers an existing but
non-instantiable class (e.g., an abstract class) so the registry enforces
dependencyNotInstantiable; create a test method (e.g.,
testAttemptingToRegisterAbstractClass) that defines or references an abstract
class, calls $this->expectException(DiException::class) and
$this->expectExceptionMessage('The dependency `AbstractClass` is not
instantiable.'), then calls $this->registry->register('AbstractClass') to assert
registry->register triggers the same DiException path as the non-existent class
case.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: c9afc147-ad66-4a22-98eb-eb06b44a3411
📒 Files selected for processing (3)
src/Di/DiContainer.phpsrc/Di/DiRegistry.phptests/Unit/Di/DiRegistryTest.php
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Closes #467
Summary by CodeRabbit
Refactor
Tests