Skip to content

Commit 3051c6c

Browse files
committed
Add FORMAT_ to const names.
1 parent 69406e5 commit 3051c6c

File tree

2 files changed

+27
-27
lines changed

2 files changed

+27
-27
lines changed

src/Symfony/Component/Console/Helper/ProgressBar.php

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@
2626
*/
2727
final class ProgressBar
2828
{
29-
public const VERBOSE = 'verbose';
30-
public const VERY_VERBOSE = 'very_verbose';
31-
public const DEBUG = 'debug';
32-
public const NORMAL = 'normal';
29+
public const FORMAT_VERBOSE = 'verbose';
30+
public const FORMAT_VERY_VERBOSE = 'very_verbose';
31+
public const FORMAT_DEBUG = 'debug';
32+
public const FORMAT_NORMAL = 'normal';
3333

34-
private const VERBOSE_NOMAX = 'verbose_nomax';
35-
private const VERY_VERBOSE_NOMAX = 'very_verbose_nomax';
36-
private const DEBUG_NOMAX = 'debug_nomax';
37-
private const NORMAL_NOMAX = 'normal_nomax';
38-
private const NOMAX_SUFIX = '_nomax';
34+
private const FORMAT_VERBOSE_NOMAX = 'verbose_nomax';
35+
private const FORMAT_VERY_VERBOSE_NOMAX = 'very_verbose_nomax';
36+
private const FORMAT_DEBUG_NOMAX = 'debug_nomax';
37+
private const FORMAT_NORMAL_NOMAX = 'normal_nomax';
38+
private const FORMAT_NOMAX_SUFIX = '_nomax';
3939

4040
private $barWidth = 28;
4141
private $barChar;
@@ -448,8 +448,8 @@ public function clear(): void
448448
private function setRealFormat(string $format)
449449
{
450450
// try to use the _nomax variant if available
451-
if (!$this->max && null !== self::getFormatDefinition($format.self::NOMAX_SUFIX)) {
452-
$this->format = self::getFormatDefinition($format.self::NOMAX_SUFIX);
451+
if (!$this->max && null !== self::getFormatDefinition($format.self::FORMAT_NOMAX_SUFIX)) {
452+
$this->format = self::getFormatDefinition($format.self::FORMAT_NOMAX_SUFIX);
453453
} elseif (null !== self::getFormatDefinition($format)) {
454454
$this->format = self::getFormatDefinition($format);
455455
} else {
@@ -500,13 +500,13 @@ private function determineBestFormat(): string
500500
switch ($this->output->getVerbosity()) {
501501
// OutputInterface::VERBOSITY_QUIET: display is disabled anyway
502502
case OutputInterface::VERBOSITY_VERBOSE:
503-
return $this->max ? self::VERBOSE : self::VERBOSE_NOMAX;
503+
return $this->max ? self::FORMAT_VERBOSE : self::FORMAT_VERBOSE_NOMAX;
504504
case OutputInterface::VERBOSITY_VERY_VERBOSE:
505-
return $this->max ? self::VERY_VERBOSE : self::VERY_VERBOSE_NOMAX;
505+
return $this->max ? self::FORMAT_VERY_VERBOSE : self::FORMAT_VERY_VERBOSE_NOMAX;
506506
case OutputInterface::VERBOSITY_DEBUG:
507-
return $this->max ? self::DEBUG : self::DEBUG_NOMAX;
507+
return $this->max ? self::FORMAT_DEBUG : self::FORMAT_DEBUG_NOMAX;
508508
default:
509-
return $this->max ? self::NORMAL : self::NORMAL_NOMAX;
509+
return $this->max ? self::FORMAT_NORMAL : self::FORMAT_NORMAL_NOMAX;
510510
}
511511
}
512512

@@ -558,17 +558,17 @@ private static function initPlaceholderFormatters(): array
558558
private static function initFormats(): array
559559
{
560560
return [
561-
self::NORMAL => ' %current%/%max% [%bar%] %percent:3s%%',
562-
self::NORMAL_NOMAX => ' %current% [%bar%]',
561+
self::FORMAT_NORMAL => ' %current%/%max% [%bar%] %percent:3s%%',
562+
self::FORMAT_NORMAL_NOMAX => ' %current% [%bar%]',
563563

564-
self::VERBOSE => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%',
565-
self::VERBOSE_NOMAX => ' %current% [%bar%] %elapsed:6s%',
564+
self::FORMAT_VERBOSE => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%',
565+
self::FORMAT_VERBOSE_NOMAX => ' %current% [%bar%] %elapsed:6s%',
566566

567-
self::VERY_VERBOSE => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s%',
568-
self::VERY_VERBOSE_NOMAX => ' %current% [%bar%] %elapsed:6s%',
567+
self::FORMAT_VERY_VERBOSE => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s%',
568+
self::FORMAT_VERY_VERBOSE_NOMAX => ' %current% [%bar%] %elapsed:6s%',
569569

570-
self::DEBUG => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%',
571-
self::DEBUG_NOMAX => ' %current% [%bar%] %elapsed:6s% %memory:6s%',
570+
self::FORMAT_DEBUG => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%',
571+
self::FORMAT_DEBUG_NOMAX => ' %current% [%bar%] %elapsed:6s% %memory:6s%',
572572
];
573573
}
574574

src/Symfony/Component/Console/Tests/Helper/ProgressBarTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ public function testFormat()
210210

211211
// max in construct, explicit format before
212212
$bar = new ProgressBar($output = $this->getOutputStream(), 10, 0);
213-
$bar->setFormat(ProgressBar::NORMAL);
213+
$bar->setFormat(ProgressBar::FORMAT_NORMAL);
214214
$bar->start();
215215
$bar->advance(10);
216216
$bar->finish();
@@ -220,7 +220,7 @@ public function testFormat()
220220

221221
// max in start, explicit format before
222222
$bar = new ProgressBar($output = $this->getOutputStream(), 0, 0);
223-
$bar->setFormat(ProgressBar::NORMAL);
223+
$bar->setFormat(ProgressBar::FORMAT_NORMAL);
224224
$bar->start(10);
225225
$bar->advance(10);
226226
$bar->finish();
@@ -828,7 +828,7 @@ public function testAnsiColorsAndEmojis()
828828
public function testSetFormat()
829829
{
830830
$bar = new ProgressBar($output = $this->getOutputStream(), 0, 0);
831-
$bar->setFormat(ProgressBar::NORMAL);
831+
$bar->setFormat(ProgressBar::FORMAT_NORMAL);
832832
$bar->start();
833833
rewind($output->getStream());
834834
$this->assertEquals(
@@ -837,7 +837,7 @@ public function testSetFormat()
837837
);
838838

839839
$bar = new ProgressBar($output = $this->getOutputStream(), 10, 0);
840-
$bar->setFormat(ProgressBar::NORMAL);
840+
$bar->setFormat(ProgressBar::FORMAT_NORMAL);
841841
$bar->start();
842842
rewind($output->getStream());
843843
$this->assertEquals(

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy