Forráskód Böngészése

Ignore ambiguous classes in tests/fixtures dirs, fixes #2858

Jordi Boggiano 11 éve
szülő
commit
8974a1ac92

+ 1 - 1
src/Composer/Autoload/ClassMapGenerator.php

@@ -84,7 +84,7 @@ class ClassMapGenerator
             foreach ($classes as $class) {
                 if (!isset($map[$class])) {
                     $map[$class] = $filePath;
-                } elseif ($io && $map[$class] !== $filePath) {
+                } elseif ($io && $map[$class] !== $filePath && preg_match('{/(test|fixture)s?/}i', strtr($map[$class].' '.$filePath, '\\', '/'))) {
                     $io->write(
                         '<warning>Warning: Ambiguous class resolution, "'.$class.'"'.
                         ' was found in both "'.$map[$class].'" and "'.$filePath.'", the first will be used.</warning>'

+ 1 - 0
tests/Composer/Test/Autoload/ClassMapGeneratorTest.php

@@ -102,6 +102,7 @@ class ClassMapGeneratorTest extends \PHPUnit_Framework_TestCase
 
         $find->invoke(null, __DIR__.'/no-file');
     }
+
     public function testAmbiguousReference()
     {
         $this->checkIfFinderIsAvailable();