@@ -186,7 +186,7 @@ |
||
186 | 186 | /** |
187 | 187 | * Tries to create new style instance from string. |
188 | 188 | * |
189 | - * @return OutputFormatterStyle|false False if string is not format string |
|
189 | + * @return OutputFormatterStyleInterface|null False if string is not format string |
|
190 | 190 | */ |
191 | 191 | private function createStyleFromString(string $string) |
192 | 192 | { |
@@ -22,6 +22,7 @@ discard block |
||
22 | 22 | * Sets the decorated flag. |
23 | 23 | * |
24 | 24 | * @param bool $decorated Whether to decorate the messages or not |
25 | + * @return void |
|
25 | 26 | */ |
26 | 27 | public function setDecorated($decorated); |
27 | 28 | |
@@ -37,6 +38,7 @@ discard block |
||
37 | 38 | * |
38 | 39 | * @param string $name The style name |
39 | 40 | * @param OutputFormatterStyleInterface $style The style instance |
41 | + * @return void |
|
40 | 42 | */ |
41 | 43 | public function setStyle($name, OutputFormatterStyleInterface $style); |
42 | 44 |
@@ -59,7 +59,7 @@ |
||
59 | 59 | * |
60 | 60 | * @param string|null $foreground The style foreground color name |
61 | 61 | * @param string|null $background The style background color name |
62 | - * @param array $options The style options |
|
62 | + * @param string[] $options The style options |
|
63 | 63 | */ |
64 | 64 | public function __construct(string $foreground = null, string $background = null, array $options = array()) |
65 | 65 | { |
@@ -22,6 +22,7 @@ discard block |
||
22 | 22 | * Sets style foreground color. |
23 | 23 | * |
24 | 24 | * @param string $color The color name |
25 | + * @return void |
|
25 | 26 | */ |
26 | 27 | public function setForeground($color = null); |
27 | 28 | |
@@ -29,6 +30,7 @@ discard block |
||
29 | 30 | * Sets style background color. |
30 | 31 | * |
31 | 32 | * @param string $color The color name |
33 | + * @return void |
|
32 | 34 | */ |
33 | 35 | public function setBackground($color = null); |
34 | 36 | |
@@ -36,6 +38,7 @@ discard block |
||
36 | 38 | * Sets some specific style option. |
37 | 39 | * |
38 | 40 | * @param string $option The option name |
41 | + * @return void |
|
39 | 42 | */ |
40 | 43 | public function setOption($option); |
41 | 44 | |
@@ -43,11 +46,13 @@ discard block |
||
43 | 46 | * Unsets some specific style option. |
44 | 47 | * |
45 | 48 | * @param string $option The option name |
49 | + * @return void |
|
46 | 50 | */ |
47 | 51 | public function unsetOption($option); |
48 | 52 | |
49 | 53 | /** |
50 | 54 | * Sets multiple style options at once. |
55 | + * @return void |
|
51 | 56 | */ |
52 | 57 | public function setOptions(array $options); |
53 | 58 |
@@ -101,6 +101,9 @@ |
||
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
104 | + /** |
|
105 | + * @param integer $memory |
|
106 | + */ |
|
104 | 107 | public static function formatMemory($memory) |
105 | 108 | { |
106 | 109 | if ($memory >= 1024 * 1024 * 1024) { |
@@ -20,6 +20,7 @@ |
||
20 | 20 | { |
21 | 21 | /** |
22 | 22 | * Sets the helper set associated with this helper. |
23 | + * @return void |
|
23 | 24 | */ |
24 | 25 | public function setHelperSet(HelperSet $helperSet = null); |
25 | 26 |
@@ -99,7 +99,7 @@ |
||
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
102 | - * @return Helper[] |
|
102 | + * @return \ArrayIterator |
|
103 | 103 | */ |
104 | 104 | public function getIterator() |
105 | 105 | { |
@@ -107,7 +107,7 @@ |
||
107 | 107 | * @param Process $process The Process |
108 | 108 | * @param callable|null $callback A PHP callable |
109 | 109 | * |
110 | - * @return callable |
|
110 | + * @return \Closure |
|
111 | 111 | */ |
112 | 112 | public function wrapCallback(OutputInterface $output, Process $process, callable $callback = null) |
113 | 113 | { |
@@ -117,7 +117,7 @@ |
||
117 | 117 | |
118 | 118 | $formatter = $this->getHelperSet()->get('debug_formatter'); |
119 | 119 | |
120 | - return function ($type, $buffer) use ($output, $process, $callback, $formatter) { |
|
120 | + return function($type, $buffer) use ($output, $process, $callback, $formatter) { |
|
121 | 121 | $output->write($formatter->progress(spl_object_hash($process), $this->escapeString($buffer), Process::ERR === $type)); |
122 | 122 | |
123 | 123 | if (null !== $callback) { |
@@ -117,7 +117,7 @@ |
||
117 | 117 | |
118 | 118 | $formatter = $this->getHelperSet()->get('debug_formatter'); |
119 | 119 | |
120 | - return function ($type, $buffer) use ($output, $process, $callback, $formatter) { |
|
120 | + return function ($type, $buffer) use ($output, $process, $callback, $formatter){ |
|
121 | 121 | $output->write($formatter->progress(spl_object_hash($process), $this->escapeString($buffer), Process::ERR === $type)); |
122 | 122 | |
123 | 123 | if (null !== $callback) { |
@@ -236,7 +236,7 @@ |
||
236 | 236 | /** |
237 | 237 | * Sets the redraw frequency. |
238 | 238 | * |
239 | - * @param int|float $freq The frequency in steps |
|
239 | + * @param integer $freq The frequency in steps |
|
240 | 240 | */ |
241 | 241 | public function setRedrawFrequency(int $freq) |
242 | 242 | { |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | private static function initPlaceholderFormatters(): array |
421 | 421 | { |
422 | 422 | return array( |
423 | - 'bar' => function (ProgressBar $bar, OutputInterface $output) { |
|
423 | + 'bar' => function(ProgressBar $bar, OutputInterface $output){ |
|
424 | 424 | $completeBars = floor($bar->getMaxSteps() > 0 ? $bar->getProgressPercent() * $bar->getBarWidth() : $bar->getProgress() % $bar->getBarWidth()); |
425 | 425 | $display = str_repeat($bar->getBarCharacter(), $completeBars); |
426 | 426 | if ($completeBars < $bar->getBarWidth()) { |
@@ -430,10 +430,10 @@ discard block |
||
430 | 430 | |
431 | 431 | return $display; |
432 | 432 | }, |
433 | - 'elapsed' => function (ProgressBar $bar) { |
|
433 | + 'elapsed' => function(ProgressBar $bar){ |
|
434 | 434 | return Helper::formatTime(time() - $bar->getStartTime()); |
435 | 435 | }, |
436 | - 'remaining' => function (ProgressBar $bar) { |
|
436 | + 'remaining' => function(ProgressBar $bar){ |
|
437 | 437 | if (!$bar->getMaxSteps()) { |
438 | 438 | throw new LogicException('Unable to display the remaining time if the maximum number of steps is not set.'); |
439 | 439 | } |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | |
447 | 447 | return Helper::formatTime($remaining); |
448 | 448 | }, |
449 | - 'estimated' => function (ProgressBar $bar) { |
|
449 | + 'estimated' => function(ProgressBar $bar){ |
|
450 | 450 | if (!$bar->getMaxSteps()) { |
451 | 451 | throw new LogicException('Unable to display the estimated time if the maximum number of steps is not set.'); |
452 | 452 | } |
@@ -459,16 +459,16 @@ discard block |
||
459 | 459 | |
460 | 460 | return Helper::formatTime($estimated); |
461 | 461 | }, |
462 | - 'memory' => function (ProgressBar $bar) { |
|
462 | + 'memory' => function(ProgressBar $bar){ |
|
463 | 463 | return Helper::formatMemory(memory_get_usage(true)); |
464 | 464 | }, |
465 | - 'current' => function (ProgressBar $bar) { |
|
465 | + 'current' => function(ProgressBar $bar){ |
|
466 | 466 | return str_pad($bar->getProgress(), $bar->getStepWidth(), ' ', STR_PAD_LEFT); |
467 | 467 | }, |
468 | - 'max' => function (ProgressBar $bar) { |
|
468 | + 'max' => function(ProgressBar $bar){ |
|
469 | 469 | return $bar->getMaxSteps(); |
470 | 470 | }, |
471 | - 'percent' => function (ProgressBar $bar) { |
|
471 | + 'percent' => function(ProgressBar $bar){ |
|
472 | 472 | return floor($bar->getProgressPercent() * 100); |
473 | 473 | }, |
474 | 474 | ); |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | private function buildLine(): string |
495 | 495 | { |
496 | 496 | $regex = "{%([a-z\-_]+)(?:\:([^%]+))?%}i"; |
497 | - $callback = function ($matches) { |
|
497 | + $callback = function($matches){ |
|
498 | 498 | if ($formatter = $this::getPlaceholderFormatterDefinition($matches[1])) { |
499 | 499 | $text = \call_user_func($formatter, $this, $this->output); |
500 | 500 | } elseif (isset($this->messages[$matches[1]])) { |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | $line = preg_replace_callback($regex, $callback, $this->format); |
513 | 513 | |
514 | 514 | // gets string length for each sub line with multiline format |
515 | - $linesLength = array_map(function ($subLine) { |
|
515 | + $linesLength = array_map(function($subLine){ |
|
516 | 516 | return Helper::strlenWithoutDecoration($this->output->getFormatter(), rtrim($subLine, "\r")); |
517 | 517 | }, explode("\n", $line)); |
518 | 518 |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | private static function initPlaceholderFormatters(): array |
421 | 421 | { |
422 | 422 | return array( |
423 | - 'bar' => function (ProgressBar $bar, OutputInterface $output) { |
|
423 | + 'bar' => function (ProgressBar $bar, OutputInterface $output){ |
|
424 | 424 | $completeBars = floor($bar->getMaxSteps() > 0 ? $bar->getProgressPercent() * $bar->getBarWidth() : $bar->getProgress() % $bar->getBarWidth()); |
425 | 425 | $display = str_repeat($bar->getBarCharacter(), $completeBars); |
426 | 426 | if ($completeBars < $bar->getBarWidth()) { |
@@ -430,10 +430,10 @@ discard block |
||
430 | 430 | |
431 | 431 | return $display; |
432 | 432 | }, |
433 | - 'elapsed' => function (ProgressBar $bar) { |
|
433 | + 'elapsed' => function (ProgressBar $bar){ |
|
434 | 434 | return Helper::formatTime(time() - $bar->getStartTime()); |
435 | 435 | }, |
436 | - 'remaining' => function (ProgressBar $bar) { |
|
436 | + 'remaining' => function (ProgressBar $bar){ |
|
437 | 437 | if (!$bar->getMaxSteps()) { |
438 | 438 | throw new LogicException('Unable to display the remaining time if the maximum number of steps is not set.'); |
439 | 439 | } |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | |
447 | 447 | return Helper::formatTime($remaining); |
448 | 448 | }, |
449 | - 'estimated' => function (ProgressBar $bar) { |
|
449 | + 'estimated' => function (ProgressBar $bar){ |
|
450 | 450 | if (!$bar->getMaxSteps()) { |
451 | 451 | throw new LogicException('Unable to display the estimated time if the maximum number of steps is not set.'); |
452 | 452 | } |
@@ -459,16 +459,16 @@ discard block |
||
459 | 459 | |
460 | 460 | return Helper::formatTime($estimated); |
461 | 461 | }, |
462 | - 'memory' => function (ProgressBar $bar) { |
|
462 | + 'memory' => function (ProgressBar $bar){ |
|
463 | 463 | return Helper::formatMemory(memory_get_usage(true)); |
464 | 464 | }, |
465 | - 'current' => function (ProgressBar $bar) { |
|
465 | + 'current' => function (ProgressBar $bar){ |
|
466 | 466 | return str_pad($bar->getProgress(), $bar->getStepWidth(), ' ', STR_PAD_LEFT); |
467 | 467 | }, |
468 | - 'max' => function (ProgressBar $bar) { |
|
468 | + 'max' => function (ProgressBar $bar){ |
|
469 | 469 | return $bar->getMaxSteps(); |
470 | 470 | }, |
471 | - 'percent' => function (ProgressBar $bar) { |
|
471 | + 'percent' => function (ProgressBar $bar){ |
|
472 | 472 | return floor($bar->getProgressPercent() * 100); |
473 | 473 | }, |
474 | 474 | ); |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | private function buildLine(): string |
495 | 495 | { |
496 | 496 | $regex = "{%([a-z\-_]+)(?:\:([^%]+))?%}i"; |
497 | - $callback = function ($matches) { |
|
497 | + $callback = function ($matches){ |
|
498 | 498 | if ($formatter = $this::getPlaceholderFormatterDefinition($matches[1])) { |
499 | 499 | $text = \call_user_func($formatter, $this, $this->output); |
500 | 500 | } elseif (isset($this->messages[$matches[1]])) { |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | $line = preg_replace_callback($regex, $callback, $this->format); |
513 | 513 | |
514 | 514 | // gets string length for each sub line with multiline format |
515 | - $linesLength = array_map(function ($subLine) { |
|
515 | + $linesLength = array_map(function ($subLine){ |
|
516 | 516 | return Helper::strlenWithoutDecoration($this->output->getFormatter(), rtrim($subLine, "\r")); |
517 | 517 | }, explode("\n", $line)); |
518 | 518 |