-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DI] Remove useless state from ServiceLocator #22029
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
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.
👍
5a8263e
to
e0a5eec
Compare
@@ -53,13 +52,12 @@ public function get($id) | |||
throw new ServiceCircularReferenceException($id, array($id, $id)); |
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.
Do we really need to cover this? The ServiceLocator is not passed to the factories so it is very unlikely to happen.
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.
Why should we remove the safe guard? Symfony is used into the wild, it needs to handle properly any situations. I see no reason to trade a few lines vs a fatal error, however rare it is.
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.
Ok, just asking, fine for me as is then.
👍 Status: Reviewed |
@@ -40,15 +40,20 @@ public function testGet() | |||
$this->assertSame('baz', $locator->get('bar')); | |||
} | |||
|
|||
public function testGetDoesNotExecuteTheSameCallableTwice() | |||
public function testGetDoesNotMemoize() |
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.
Memoize => Memorize
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 a typo :)
https://en.wikipedia.org/wiki/Memoization
apart from the typo 👍 |
Thank you @nicolas-grekas. |
…rekas) This PR was merged into the 3.3-dev branch. Discussion ---------- [DI] Remove useless state from ServiceLocator | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no (master only) | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - One less state to manage for the engine, and allows to deal with non-shared services. Commits ------- e0a5eec [DI] Remove useless state from ServiceLocator
One less state to manage for the engine, and allows to deal with non-shared services.