Browse Source

Merge pull request #489 from Taluu/master

[ClassLoader] Optimization: condition that do not belong in a loop
Nils Adermann 13 năm trước cách đây
mục cha
commit
b2a2601e50
1 tập tin đã thay đổi với 3 bổ sung3 xóa
  1. 3 3
      src/Composer/Autoload/ClassLoader.php

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

@@ -180,9 +180,9 @@ class ClassLoader
 
         $classPath .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
 
-        foreach ($this->prefixes as $prefix => $dirs) {
-            foreach ($dirs as $dir) {
-                if (0 === strpos($class, $prefix)) {
+        foreach ($this->prefixes as $prefix => $dirs) {    
+            if (0 === strpos($class, $prefix)) {
+                foreach ($dirs as $dir) {
                     if (file_exists($dir . DIRECTORY_SEPARATOR . $classPath)) {
                         return $dir . DIRECTORY_SEPARATOR . $classPath;
                     }