diff --git a/lib/Adapter/Composer/ComposerFileToClass.php b/lib/Adapter/Composer/ComposerFileToClass.php index f688627c..9fdb6f10 100644 --- a/lib/Adapter/Composer/ComposerFileToClass.php +++ b/lib/Adapter/Composer/ComposerFileToClass.php @@ -77,11 +77,11 @@ private function populateCandidates(FilePath $filePath, array $prefixes) $pathPrefixes = (array) $pathPrefixes; // remove any relativeness from the paths - // - // TODO: realpath will return void if the path does not exist - // we should not depend on the file path existing. + // we should not depend on the file path existing. $pathPrefixes = array_map(function ($pathPrefix) { - return Path::canonicalize($pathPrefix); + $canonicalizedPath = Path::canonicalize($pathPrefix); + $realPath = realpath($canonicalizedPath); + return $realPath ?: $canonicalizedPath; }, $pathPrefixes); foreach ($pathPrefixes as $pathPrefix) {