浏览代码

Fix exclude-from-classmap being ignored when generating on-the-fly class loader, fixes #6503

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

+ 6 - 1
src/Composer/Autoload/AutoloadGenerator.php

@@ -433,9 +433,14 @@ EOF;
         }
 
         if (isset($autoloads['classmap'])) {
+            $blacklist = null;
+            if (!empty($autoloads['exclude-from-classmap'])) {
+                $blacklist = '{(' . implode('|', $autoloads['exclude-from-classmap']) . ')}';
+            }
+
             foreach ($autoloads['classmap'] as $dir) {
                 try {
-                    $loader->addClassMap($this->generateClassMap($dir, null, null, false));
+                    $loader->addClassMap($this->generateClassMap($dir, $blacklist, null, false));
                 } catch (\RuntimeException $e) {
                     $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
                 }