1
0
Fork 0

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

pull/4172/head
Jordi Boggiano 2015-06-30 13:27:05 +01:00
parent 05c4911f6c
commit b17ccbfa0d
1 changed files with 4 additions and 4 deletions

View File

@ -201,9 +201,9 @@ EOF;
$namespaceFilter = $namespace === '' ? null : $namespace; $namespaceFilter = $namespace === '' ? null : $namespace;
foreach (ClassMapGenerator::createMap($dir, $whitelist, $this->io, $namespaceFilter) as $class => $path) { 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])) { 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, '\\', '/'))) { } elseif ($this->io && $classMap[$class] !== $pathCode && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($classMap[$class].' '.$path, '\\', '/'))) {
$this->io->writeError( $this->io->writeError(
'<warning>Warning: Ambiguous class resolution, "'.$class.'"'. '<warning>Warning: Ambiguous class resolution, "'.$class.'"'.
@ -218,9 +218,9 @@ EOF;
foreach ($autoloads['classmap'] as $dir) { foreach ($autoloads['classmap'] as $dir) {
foreach (ClassMapGenerator::createMap($dir, null, $this->io) as $class => $path) { 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])) { 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, '\\', '/'))) { } elseif ($this->io && $classMap[$class] !== $pathCode && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($classMap[$class].' '.$path, '\\', '/'))) {
$this->io->writeError( $this->io->writeError(
'<warning>Warning: Ambiguous class resolution, "'.$class.'"'. '<warning>Warning: Ambiguous class resolution, "'.$class.'"'.