Преглед изворни кода

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;
+        }
     }
 
     /**