Skip to content

Commit 43c60cd

Browse files
JanTvrdikdg
authored andcommitted
Container: optimized getService() performance
1 parent 9fd6133 commit 43c60cd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/DI/Container.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,10 @@ public function removeService($name)
9898
*/
9999
public function getService($name)
100100
{
101-
$name = isset($this->meta[self::ALIASES][$name]) ? $this->meta[self::ALIASES][$name] : $name;
102101
if (!isset($this->registry[$name])) {
102+
if (isset($this->meta[self::ALIASES][$name])) {
103+
return $this->getService($this->meta[self::ALIASES][$name]);
104+
}
103105
$this->registry[$name] = $this->createService($name);
104106
}
105107
return $this->registry[$name];

0 commit comments

Comments
 (0)