diff --git a/src/ClassMap.php b/src/ClassMap.php index 797efc6..307adbb 100644 --- a/src/ClassMap.php +++ b/src/ClassMap.php @@ -12,12 +12,15 @@ namespace Composer\ClassMapGenerator; +use Countable; +use InvalidArgumentException; +use OutOfBoundsException; use Composer\Pcre\Preg; /** * @author Jordi Boggiano */ -class ClassMap implements \Countable +class ClassMap implements Countable { /** * @var array @@ -89,15 +92,15 @@ public function getAmbiguousClasses($duplicatesFilter = '{/(test|fixture|example } if (true === $duplicatesFilter) { - throw new \InvalidArgumentException('$duplicatesFilter should be false or a string with a valid regex, got true.'); + throw new InvalidArgumentException('$duplicatesFilter should be false or a string with a valid regex, got true.'); } $ambiguousClasses = []; foreach ($this->ambiguousClasses as $class => $paths) { - $paths = array_filter($paths, function ($path) use ($duplicatesFilter) { + $paths = array_filter($paths, function ($path) use ($duplicatesFilter): bool { return !Preg::isMatch($duplicatesFilter, strtr($path, '\\', '/')); }); - if (\count($paths) > 0) { + if ($paths !== []) { $ambiguousClasses[$class] = array_values($paths); } } @@ -131,7 +134,7 @@ public function addClass(string $className, string $path): void public function getClassPath(string $className): string { if (!isset($this->map[$className])) { - throw new \OutOfBoundsException('Class '.$className.' is not present in the map'); + throw new OutOfBoundsException('Class '.$className.' is not present in the map'); } return $this->map[$className];