From 682e39cdbbe94ce81a58ee64a5517ab794071336 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sat, 14 Feb 2026 15:42:08 +0100 Subject: [PATCH 1/4] Prevent duplicate normalization --- src/File/FileFinder.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/File/FileFinder.php b/src/File/FileFinder.php index 451c8b5f44..2ddb6c5c28 100644 --- a/src/File/FileFinder.php +++ b/src/File/FileFinder.php @@ -4,6 +4,7 @@ use Symfony\Component\Finder\Finder; use function array_filter; +use function array_map; use function array_unique; use function array_values; use function file_exists; @@ -34,14 +35,14 @@ public function findFiles(array $paths): FileFinderResult $files = []; foreach ($paths as $path) { if (is_file($path)) { - $files[] = $this->fileHelper->normalizePath($path); + $files[] = $path; } elseif (!file_exists($path)) { throw new PathNotFoundException($path); } else { $finder = new Finder(); $finder->followLinks(); foreach ($finder->files()->name('*.{' . implode(',', $this->fileExtensions) . '}')->in($path) as $fileInfo) { - $files[] = $this->fileHelper->normalizePath($fileInfo->getPathname()); + $files[] = $fileInfo->getPathname(); $onlyFiles = false; } } @@ -51,7 +52,12 @@ public function findFiles(array $paths): FileFinderResult sort($files); - return new FileFinderResult($files, $onlyFiles); + return new FileFinderResult( + array_map(function ($file) { + $this->fileHelper->normalizePath($file); + }, $files), + $onlyFiles, + ); } } From b8fbe89d52c2c83902ad7acfe04edf384dea0a77 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sat, 14 Feb 2026 15:43:30 +0100 Subject: [PATCH 2/4] cs --- src/File/FileFinder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/File/FileFinder.php b/src/File/FileFinder.php index 2ddb6c5c28..f9835e97bd 100644 --- a/src/File/FileFinder.php +++ b/src/File/FileFinder.php @@ -53,7 +53,7 @@ public function findFiles(array $paths): FileFinderResult sort($files); return new FileFinderResult( - array_map(function ($file) { + array_map(function (string $file): string { $this->fileHelper->normalizePath($file); }, $files), $onlyFiles, From 0e6b14b8d43c9f435f97778ad6bf703455fbc85c Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sat, 14 Feb 2026 15:45:09 +0100 Subject: [PATCH 3/4] fix --- src/File/FileFinder.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/File/FileFinder.php b/src/File/FileFinder.php index f9835e97bd..a7530cfffd 100644 --- a/src/File/FileFinder.php +++ b/src/File/FileFinder.php @@ -53,9 +53,7 @@ public function findFiles(array $paths): FileFinderResult sort($files); return new FileFinderResult( - array_map(function (string $file): string { - $this->fileHelper->normalizePath($file); - }, $files), + array_map(fn (string $file): string => $this->fileHelper->normalizePath($file), $files), $onlyFiles, ); } From 066753412014ba01e74d8ffa3c45c1afb5cd5717 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sat, 14 Feb 2026 17:20:25 +0100 Subject: [PATCH 4/4] Update FileFinder.php --- src/File/FileFinder.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/File/FileFinder.php b/src/File/FileFinder.php index a7530cfffd..608135d02a 100644 --- a/src/File/FileFinder.php +++ b/src/File/FileFinder.php @@ -48,12 +48,12 @@ public function findFiles(array $paths): FileFinderResult } } - $files = array_values(array_unique(array_filter($files, fn (string $file): bool => !$this->fileExcluder->isExcludedFromAnalysing($file)))); + $files = array_filter($files, fn (string $file): bool => !$this->fileExcluder->isExcludedFromAnalysing($file)); sort($files); return new FileFinderResult( - array_map(fn (string $file): string => $this->fileHelper->normalizePath($file), $files), + array_values(array_unique(array_map(fn (string $file): string => $this->fileHelper->normalizePath($file), $files))), $onlyFiles, ); }