Skip to content

Commit

Permalink
Fix loading stubs from phar file on Windows
Browse files Browse the repository at this point in the history
Fixes #10747
  • Loading branch information
weirdan committed Feb 25, 2024
1 parent 6c10ad2 commit 01dc2fe
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Psalm/Config.php
Expand Up @@ -2326,6 +2326,10 @@ public function visitPreloadedStubFiles(Codebase $codebase, ?Progress $progress

foreach ($stub_files as $file_path) {
$file_path = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $file_path);
// fix mangled phar paths on Windows
if (strpos($file_path, 'phar:\\\\') === 0) {
$file_path = 'phar://'. substr($file_path, 7);
}
$codebase->scanner->addFileToDeepScan($file_path);
}

Expand Down Expand Up @@ -2423,6 +2427,10 @@ public function visitStubFiles(Codebase $codebase, ?Progress $progress = null):

foreach ($stub_files as $file_path) {
$file_path = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $file_path);
// fix mangled phar paths on Windows
if (strpos($file_path, 'phar:\\\\') === 0) {
$file_path = 'phar://' . substr($file_path, 7);
}
$codebase->scanner->addFileToDeepScan($file_path);
}

Expand Down

0 comments on commit 01dc2fe

Please sign in to comment.