Просмотр исходного кода

Making prepend work with fallbacks & coding standards

Joe Holdcroft 12 лет назад
Родитель
Сommit
538cdc914b
1 измененных файлов с 6 добавлено и 3 удалено
  1. 6 3
      src/Composer/Autoload/ClassLoader.php

+ 6 - 3
src/Composer/Autoload/ClassLoader.php

@@ -85,7 +85,11 @@ class ClassLoader
     {
         if (!$prefix) {
             foreach ((array) $paths as $path) {
-                $this->fallbackDirs[] = $path;
+                if ($prepend) {
+                    array_unshift($this->fallbackDirs, $path);
+                } else {
+                    $this->fallbackDirs[] = $path;
+                }
             }
 
             return;
@@ -100,8 +104,7 @@ class ClassLoader
                 (array) $paths,
                 $this->prefixes[$prefix]
             );
-        }
-        else {
+        } else {
             $this->prefixes[$prefix] = array_merge(
                 $this->prefixes[$prefix],
                 (array) $paths