@@ -579,17 +579,17 @@ |
||
| 579 | 579 | protected function defaults(): self |
| 580 | 580 | { |
| 581 | 581 | $this->addOption('-h|--help', 'Show help') |
| 582 | - ->on([$this, 'showHelp']); |
|
| 582 | + ->on([$this, 'showHelp']); |
|
| 583 | 583 | |
| 584 | 584 | $this->addOption('-v|--version', 'Show version') |
| 585 | - ->on([$this, 'showVersion']); |
|
| 585 | + ->on([$this, 'showVersion']); |
|
| 586 | 586 | |
| 587 | 587 | $this->addOption('-V|--verbosity', 'Verbosity level', 0) |
| 588 | - ->on(function () { |
|
| 588 | + ->on(function () { |
|
| 589 | 589 | $this->set('verbosity', $this->verbosity++); |
| 590 | 590 | |
| 591 | 591 | return false; |
| 592 | - }); |
|
| 592 | + }); |
|
| 593 | 593 | |
| 594 | 594 | $this->onExit(function (int $exitCode = 0) { |
| 595 | 595 | exit($exitCode); |
@@ -585,13 +585,13 @@ |
||
| 585 | 585 | ->on([$this, 'showVersion']); |
| 586 | 586 | |
| 587 | 587 | $this->addOption('-V|--verbosity', 'Verbosity level', 0) |
| 588 | - ->on(function () { |
|
| 588 | + ->on(function() { |
|
| 589 | 589 | $this->set('verbosity', $this->verbosity++); |
| 590 | 590 | |
| 591 | 591 | return false; |
| 592 | 592 | }); |
| 593 | 593 | |
| 594 | - $this->onExit(function (int $exitCode = 0) { |
|
| 594 | + $this->onExit(function(int $exitCode = 0) { |
|
| 595 | 595 | exit($exitCode); |
| 596 | 596 | }); |
| 597 | 597 | |
@@ -360,9 +360,9 @@ |
||
| 360 | 360 | : ['pipe', 'w']; |
| 361 | 361 | |
| 362 | 362 | return [ |
| 363 | - self::STDIN_DESCRIPTOR => ['pipe', 'r'], |
|
| 364 | - self::STDOUT_DESCRIPTOR => $out, |
|
| 365 | - self::STDERR_DESCRIPTOR => $out, |
|
| 363 | + self::STDIN_DESCRIPTOR => ['pipe', 'r'], |
|
| 364 | + self::STDOUT_DESCRIPTOR => $out, |
|
| 365 | + self::STDERR_DESCRIPTOR => $out, |
|
| 366 | 366 | ]; |
| 367 | 367 | } |
| 368 | 368 | |
@@ -129,7 +129,7 @@ |
||
| 129 | 129 | }; |
| 130 | 130 | |
| 131 | 131 | $this->command('__default__', 'Default command', '', true, true) |
| 132 | - ->on([$this, 'showHelp'], 'help'); |
|
| 132 | + ->on([$this, 'showHelp'], 'help'); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | /** |
@@ -124,7 +124,7 @@ |
||
| 124 | 124 | $this->name = $name; |
| 125 | 125 | $this->version = $version; |
| 126 | 126 | |
| 127 | - $this->onExit = $onExit ? $onExit : function (int $exitCode = 0) { |
|
| 127 | + $this->onExit = $onExit ? $onExit : function(int $exitCode = 0) { |
|
| 128 | 128 | exit($exitCode); |
| 129 | 129 | }; |
| 130 | 130 | |
@@ -110,18 +110,18 @@ discard block |
||
| 110 | 110 | $traceStr = '</eol></eol><info>Stack Trace:</end></eol></eol>'; |
| 111 | 111 | foreach ($error->getTrace() as $i => $trace) { |
| 112 | 112 | $trace += [ |
| 113 | - 'class' => '', |
|
| 114 | - 'type' => '', |
|
| 115 | - 'function' => '', |
|
| 116 | - 'file' => '', |
|
| 117 | - 'line' => '', |
|
| 118 | - 'args' => [] |
|
| 119 | - ]; |
|
| 113 | + 'class' => '', |
|
| 114 | + 'type' => '', |
|
| 115 | + 'function' => '', |
|
| 116 | + 'file' => '', |
|
| 117 | + 'line' => '', |
|
| 118 | + 'args' => [] |
|
| 119 | + ]; |
|
| 120 | 120 | $symbol = $trace['class'] . $trace['type'] . $trace['function']; |
| 121 | 121 | $arguments = $this->stringifyArgs($trace['args']); |
| 122 | 122 | |
| 123 | 123 | $traceStr .= ' <comment>' . $i . ')</end> <error>' |
| 124 | - . $symbol . '</end><comment>(' . $arguments . ')</end>'; |
|
| 124 | + . $symbol . '</end><comment>(' . $arguments . ')</end>'; |
|
| 125 | 125 | |
| 126 | 126 | if ($trace['file'] !== '') { |
| 127 | 127 | $file = realpath($trace['file']); |
@@ -150,13 +150,13 @@ discard block |
||
| 150 | 150 | return $this; |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - /** |
|
| 154 | - * Show options help |
|
| 155 | - * @param array<Option> $items |
|
| 156 | - * @param string $header |
|
| 157 | - * @param string $footer |
|
| 158 | - * @return $this |
|
| 159 | - */ |
|
| 153 | + /** |
|
| 154 | + * Show options help |
|
| 155 | + * @param array<Option> $items |
|
| 156 | + * @param string $header |
|
| 157 | + * @param string $footer |
|
| 158 | + * @return $this |
|
| 159 | + */ |
|
| 160 | 160 | public function showOptionsHelp( |
| 161 | 161 | array $items, |
| 162 | 162 | string $header = '', |
@@ -202,8 +202,8 @@ discard block |
||
| 202 | 202 | |
| 203 | 203 | if (strpos($usage, ' ## ') === false) { |
| 204 | 204 | $this->writer->eol() |
| 205 | - ->green('Usage Examples: ', true, null, Color::BOLD) |
|
| 206 | - ->colors($usage)->eol(); |
|
| 205 | + ->green('Usage Examples: ', true, null, Color::BOLD) |
|
| 206 | + ->colors($usage)->eol(); |
|
| 207 | 207 | |
| 208 | 208 | return $this; |
| 209 | 209 | } |
@@ -243,8 +243,8 @@ discard block |
||
| 243 | 243 | ); |
| 244 | 244 | |
| 245 | 245 | $this->writer->eol() |
| 246 | - ->green('Usage Examples: ', true, null, Color::BOLD) |
|
| 247 | - ->colors($formatedUsage)->eol(); |
|
| 246 | + ->green('Usage Examples: ', true, null, Color::BOLD) |
|
| 247 | + ->colors($formatedUsage)->eol(); |
|
| 248 | 248 | |
| 249 | 249 | return $this; |
| 250 | 250 | } |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | string $header = '', |
| 180 | 180 | string $footer = '' |
| 181 | 181 | ): self { |
| 182 | - $this->maxCommandWidth = !empty($items) ? max(array_map(function (Command $item) { |
|
| 182 | + $this->maxCommandWidth = !empty($items) ? max(array_map(function(Command $item) { |
|
| 183 | 183 | return strlen($item->getName()); |
| 184 | 184 | }, $items)) : 0; |
| 185 | 185 | |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | $maxLength = (int) max($lines) + 4; |
| 232 | 232 | $formatedUsage = (string) preg_replace_callback( |
| 233 | 233 | '~ ## ~', |
| 234 | - function () use (&$lines, $maxLength) { |
|
| 234 | + function() use (&$lines, $maxLength) { |
|
| 235 | 235 | $sizeOfLine = 0; |
| 236 | 236 | $currentLine = array_shift($lines); |
| 237 | 237 | if ($currentLine !== null) { |
@@ -387,11 +387,11 @@ discard block |
||
| 387 | 387 | */ |
| 388 | 388 | protected function sortItems(array $items, int &$max = 0): array |
| 389 | 389 | { |
| 390 | - $max = max(array_map(function ($item) { |
|
| 390 | + $max = max(array_map(function($item) { |
|
| 391 | 391 | return strlen($this->getName($item)); |
| 392 | 392 | }, $items)); |
| 393 | 393 | |
| 394 | - uasort($items, function ($a, $b) { |
|
| 394 | + uasort($items, function($a, $b) { |
|
| 395 | 395 | /* @var Parameter $b */ |
| 396 | 396 | /* @var Parameter $a */ |
| 397 | 397 | return $a->getName() <=> $b->getName(); |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | { |
| 221 | 221 | $value = null; |
| 222 | 222 | if ($nextArg !== null && substr($nextArg, 0, 1) !== '-') { |
| 223 | - $value = $nextArg; |
|
| 223 | + $value = $nextArg; |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | $option = $this->getOptionForArgument($arg); |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | /** @var array<Parameter> $missingItems */ |
| 297 | 297 | $missingItems = array_filter( |
| 298 | 298 | $this->options + $this->arguments, |
| 299 | - function ($item) { |
|
| 299 | + function($item) { |
|
| 300 | 300 | /** @var Parameter $item */ |
| 301 | 301 | return $item->isRequired() && in_array( |
| 302 | 302 | $this->values[$item->getAttributeName()], |
@@ -61,10 +61,10 @@ |
||
| 61 | 61 | */ |
| 62 | 62 | protected string $short = ''; |
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * The long option name |
|
| 66 | - * @var string |
|
| 67 | - */ |
|
| 64 | + /** |
|
| 65 | + * The long option name |
|
| 66 | + * @var string |
|
| 67 | + */ |
|
| 68 | 68 | protected string $long = ''; |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -248,9 +248,9 @@ |
||
| 248 | 248 | |
| 249 | 249 | foreach ($choices as $choice => $desc) { |
| 250 | 250 | $this->writer->eol() |
| 251 | - ->cyan( |
|
| 252 | - str_pad(' [' . $choice . ']', $maxLength + 6) |
|
| 253 | - ); |
|
| 251 | + ->cyan( |
|
| 252 | + str_pad(' [' . $choice . ']', $maxLength + 6) |
|
| 253 | + ); |
|
| 254 | 254 | |
| 255 | 255 | $this->writer->dim($desc); |
| 256 | 256 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | list($start, $end) = $normalizedStyles['head']; |
| 81 | 81 | foreach ($head as $col => $size) { |
| 82 | 82 | $dash[] = str_repeat('-', (int) $size + 2); |
| 83 | - $title[] = str_pad(Helper::toWords($col), (int)$size, ' '); |
|
| 83 | + $title[] = str_pad(Helper::toWords($col), (int) $size, ' '); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | $titleStr = '|' . $start . ' ' |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | $parts = []; |
| 93 | 93 | list($start, $end) = $normalizedStyles[['even', 'odd'][(int) $odd]]; |
| 94 | 94 | foreach ($head as $col => $size) { |
| 95 | - $parts[] = str_pad(isset($row[$col]) ? $row[$col] : '', (int)$size, ' '); |
|
| 95 | + $parts[] = str_pad(isset($row[$col]) ? $row[$col] : '', (int) $size, ' '); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | $odd = !$odd; |