Skip to content

Commit 8fad6d5

Browse files
committed
Fix composer autoloader project path
1 parent 76464ee commit 8fad6d5

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

bin/phpstan

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,11 @@ use Symfony\Component\Console\Helper\ProgressBar;
9393
}
9494

9595
$autoloadProjectAutoloaderFile = function (string $file) use (&$composerAutoloaderProjectPaths): void {
96-
$path = dirname(__DIR__) . $file;
96+
$path = realpath(dirname(__DIR__) . $file);
97+
if ($path === false) {
98+
return;
99+
}
100+
97101
if (!extension_loaded('phar')) {
98102
if (@is_file($path)) {
99103
$composerAutoloaderProjectPaths[] = dirname($path, 2);
@@ -109,8 +113,8 @@ use Symfony\Component\Console\Helper\ProgressBar;
109113
require_once $path;
110114
}
111115
} else {
112-
$path = dirname($pharPath) . $file;
113-
if (@is_file($path)) {
116+
$path = realpath(dirname($pharPath) . $file);
117+
if ($path !== false && @is_file($path)) {
114118
$composerAutoloaderProjectPaths[] = dirname($path, 2);
115119

116120
require_once $path;

0 commit comments

Comments
 (0)