File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ final class FileExcluder
2929 /**
3030 * Files to exclude from analysing
3131 *
32- * @var string[]
32+ * @var array< string, true>
3333 */
3434 private array $ literalAnalyseFilesExcludes = [];
3535
@@ -63,7 +63,7 @@ public function __construct(
6363 $ this ->fnmatchAnalyseExcludes [] = $ normalized ;
6464 } else {
6565 if (is_file ($ normalized )) {
66- $ this ->literalAnalyseFilesExcludes [] = $ normalized ;
66+ $ this ->literalAnalyseFilesExcludes [$ normalized ] = true ;
6767 } elseif (is_dir ($ normalized )) {
6868 if (!$ trailingDirSeparator ) {
6969 $ normalized .= DIRECTORY_SEPARATOR ;
@@ -86,16 +86,14 @@ public function isExcludedFromAnalysing(string $file): bool
8686 {
8787 $ file = $ this ->fileHelper ->normalizePath ($ file );
8888
89+ if (isset ($ this ->literalAnalyseFilesExcludes [$ file ])) {
90+ return true ;
91+ }
8992 foreach ($ this ->literalAnalyseDirectoryExcludes as $ exclude ) {
9093 if (str_starts_with ($ file , $ exclude )) {
9194 return true ;
9295 }
9396 }
94- foreach ($ this ->literalAnalyseFilesExcludes as $ exclude ) {
95- if ($ file === $ exclude ) {
96- return true ;
97- }
98- }
9997 foreach ($ this ->fnmatchAnalyseExcludes as $ exclude ) {
10098 if (fnmatch ($ exclude , $ file , $ this ->fnmatchFlags )) {
10199 return true ;
You can’t perform that action at this time.
0 commit comments