From cd172588440fc4f40f85084d7cc1dab7efe75513 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Sch=C3=A4dlich?= Date: Fri, 29 Nov 2019 12:14:38 +0100 Subject: [PATCH] [Contracts] Return the service directly in case it is not a callable --- src/Symfony/Contracts/Service/ServiceLocatorTrait.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Symfony/Contracts/Service/ServiceLocatorTrait.php b/src/Symfony/Contracts/Service/ServiceLocatorTrait.php index 4ec6eb4276cf1..085f9bf1358e6 100644 --- a/src/Symfony/Contracts/Service/ServiceLocatorTrait.php +++ b/src/Symfony/Contracts/Service/ServiceLocatorTrait.php @@ -63,6 +63,10 @@ public function get($id) $this->loading[$id] = $id; try { + if (!\is_callable($this->factories[$id])) { + return $this->factories[$id]; + } + return $this->factories[$id]($this); } finally { unset($this->loading[$id]);