Skip to content

Commit

Permalink
Merge pull request #10748 from weirdan/10747-fix-loading-stubs-from-p…
Browse files Browse the repository at this point in the history
…har-on-windows

Fix loading stubs from phar file on Windows
  • Loading branch information
weirdan committed Feb 25, 2024
2 parents eb9e8d9 + 01dc2fe commit 71707e6
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 71707e6

Please sign in to comment.