Skip to content

Commit a321b29

Browse files
committed
Fix FileExcluder on windows
underlying problem was ``` <?php var_dump(fnmatch( 'C:\dvl\Workspace\phpstan-src-staabm\tests\PHPStan\File\*', 'C:\dvl\Workspace\phpstan-src-staabm\tests\PHPStan\File/data/excluded-file.php', FNM_NOESCAPE | FNM_CASEFOLD )); var_dump(fnmatch( 'C:\dvl\Workspace\phpstan-src-staabm\tests\PHPStan\File\*', 'C:\dvl\Workspace\phpstan-src-staabm\tests\PHPStan\File\data\excluded-file.php', FNM_NOESCAPE | FNM_CASEFOLD )); ```
1 parent f0b3d52 commit a321b29

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/File/FileExcluder.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ final class FileExcluder
5050
* @param string[] $analyseExcludes
5151
*/
5252
public function __construct(
53-
FileHelper $fileHelper,
53+
private FileHelper $fileHelper,
5454
array $analyseExcludes,
5555
)
5656
{
@@ -89,6 +89,8 @@ public function __construct(
8989

9090
public function isExcludedFromAnalysing(string $file): bool
9191
{
92+
$file = $this->fileHelper->normalizePath($file);
93+
9294
foreach ($this->literalAnalyseExcludes as $exclude) {
9395
if (str_starts_with($file, $exclude)) {
9496
return true;

0 commit comments

Comments
 (0)