From b17ccbfa0d73f71ed8c11953e9e1e5d3709bf91e Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 30 Jun 2015 13:27:05 +0100 Subject: [PATCH] Avoid invalid warnings when scanning the same file twice, fixes #4195, fixes #4197 --- src/Composer/Autoload/AutoloadGenerator.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Composer/Autoload/AutoloadGenerator.php b/src/Composer/Autoload/AutoloadGenerator.php index 284150135..e8de9cd3f 100644 --- a/src/Composer/Autoload/AutoloadGenerator.php +++ b/src/Composer/Autoload/AutoloadGenerator.php @@ -201,9 +201,9 @@ EOF; $namespaceFilter = $namespace === '' ? null : $namespace; foreach (ClassMapGenerator::createMap($dir, $whitelist, $this->io, $namespaceFilter) as $class => $path) { - $pathCode = $this->getPathCode($filesystem, $basePath, $vendorPath, $path); + $pathCode = $this->getPathCode($filesystem, $basePath, $vendorPath, $path).",\n"; if (!isset($classMap[$class])) { - $classMap[$class] = $pathCode.",\n"; + $classMap[$class] = $pathCode; } elseif ($this->io && $classMap[$class] !== $pathCode && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($classMap[$class].' '.$path, '\\', '/'))) { $this->io->writeError( 'Warning: Ambiguous class resolution, "'.$class.'"'. @@ -218,9 +218,9 @@ EOF; foreach ($autoloads['classmap'] as $dir) { foreach (ClassMapGenerator::createMap($dir, null, $this->io) as $class => $path) { - $pathCode = $this->getPathCode($filesystem, $basePath, $vendorPath, $path); + $pathCode = $this->getPathCode($filesystem, $basePath, $vendorPath, $path).",\n"; if (!isset($classMap[$class])) { - $classMap[$class] = $pathCode.",\n"; + $classMap[$class] = $pathCode; } elseif ($this->io && $classMap[$class] !== $pathCode && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($classMap[$class].' '.$path, '\\', '/'))) { $this->io->writeError( 'Warning: Ambiguous class resolution, "'.$class.'"'.