Skip to content

Commit

Permalink
Determine files count early from simple iterator
Browse files Browse the repository at this point in the history
  • Loading branch information
Wirone committed Jan 31, 2024
1 parent 0784477 commit 96354b4
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/Runner/Runner.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public function __construct(
?DirectoryInterface $directory = null
) {
$this->runnerConfig = $runnerConfig;
$this->fileCount = \count($fileIterator ?? []); // Required only for main process (calculating workers count)
$this->fileIterator = $fileIterator;
$this->fixers = $fixers;
$this->differ = $differ;
Expand Down Expand Up @@ -474,10 +475,6 @@ private function getFileIterator(): LintingResultAwareFileIteratorInterface
: $this->fileIterator
);

// In order to determine the amount of required workers, we need to know how many files we need to analyse
$this->fileCount = \count(iterator_to_array($fileIterator));
$fileIterator->rewind(); // Important! Without this 0 files would be analysed

$fileFilterIterator = new FileFilterIterator(
$fileIterator,
$this->eventDispatcher,
Expand Down

0 comments on commit 96354b4

Please sign in to comment.