浏览代码

[DependencyInjection] made another speed optimization

Fabien Potencier 15 年之前
父节点
当前提交
ce6f676eb2
共有 1 个文件被更改,包括 7 次插入4 次删除
  1. 7 4
      src/Symfony/Components/DependencyInjection/Dumper/PhpDumper.php

+ 7 - 4
src/Symfony/Components/DependencyInjection/Dumper/PhpDumper.php

@@ -453,14 +453,17 @@ EOF;
     }
     else
     {
-      if ($this->container->hasDefinition($id) || $this->container->hasAlias($id))
+      if ($this->container->hasAlias($id))
       {
-        return sprintf('$this->get%sService()', Container::camelize($id));
+        $id = $this->container->getAlias($id);
       }
-      else
+
+      if ($this->container->hasDefinition($id))
       {
-        return sprintf('$this->getService(\'%s\')', $id);
+        return sprintf('$this->get%sService()', Container::camelize($id));
       }
+
+      return sprintf('$this->getService(\'%s\')', $id);
     }
   }
 }