@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | return $this->doAsk($output, $question); |
82 | 82 | } |
83 | 83 | |
84 | - $interviewer = function () use ($output, $question) { |
|
84 | + $interviewer = function() use ($output, $question) { |
|
85 | 85 | return $this->doAsk($output, $question); |
86 | 86 | }; |
87 | 87 | |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | |
287 | 287 | $matches = array_filter( |
288 | 288 | $autocomplete($ret), |
289 | - function ($match) use ($ret) { |
|
289 | + function($match) use ($ret) { |
|
290 | 290 | return '' === $ret || 0 === strpos($match, $ret); |
291 | 291 | } |
292 | 292 | ); |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | private static function initPlaceholderFormatters(): array |
483 | 483 | { |
484 | 484 | return [ |
485 | - 'bar' => function (self $bar, OutputInterface $output) { |
|
485 | + 'bar' => function(self $bar, OutputInterface $output) { |
|
486 | 486 | $completeBars = $bar->getBarOffset(); |
487 | 487 | $display = str_repeat($bar->getBarCharacter(), $completeBars); |
488 | 488 | if ($completeBars < $bar->getBarWidth()) { |
@@ -492,10 +492,10 @@ discard block |
||
492 | 492 | |
493 | 493 | return $display; |
494 | 494 | }, |
495 | - 'elapsed' => function (self $bar) { |
|
495 | + 'elapsed' => function(self $bar) { |
|
496 | 496 | return Helper::formatTime(time() - $bar->getStartTime()); |
497 | 497 | }, |
498 | - 'remaining' => function (self $bar) { |
|
498 | + 'remaining' => function(self $bar) { |
|
499 | 499 | if (!$bar->getMaxSteps()) { |
500 | 500 | throw new LogicException('Unable to display the remaining time if the maximum number of steps is not set.'); |
501 | 501 | } |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | |
509 | 509 | return Helper::formatTime($remaining); |
510 | 510 | }, |
511 | - 'estimated' => function (self $bar) { |
|
511 | + 'estimated' => function(self $bar) { |
|
512 | 512 | if (!$bar->getMaxSteps()) { |
513 | 513 | throw new LogicException('Unable to display the estimated time if the maximum number of steps is not set.'); |
514 | 514 | } |
@@ -521,16 +521,16 @@ discard block |
||
521 | 521 | |
522 | 522 | return Helper::formatTime($estimated); |
523 | 523 | }, |
524 | - 'memory' => function (self $bar) { |
|
524 | + 'memory' => function(self $bar) { |
|
525 | 525 | return Helper::formatMemory(memory_get_usage(true)); |
526 | 526 | }, |
527 | - 'current' => function (self $bar) { |
|
527 | + 'current' => function(self $bar) { |
|
528 | 528 | return str_pad($bar->getProgress(), $bar->getStepWidth(), ' ', STR_PAD_LEFT); |
529 | 529 | }, |
530 | - 'max' => function (self $bar) { |
|
530 | + 'max' => function(self $bar) { |
|
531 | 531 | return $bar->getMaxSteps(); |
532 | 532 | }, |
533 | - 'percent' => function (self $bar) { |
|
533 | + 'percent' => function(self $bar) { |
|
534 | 534 | return floor($bar->getProgressPercent() * 100); |
535 | 535 | }, |
536 | 536 | ]; |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | private function buildLine(): string |
557 | 557 | { |
558 | 558 | $regex = "{%([a-z\-_]+)(?:\:([^%]+))?%}i"; |
559 | - $callback = function ($matches) { |
|
559 | + $callback = function($matches) { |
|
560 | 560 | if ($formatter = $this::getPlaceholderFormatterDefinition($matches[1])) { |
561 | 561 | $text = $formatter($this, $this->output); |
562 | 562 | } elseif (isset($this->messages[$matches[1]])) { |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | $line = preg_replace_callback($regex, $callback, $this->format); |
575 | 575 | |
576 | 576 | // gets string length for each sub line with multiline format |
577 | - $linesLength = array_map(function ($subLine) { |
|
577 | + $linesLength = array_map(function($subLine) { |
|
578 | 578 | return Helper::strlenWithoutDecoration($this->output->getFormatter(), rtrim($subLine, "\r")); |
579 | 579 | }, explode("\n", $line)); |
580 | 580 |
@@ -33,14 +33,14 @@ |
||
33 | 33 | $this->cloner = $cloner; |
34 | 34 | |
35 | 35 | if (class_exists(CliDumper::class)) { |
36 | - $this->handler = function ($var): string { |
|
36 | + $this->handler = function($var): string { |
|
37 | 37 | $dumper = $this->dumper ?? $this->dumper = new CliDumper(null, null, CliDumper::DUMP_LIGHT_ARRAY | CliDumper::DUMP_COMMA_SEPARATOR); |
38 | 38 | $dumper->setColors($this->output->isDecorated()); |
39 | 39 | |
40 | 40 | return rtrim($dumper->dump(($this->cloner ?? $this->cloner = new VarCloner())->cloneVar($var)->withRefHandles(false), true)); |
41 | 41 | }; |
42 | 42 | } else { |
43 | - $this->handler = function ($var): string { |
|
43 | + $this->handler = function($var): string { |
|
44 | 44 | switch (true) { |
45 | 45 | case null === $var: |
46 | 46 | return 'null'; |
@@ -120,7 +120,7 @@ |
||
120 | 120 | |
121 | 121 | $formatter = $this->getHelperSet()->get('debug_formatter'); |
122 | 122 | |
123 | - return function ($type, $buffer) use ($output, $process, $callback, $formatter) { |
|
123 | + return function($type, $buffer) use ($output, $process, $callback, $formatter) { |
|
124 | 124 | $output->write($formatter->progress(spl_object_hash($process), $this->escapeString($buffer), Process::ERR === $type)); |
125 | 125 | |
126 | 126 | if (null !== $callback) { |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | return; |
180 | 180 | } |
181 | 181 | |
182 | - $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) { |
|
182 | + $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function($matches) { |
|
183 | 183 | if ($formatter = self::getPlaceholderFormatterDefinition($matches[1])) { |
184 | 184 | return $formatter($this); |
185 | 185 | } |
@@ -223,16 +223,16 @@ discard block |
||
223 | 223 | private static function initPlaceholderFormatters(): array |
224 | 224 | { |
225 | 225 | return [ |
226 | - 'indicator' => function (self $indicator) { |
|
226 | + 'indicator' => function(self $indicator) { |
|
227 | 227 | return $indicator->indicatorValues[$indicator->indicatorCurrent % \count($indicator->indicatorValues)]; |
228 | 228 | }, |
229 | - 'message' => function (self $indicator) { |
|
229 | + 'message' => function(self $indicator) { |
|
230 | 230 | return $indicator->message; |
231 | 231 | }, |
232 | - 'elapsed' => function (self $indicator) { |
|
232 | + 'elapsed' => function(self $indicator) { |
|
233 | 233 | return Helper::formatTime(time() - $indicator->startTime); |
234 | 234 | }, |
235 | - 'memory' => function () { |
|
235 | + 'memory' => function() { |
|
236 | 236 | return Helper::formatMemory(memory_get_usage(true)); |
237 | 237 | }, |
238 | 238 | ]; |
@@ -568,7 +568,7 @@ |
||
568 | 568 | } |
569 | 569 | } |
570 | 570 | |
571 | - return new TableRows(function () use ($rows, $unmergedRows): \Traversable { |
|
571 | + return new TableRows(function() use ($rows, $unmergedRows): \Traversable { |
|
572 | 572 | foreach ($rows as $rowKey => $row) { |
573 | 573 | yield $this->fillCells($row); |
574 | 574 |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | .str_repeat('-', Helper::strlen($command->getName()) + 2)."\n\n" |
127 | 127 | .($command->getDescription() ? $command->getDescription()."\n\n" : '') |
128 | 128 | .'### Usage'."\n\n" |
129 | - .array_reduce(array_merge([$command->getSynopsis()], $command->getAliases(), $command->getUsages()), function ($carry, $usage) { |
|
129 | + .array_reduce(array_merge([$command->getSynopsis()], $command->getAliases(), $command->getUsages()), function($carry, $usage) { |
|
130 | 130 | return $carry.'* `'.$usage.'`'."\n"; |
131 | 131 | }) |
132 | 132 | ); |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | } |
161 | 161 | |
162 | 162 | $this->write("\n\n"); |
163 | - $this->write(implode("\n", array_map(function ($commandName) use ($description) { |
|
163 | + $this->write(implode("\n", array_map(function($commandName) use ($description) { |
|
164 | 164 | return sprintf('* [`%s`](#%s)', $commandName, str_replace(':', '', $description->getCommand($commandName)->getName())); |
165 | 165 | }, $namespace['commands']))); |
166 | 166 | } |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | } |
211 | 211 | |
212 | 212 | // calculate max. width based on available commands per namespace |
213 | - $width = $this->getColumnWidth(array_merge(...array_values(array_map(function ($namespace) use ($commands) { |
|
213 | + $width = $this->getColumnWidth(array_merge(...array_values(array_map(function($namespace) use ($commands) { |
|
214 | 214 | return array_intersect($namespace['commands'], array_keys($commands)); |
215 | 215 | }, $namespaces)))); |
216 | 216 | |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | } |
222 | 222 | |
223 | 223 | foreach ($namespaces as $namespace) { |
224 | - $namespace['commands'] = array_filter($namespace['commands'], function ($name) use ($commands) { |
|
224 | + $namespace['commands'] = array_filter($namespace['commands'], function($name) use ($commands) { |
|
225 | 225 | return isset($commands[$name]); |
226 | 226 | }); |
227 | 227 |
@@ -139,12 +139,12 @@ |
||
139 | 139 | if (\is_array($values)) { |
140 | 140 | $values = $this->isAssoc($values) ? array_merge(array_keys($values), array_values($values)) : array_values($values); |
141 | 141 | |
142 | - $callback = static function () use ($values) { |
|
142 | + $callback = static function() use ($values) { |
|
143 | 143 | return $values; |
144 | 144 | }; |
145 | 145 | } elseif ($values instanceof \Traversable) { |
146 | 146 | $valueCache = null; |
147 | - $callback = static function () use ($values, &$valueCache) { |
|
147 | + $callback = static function() use ($values, &$valueCache) { |
|
148 | 148 | return $valueCache ?? $valueCache = iterator_to_array($values, false); |
149 | 149 | }; |
150 | 150 | } else { |