Skip to content

Commit

Permalink
Show progress bar sooner
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Oct 12, 2022
1 parent b1b0dc9 commit 8e55dec
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/Command/AnalyseApplication.php
Expand Up @@ -199,16 +199,13 @@ private function runAnalyser(
}

if (!$debug) {
$progressStarted = false;
$preFileCallback = null;
$postFileCallback = static function (int $step) use ($errorOutput, &$progressStarted, $allAnalysedFilesCount, $filesCount): void {
if (!$progressStarted) {
$errorOutput->getStyle()->progressStart($allAnalysedFilesCount);
$errorOutput->getStyle()->progressAdvance($allAnalysedFilesCount - $filesCount);
$progressStarted = true;
}
$postFileCallback = static function (int $step) use ($errorOutput): void {
$errorOutput->getStyle()->progressAdvance($step);
};

$errorOutput->getStyle()->progressStart($allAnalysedFilesCount);
$errorOutput->getStyle()->progressAdvance($allAnalysedFilesCount - $filesCount);
} else {
$startTime = null;
$preFileCallback = static function (string $file) use ($stdOutput, &$startTime): void {
Expand All @@ -232,7 +229,7 @@ private function runAnalyser(

$analyserResult = $this->analyserRunner->runAnalyser($files, $allAnalysedFiles, $preFileCallback, $postFileCallback, $debug, true, $projectConfigFile, null, null, $input);

if (isset($progressStarted) && $progressStarted) {
if (!$debug) {
$errorOutput->getStyle()->progressFinish();
}

Expand Down

0 comments on commit 8e55dec

Please sign in to comment.