From 1d9b1af4a396b10bd56982a9e9e4d16604f780b2 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 24 May 2017 16:35:51 +0200 Subject: [PATCH] [DI] Check privates before aliases consistently --- src/Symfony/Component/DependencyInjection/Container.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/Container.php b/src/Symfony/Component/DependencyInjection/Container.php index 119fb432a3..2f96abca34 100644 --- a/src/Symfony/Component/DependencyInjection/Container.php +++ b/src/Symfony/Component/DependencyInjection/Container.php @@ -256,15 +256,15 @@ class Container implements ResettableContainerInterface // this method can be called thousands of times during a request, avoid // calling strtolower() unless necessary. for ($i = 2;;) { + if (isset($this->privates[$id])) { + @trigger_error(sprintf('Requesting the "%s" private service is deprecated since Symfony 3.2 and won\'t be supported anymore in Symfony 4.0.', $id), E_USER_DEPRECATED); + } if ('service_container' === $id) { return $this; } if (isset($this->aliases[$id])) { $id = $this->aliases[$id]; } - if (isset($this->privates[$id])) { - @trigger_error(sprintf('Requesting the "%s" private service is deprecated since Symfony 3.2 and won\'t be supported anymore in Symfony 4.0.', $id), E_USER_DEPRECATED); - } // Re-use shared service instance if it exists. if (isset($this->services[$id])) {