-
-
Notifications
You must be signed in to change notification settings - Fork 46
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
Add ability to use container as a factory #354
base: master
Are you sure you want to change the base?
Conversation
xepozz
commented
Feb 13, 2024
Q | A |
---|---|
Is bugfix? | /❌ |
New feature? | ✔️ |
Breaks BC? | ❌ |
Fixed issues | #350 |
PR Summary
|
@@ -35,7 +35,8 @@ final class Container implements ContainerInterface | |||
{ | |||
private const META_TAGS = 'tags'; | |||
private const META_RESET = 'reset'; | |||
private const ALLOWED_META = [self::META_TAGS, self::META_RESET]; | |||
private const META_AFTER_BUILT = 'afterBuilt'; |
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.
Are there any other cases for this hook?
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.
Not now
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #354 +/- ##
===========================================
Coverage 100.00% 100.00%
- Complexity 161 166 +5
===========================================
Files 11 12 +1
Lines 466 479 +13
===========================================
+ Hits 466 479 +13 ☔ View full report in Codecov by Sentry. |
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.
If we know only one case for new hook (use container as factory for defined classes), I suggest don't add hook now. For this case more convient and clear will be use specific meta tag singleton
with boolean value (true
as default).
'singleton' => false
It is better than:
'afterBuilt' => AfterBuiltHook::unsetInstance(),