diff --git a/src/Symfony/Component/DependencyInjection/Container.php b/src/Symfony/Component/DependencyInjection/Container.php index e17c1caa95..b731a70bc9 100644 --- a/src/Symfony/Component/DependencyInjection/Container.php +++ b/src/Symfony/Component/DependencyInjection/Container.php @@ -404,9 +404,7 @@ class Container implements ResettableContainerInterface $this->set($id, new ServiceLocator([])); } if (!$this->getEnv) { - $this->getEnv = new \ReflectionMethod($this, __FUNCTION__); - $this->getEnv->setAccessible(true); - $this->getEnv = $this->getEnv->getClosure($this); + $this->getEnv = \Closure::fromCallable([$this, 'getEnv']); } $processors = $this->get($id);