浏览代码

Add support for multiple packages defining the same namespace prefix

Jordi Boggiano 13 年之前
父节点
当前提交
5e3c55f171
共有 1 个文件被更改,包括 8 次插入1 次删除
  1. 8 1
      src/Composer/Autoload/ClassLoader.php

+ 8 - 1
src/Composer/Autoload/ClassLoader.php

@@ -54,7 +54,14 @@ class ClassLoader
      */
     public function add($prefix, $paths)
     {
-        $this->prefixes[$prefix] = (array) $paths;
+        if (isset($this->prefixes[$prefix])) {
+            $this->prefixes[$prefix] = array_merge(
+                $this->prefixes[$prefix],
+                (array) $paths
+            );
+        } else {
+            $this->prefixes[$prefix] = (array) $paths;
+        }
     }
 
     /**