You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bug #19708 [DI] Dont use Container::get() when fetching private services internally (nicolas-grekas)
This PR was merged into the 3.2-dev branch.
Discussion
----------
[DI] Dont use Container::get() when fetching private services internally
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #19683, #19682, #19680
| License | MIT
As spotted by @wouterj, we forgot to remove the deprecation notice when doing internal calls to get private services.
Yet, we don't need to get through this `get()` method, because we can already resolve many things at compile time for private services. This will provide another small performance optim, and fix the issue.
Commits
-------
a9c79fb [DI] Dont use Container::get() when fetching private services internally
Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Container.php
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -181,6 +181,7 @@ public function set($id, $service)
181
181
if (isset($this->privates[$id])) {
182
182
if (null === $service) {
183
183
@trigger_error(sprintf('Unsetting the "%s" private service is deprecated since Symfony 3.2 and won\'t be supported anymore in Symfony 4.0.', $id), E_USER_DEPRECATED);
184
+
unset($this->privates[$id]);
184
185
} else {
185
186
@trigger_error(sprintf('Setting the "%s" private service is deprecated since Symfony 3.2 and won\'t be supported anymore in Symfony 4.0. A new public service will be created instead.', $id), E_USER_DEPRECATED);
0 commit comments