Skip to content

Commit 580d5f2

Browse files
committed
Fix DefaultStubFilesProvider
1 parent bc20ce4 commit 580d5f2

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/PhpDoc/DefaultStubFilesProvider.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use PHPStan\File\FileHelper;
99
use PHPStan\Internal\ComposerHelper;
1010
use function array_filter;
11+
use function array_map;
1112
use function array_values;
1213
use function str_contains;
1314

@@ -42,7 +43,7 @@ public function getStubFiles(): array
4243
return $this->cachedFiles;
4344
}
4445

45-
$files = $this->stubFiles;
46+
$files = array_map(fn ($path) => $this->fileHelper->normalizePath($path), $this->stubFiles);
4647
$extensions = $this->container->getServicesByTag(StubFilesExtension::EXTENSION_TAG);
4748
foreach ($extensions as $extension) {
4849
foreach ($extension->getFiles() as $extensionFile) {

tests/PHPStan/PhpDoc/DefaultStubFilesProviderTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ public function testGetProjectStubFilesWhenPathContainsWindowsSeparator(): void
4343
$projectStubFiles = $defaultStubFilesProvider->getProjectStubFiles();
4444
$this->assertContains('/projectStub.stub', $projectStubFiles);
4545
$this->assertNotContains($thirdPartyStubFile, $projectStubFiles);
46+
47+
$fileHelper = new FileHelper(__DIR__);
48+
$this->assertNotContains($fileHelper->normalizePath($thirdPartyStubFile), $projectStubFiles);
4649
}
4750

4851
/**

0 commit comments

Comments
 (0)