8000 Micro optimization to reduce array_merge calls by sidz · Pull Request #1883 · infection/infection · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Micro optimization to reduce array_merge calls #1883

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
8000
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions src/FileSystem/SourceFileCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,12 @@ public function collectFiles(
return [];
}

$finder = Finder::create()
->exclude($excludeDirectories)
return Finder::create()
->in($sourceDirectories)
->exclude($excludeDirectories)
->notPath($excludeDirectories)
->files()
->name('*.php')
;

foreach ($excludeDirectories as $excludeDirectory) {
$finder->notPath($excludeDirectory);
}

return $finder;
}
}
11 changes: 11 additions & 0 deletions tests/phpunit/FileSystem/SourceFileCollectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,17 @@ public function sourceFilesProvider(): iterable
'case1/sub-dir/b.php',
],
];

yield 'one directory, no filter, one common excludes and one file exclude' => [
[self::FIXTURES . '/case0'],
[
'sub-dir',
'a.php',
],
[
'case0/outside-symlink.php',
],
];
}

/**
Expand Down
0