From 836534067bc4841e2ae715355e95caa496e55de6 Mon Sep 17 00:00:00 2001 From: Denis Sokolov Date: Thu, 10 Apr 2014 13:15:35 +0200 Subject: [PATCH] Avoid ambiguity warning for example directories as well In particular, PEAR repositories use a classmap and example directories trigger multiple false positive warnings. --- src/Composer/Autoload/ClassMapGenerator.php | 2 +- tests/Composer/Test/Autoload/ClassMapGeneratorTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Composer/Autoload/ClassMapGenerator.php b/src/Composer/Autoload/ClassMapGenerator.php index 2cdb920a8..e7547cb04 100644 --- a/src/Composer/Autoload/ClassMapGenerator.php +++ b/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 && !preg_match('{/(test|fixture)s?/}i', strtr($map[$class].' '.$filePath, '\\', '/'))) { + } elseif ($io && $map[$class] !== $filePath && !preg_match('{/(test|fixture|example)s?/}i', strtr($map[$class].' '.$filePath, '\\', '/'))) { $io->write( 'Warning: Ambiguous class resolution, "'.$class.'"'. ' was found in both "'.$map[$class].'" and "'.$filePath.'", the first will be used.' diff --git a/tests/Composer/Test/Autoload/ClassMapGeneratorTest.php b/tests/Composer/Test/Autoload/ClassMapGeneratorTest.php index 5ca42880e..1ef68d459 100644 --- a/tests/Composer/Test/Autoload/ClassMapGeneratorTest.php +++ b/tests/Composer/Test/Autoload/ClassMapGeneratorTest.php @@ -170,7 +170,7 @@ class ClassMapGeneratorTest extends \PHPUnit_Framework_TestCase " ); - foreach (array('test', 'fixture') as $keyword) { + foreach (array('test', 'fixture', 'example') as $keyword) { if (!is_dir($tempDir.'/'.$keyword)) { mkdir($tempDir.'/'.$keyword, 0777, true); }