瀏覽代碼

[EventDispatcher] Minor memory optimization to getListeners()

Jordi Boggiano 14 年之前
父節點
當前提交
9816b6adc3
共有 1 個文件被更改,包括 1 次插入2 次删除
  1. 1 2
      src/Symfony/Component/EventDispatcher/EventDispatcher.php

+ 1 - 2
src/Symfony/Component/EventDispatcher/EventDispatcher.php

@@ -74,7 +74,6 @@ class EventDispatcher implements EventDispatcherInterface
             return $this->sorted[$eventName];
         }
 
-        $sorted = array();
         foreach (array_keys($this->listeners) as $eventName) {
             if (!isset($this->sorted[$eventName])) {
                 $this->sortListeners($eventName);
@@ -85,7 +84,7 @@ class EventDispatcher implements EventDispatcherInterface
             }
         }
 
-        return $sorted;
+        return $this->sorted;
     }
 
     /**