Skip to content

Commit

Permalink
match -> switch
Browse files Browse the repository at this point in the history
  • Loading branch information
janedbal committed Dec 14, 2022
1 parent 2bfe7ed commit f706989
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions src/Command/ErrorsConsoleStyle.php
Expand Up @@ -143,13 +143,22 @@ public function createProgressBar(int $max = 0): ProgressBar

private function getProgressBarFormat(): ?string
{
$formatName = match ($this->getVerbosity()) {
OutputInterface::VERBOSITY_NORMAL => ProgressBar::FORMAT_NORMAL,
OutputInterface::VERBOSITY_VERBOSE => ProgressBar::FORMAT_VERBOSE,
OutputInterface::VERBOSITY_VERY_VERBOSE,
OutputInterface::VERBOSITY_DEBUG => ProgressBar::FORMAT_VERY_VERBOSE, // FORMAT_DEBUG shows invalid memory, avoid that
default => null,
};
switch ($this->getVerbosity()) {
case OutputInterface::VERBOSITY_NORMAL:
$formatName = ProgressBar::FORMAT_NORMAL;
break;
case OutputInterface::VERBOSITY_VERBOSE:
$formatName = ProgressBar::FORMAT_VERBOSE;
break;
case OutputInterface::VERBOSITY_VERY_VERBOSE:
case OutputInterface::VERBOSITY_DEBUG:
$formatName = ProgressBar::FORMAT_VERY_VERBOSE;
break;
default:
$formatName = null;
break;
}

if ($formatName === null) {
return null;
}
Expand Down

0 comments on commit f706989

Please sign in to comment.