Browse Source

Avoid invalid warnings when scanning the same file twice, fixes #4195, fixes #4197

Jordi Boggiano 9 years ago
parent
commit
b17ccbfa0d
1 changed files with 4 additions and 4 deletions
  1. 4 4
      src/Composer/Autoload/AutoloadGenerator.php

+ 4 - 4
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>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>Warning: Ambiguous class resolution, "'.$class.'"'.