@@ -46,32 +46,32 @@ discard block |
||
| 46 | 46 | protected function describeInputArgument(InputArgument $argument, array $options = []): void |
| 47 | 47 | { |
| 48 | 48 | $this->write( |
| 49 | - '#### `'.($argument->getName() ?: '<none>')."`\n\n" |
|
| 50 | - .($argument->getDescription() ? preg_replace('/\s*[\r\n]\s*/', "\n", $argument->getDescription())."\n\n" : '') |
|
| 51 | - .'* Is required: '.($argument->isRequired() ? 'yes' : 'no')."\n" |
|
| 52 | - .'* Is array: '.($argument->isArray() ? 'yes' : 'no')."\n" |
|
| 53 | - .'* Default: `'.str_replace("\n", '', var_export($argument->getDefault(), true)).'`' |
|
| 49 | + '#### `' . ($argument->getName() ?: '<none>') . "`\n\n" |
|
| 50 | + .($argument->getDescription() ? preg_replace('/\s*[\r\n]\s*/', "\n", $argument->getDescription()) . "\n\n" : '') |
|
| 51 | + .'* Is required: ' . ($argument->isRequired() ? 'yes' : 'no') . "\n" |
|
| 52 | + .'* Is array: ' . ($argument->isArray() ? 'yes' : 'no') . "\n" |
|
| 53 | + .'* Default: `' . str_replace("\n", '', var_export($argument->getDefault(), true)) . '`' |
|
| 54 | 54 | ); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | protected function describeInputOption(InputOption $option, array $options = []): void |
| 58 | 58 | { |
| 59 | - $name = '--'.$option->getName(); |
|
| 59 | + $name = '--' . $option->getName(); |
|
| 60 | 60 | if ($option->isNegatable()) { |
| 61 | - $name .= '|--no-'.$option->getName(); |
|
| 61 | + $name .= '|--no-' . $option->getName(); |
|
| 62 | 62 | } |
| 63 | 63 | if ($option->getShortcut()) { |
| 64 | - $name .= '|-'.str_replace('|', '|-', $option->getShortcut()).''; |
|
| 64 | + $name .= '|-' . str_replace('|', '|-', $option->getShortcut()) . ''; |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | $this->write( |
| 68 | - '#### `'.$name.'`'."\n\n" |
|
| 69 | - .($option->getDescription() ? preg_replace('/\s*[\r\n]\s*/', "\n", $option->getDescription())."\n\n" : '') |
|
| 70 | - .'* Accept value: '.($option->acceptValue() ? 'yes' : 'no')."\n" |
|
| 71 | - .'* Is value required: '.($option->isValueRequired() ? 'yes' : 'no')."\n" |
|
| 72 | - .'* Is multiple: '.($option->isArray() ? 'yes' : 'no')."\n" |
|
| 73 | - .'* Is negatable: '.($option->isNegatable() ? 'yes' : 'no')."\n" |
|
| 74 | - .'* Default: `'.str_replace("\n", '', var_export($option->getDefault(), true)).'`' |
|
| 68 | + '#### `' . $name . '`' . "\n\n" |
|
| 69 | + .($option->getDescription() ? preg_replace('/\s*[\r\n]\s*/', "\n", $option->getDescription()) . "\n\n" : '') |
|
| 70 | + .'* Accept value: ' . ($option->acceptValue() ? 'yes' : 'no') . "\n" |
|
| 71 | + .'* Is value required: ' . ($option->isValueRequired() ? 'yes' : 'no') . "\n" |
|
| 72 | + .'* Is multiple: ' . ($option->isArray() ? 'yes' : 'no') . "\n" |
|
| 73 | + .'* Is negatable: ' . ($option->isNegatable() ? 'yes' : 'no') . "\n" |
|
| 74 | + .'* Default: `' . str_replace("\n", '', var_export($option->getDefault(), true)) . '`' |
|
| 75 | 75 | ); |
| 76 | 76 | } |
| 77 | 77 | |
@@ -102,11 +102,11 @@ discard block |
||
| 102 | 102 | { |
| 103 | 103 | if ($options['short'] ?? false) { |
| 104 | 104 | $this->write( |
| 105 | - '`'.$command->getName()."`\n" |
|
| 106 | - .str_repeat('-', Helper::width($command->getName()) + 2)."\n\n" |
|
| 107 | - .($command->getDescription() ? $command->getDescription()."\n\n" : '') |
|
| 108 | - .'### Usage'."\n\n" |
|
| 109 | - .array_reduce($command->getAliases(), fn ($carry, $usage) => $carry.'* `'.$usage.'`'."\n") |
|
| 105 | + '`' . $command->getName() . "`\n" |
|
| 106 | + .str_repeat('-', Helper::width($command->getName()) + 2) . "\n\n" |
|
| 107 | + .($command->getDescription() ? $command->getDescription() . "\n\n" : '') |
|
| 108 | + .'### Usage' . "\n\n" |
|
| 109 | + .array_reduce($command->getAliases(), fn ($carry, $usage) => $carry . '* `' . $usage . '`' . "\n") |
|
| 110 | 110 | ); |
| 111 | 111 | |
| 112 | 112 | return; |
@@ -115,11 +115,11 @@ discard block |
||
| 115 | 115 | $command->mergeApplicationDefinition(false); |
| 116 | 116 | |
| 117 | 117 | $this->write( |
| 118 | - '`'.$command->getName()."`\n" |
|
| 119 | - .str_repeat('-', Helper::width($command->getName()) + 2)."\n\n" |
|
| 120 | - .($command->getDescription() ? $command->getDescription()."\n\n" : '') |
|
| 121 | - .'### Usage'."\n\n" |
|
| 122 | - .array_reduce(array_merge([$command->getSynopsis()], $command->getAliases(), $command->getUsages()), fn ($carry, $usage) => $carry.'* `'.$usage.'`'."\n") |
|
| 118 | + '`' . $command->getName() . "`\n" |
|
| 119 | + .str_repeat('-', Helper::width($command->getName()) + 2) . "\n\n" |
|
| 120 | + .($command->getDescription() ? $command->getDescription() . "\n\n" : '') |
|
| 121 | + .'### Usage' . "\n\n" |
|
| 122 | + .array_reduce(array_merge([$command->getSynopsis()], $command->getAliases(), $command->getUsages()), fn ($carry, $usage) => $carry . '* `' . $usage . '`' . "\n") |
|
| 123 | 123 | ); |
| 124 | 124 | |
| 125 | 125 | if ($help = $command->getProcessedHelp()) { |
@@ -140,12 +140,12 @@ discard block |
||
| 140 | 140 | $description = new ApplicationDescription($application, $describedNamespace); |
| 141 | 141 | $title = $this->getApplicationTitle($application); |
| 142 | 142 | |
| 143 | - $this->write($title."\n".str_repeat('=', Helper::width($title))); |
|
| 143 | + $this->write($title . "\n" . str_repeat('=', Helper::width($title))); |
|
| 144 | 144 | |
| 145 | 145 | foreach ($description->getNamespaces() as $namespace) { |
| 146 | 146 | if (ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) { |
| 147 | 147 | $this->write("\n\n"); |
| 148 | - $this->write('**'.$namespace['id'].':**'); |
|
| 148 | + $this->write('**' . $namespace['id'] . ':**'); |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | $this->write("\n\n"); |
@@ -77,12 +77,12 @@ |
||
| 77 | 77 | return false; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - public function writeln(string|iterable $messages, int $options = self::OUTPUT_NORMAL): void |
|
| 80 | + public function writeln(string | iterable $messages, int $options = self::OUTPUT_NORMAL): void |
|
| 81 | 81 | { |
| 82 | 82 | // do nothing |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - public function write(string|iterable $messages, bool $newline = false, int $options = self::OUTPUT_NORMAL): void |
|
| 85 | + public function write(string | iterable $messages, bool $newline = false, int $options = self::OUTPUT_NORMAL): void |
|
| 86 | 86 | { |
| 87 | 87 | // do nothing |
| 88 | 88 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | * @param int $options A bitmask of options (one of the OUTPUT or VERBOSITY constants), |
| 38 | 38 | * 0 is considered the same as self::OUTPUT_NORMAL | self::VERBOSITY_NORMAL |
| 39 | 39 | */ |
| 40 | - public function write(string|iterable $messages, bool $newline = false, int $options = 0): void; |
|
| 40 | + public function write(string | iterable $messages, bool $newline = false, int $options = 0): void; |
|
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | 43 | * Writes a message to the output and adds a newline at the end. |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * @param int $options A bitmask of options (one of the OUTPUT or VERBOSITY constants), |
| 46 | 46 | * 0 is considered the same as self::OUTPUT_NORMAL | self::VERBOSITY_NORMAL |
| 47 | 47 | */ |
| 48 | - public function writeln(string|iterable $messages, int $options = 0): void; |
|
| 48 | + public function writeln(string | iterable $messages, int $options = 0): void; |
|
| 49 | 49 | |
| 50 | 50 | /** |
| 51 | 51 | * Sets the verbosity of the output. |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | $hexColor = str_replace('#', '', $hexColor); |
| 48 | 48 | |
| 49 | 49 | if (3 === \strlen($hexColor)) { |
| 50 | - $hexColor = $hexColor[0].$hexColor[0].$hexColor[1].$hexColor[1].$hexColor[2].$hexColor[2]; |
|
| 50 | + $hexColor = $hexColor[0] . $hexColor[0] . $hexColor[1] . $hexColor[1] . $hexColor[2] . $hexColor[2]; |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | if (6 !== \strlen($hexColor)) { |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | return match ($this) { |
| 64 | 64 | self::Ansi4 => (string) $this->convertFromRGB($r, $g, $b), |
| 65 | - self::Ansi8 => '8;5;'.((string) $this->convertFromRGB($r, $g, $b)), |
|
| 65 | + self::Ansi8 => '8;5;' . ((string) $this->convertFromRGB($r, $g, $b)), |
|
| 66 | 66 | self::Ansi24 => sprintf('8;2;%d;%d;%d', $r, $g, $b), |
| 67 | 67 | }; |
| 68 | 68 | } |
@@ -94,12 +94,12 @@ |
||
| 94 | 94 | return self::VERBOSITY_DEBUG <= $this->verbosity; |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - public function writeln(string|iterable $messages, int $options = self::OUTPUT_NORMAL): void |
|
| 97 | + public function writeln(string | iterable $messages, int $options = self::OUTPUT_NORMAL): void |
|
| 98 | 98 | { |
| 99 | 99 | $this->write($messages, true, $options); |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - public function write(string|iterable $messages, bool $newline = false, int $options = self::OUTPUT_NORMAL): void |
|
| 102 | + public function write(string | iterable $messages, bool $newline = false, int $options = self::OUTPUT_NORMAL): void |
|
| 103 | 103 | { |
| 104 | 104 | if (!is_iterable($messages)) { |
| 105 | 105 | $messages = [$messages]; |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | /** |
| 83 | 83 | * Overwrites the previous output with a new message. |
| 84 | 84 | */ |
| 85 | - public function overwrite(string|iterable $message): void |
|
| 85 | + public function overwrite(string | iterable $message): void |
|
| 86 | 86 | { |
| 87 | 87 | $this->clear(); |
| 88 | 88 | $this->writeln($message); |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | // deduct the line count of the previous line |
| 134 | 134 | $this->lines -= (int) ceil($this->getDisplayLength($lastLine) / $width) ?: 1; |
| 135 | 135 | // concatenate previous and new line |
| 136 | - $lineContent = $lastLine.$lineContent; |
|
| 136 | + $lineContent = $lastLine . $lineContent; |
|
| 137 | 137 | // replace last entry of `$this->content` with the new expanded line |
| 138 | 138 | array_splice($this->content, -1, 1, $lineContent); |
| 139 | 139 | } else { |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | |
| 194 | 194 | // if the last line was removed, re-print its content together with the new content. |
| 195 | 195 | // otherwise, just print the new content. |
| 196 | - parent::doWrite($deleteLastLine ? $lastLine.$message : $message, true); |
|
| 196 | + parent::doWrite($deleteLastLine ? $lastLine . $message : $message, true); |
|
| 197 | 197 | parent::doWrite($erasedContent, false); |
| 198 | 198 | } |
| 199 | 199 | |
@@ -36,32 +36,32 @@ |
||
| 36 | 36 | /** |
| 37 | 37 | * Formats informational text. |
| 38 | 38 | */ |
| 39 | - public function text(string|array $message): void; |
|
| 39 | + public function text(string | array $message): void; |
|
| 40 | 40 | |
| 41 | 41 | /** |
| 42 | 42 | * Formats a success result bar. |
| 43 | 43 | */ |
| 44 | - public function success(string|array $message): void; |
|
| 44 | + public function success(string | array $message): void; |
|
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | 47 | * Formats an error result bar. |
| 48 | 48 | */ |
| 49 | - public function error(string|array $message): void; |
|
| 49 | + public function error(string | array $message): void; |
|
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | 52 | * Formats an warning result bar. |
| 53 | 53 | */ |
| 54 | - public function warning(string|array $message): void; |
|
| 54 | + public function warning(string | array $message): void; |
|
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | 57 | * Formats a note admonition. |
| 58 | 58 | */ |
| 59 | - public function note(string|array $message): void; |
|
| 59 | + public function note(string | array $message): void; |
|
| 60 | 60 | |
| 61 | 61 | /** |
| 62 | 62 | * Formats a caution admonition. |
| 63 | 63 | */ |
| 64 | - public function caution(string|array $message): void; |
|
| 64 | + public function caution(string | array $message): void; |
|
| 65 | 65 | |
| 66 | 66 | /** |
| 67 | 67 | * Formats a table. |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | /** |
| 61 | 61 | * Formats a message as a block of text. |
| 62 | 62 | */ |
| 63 | - public function block(string|array $messages, ?string $type = null, ?string $style = null, string $prefix = ' ', bool $padding = false, bool $escape = true): void |
|
| 63 | + public function block(string | array $messages, ?string $type = null, ?string $style = null, string $prefix = ' ', bool $padding = false, bool $escape = true): void |
|
| 64 | 64 | { |
| 65 | 65 | $messages = \is_array($messages) ? array_values($messages) : [$messages]; |
| 66 | 66 | |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | $this->newLine(); |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - public function text(string|array $message): void |
|
| 101 | + public function text(string | array $message): void |
|
| 102 | 102 | { |
| 103 | 103 | $this->autoPrependText(); |
| 104 | 104 | |
@@ -111,27 +111,27 @@ discard block |
||
| 111 | 111 | /** |
| 112 | 112 | * Formats a command comment. |
| 113 | 113 | */ |
| 114 | - public function comment(string|array $message): void |
|
| 114 | + public function comment(string | array $message): void |
|
| 115 | 115 | { |
| 116 | 116 | $this->block($message, null, null, '<fg=default;bg=default> // </>', false, false); |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - public function success(string|array $message): void |
|
| 119 | + public function success(string | array $message): void |
|
| 120 | 120 | { |
| 121 | 121 | $this->block($message, 'OK', 'fg=black;bg=green', ' ', true); |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - public function error(string|array $message): void |
|
| 124 | + public function error(string | array $message): void |
|
| 125 | 125 | { |
| 126 | 126 | $this->block($message, 'ERROR', 'fg=white;bg=red', ' ', true); |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - public function warning(string|array $message): void |
|
| 129 | + public function warning(string | array $message): void |
|
| 130 | 130 | { |
| 131 | 131 | $this->block($message, 'WARNING', 'fg=black;bg=yellow', ' ', true); |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - public function note(string|array $message): void |
|
| 134 | + public function note(string | array $message): void |
|
| 135 | 135 | { |
| 136 | 136 | $this->block($message, 'NOTE', 'fg=yellow', ' ! '); |
| 137 | 137 | } |
@@ -139,12 +139,12 @@ discard block |
||
| 139 | 139 | /** |
| 140 | 140 | * Formats an info message. |
| 141 | 141 | */ |
| 142 | - public function info(string|array $message): void |
|
| 142 | + public function info(string | array $message): void |
|
| 143 | 143 | { |
| 144 | 144 | $this->block($message, 'INFO', 'fg=green', ' ', true); |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | - public function caution(string|array $message): void |
|
| 147 | + public function caution(string | array $message): void |
|
| 148 | 148 | { |
| 149 | 149 | $this->block($message, 'CAUTION', 'fg=white;bg=red', ' ! ', true); |
| 150 | 150 | } |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | * * ['key' => 'value'] |
| 184 | 184 | * * new TableSeparator() |
| 185 | 185 | */ |
| 186 | - public function definitionList(string|array|TableSeparator ...$list): void |
|
| 186 | + public function definitionList(string | array | TableSeparator ...$list): void |
|
| 187 | 187 | { |
| 188 | 188 | $headers = []; |
| 189 | 189 | $row = []; |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | return $answer; |
| 317 | 317 | } |
| 318 | 318 | |
| 319 | - public function writeln(string|iterable $messages, int $type = self::OUTPUT_NORMAL): void |
|
| 319 | + public function writeln(string | iterable $messages, int $type = self::OUTPUT_NORMAL): void |
|
| 320 | 320 | { |
| 321 | 321 | if (!is_iterable($messages)) { |
| 322 | 322 | $messages = [$messages]; |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | } |
| 329 | 329 | } |
| 330 | 330 | |
| 331 | - public function write(string|iterable $messages, bool $newline = false, int $type = self::OUTPUT_NORMAL): void |
|
| 331 | + public function write(string | iterable $messages, bool $newline = false, int $type = self::OUTPUT_NORMAL): void |
|
| 332 | 332 | { |
| 333 | 333 | if (!is_iterable($messages)) { |
| 334 | 334 | $messages = [$messages]; |
@@ -439,10 +439,10 @@ discard block |
||
| 439 | 439 | |
| 440 | 440 | foreach ($lines as $i => &$line) { |
| 441 | 441 | if (null !== $type) { |
| 442 | - $line = $firstLineIndex === $i ? $type.$line : $lineIndentation.$line; |
|
| 442 | + $line = $firstLineIndex === $i ? $type . $line : $lineIndentation . $line; |
|
| 443 | 443 | } |
| 444 | 444 | |
| 445 | - $line = $prefix.$line; |
|
| 445 | + $line = $prefix . $line; |
|
| 446 | 446 | $line .= str_repeat(' ', max($this->lineLength - Helper::width(Helper::removeDecoration($this->getFormatter(), $line)), 0)); |
| 447 | 447 | |
| 448 | 448 | if ($style) { |
@@ -38,12 +38,12 @@ |
||
| 38 | 38 | return new ProgressBar($this->output, $max); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - public function write(string|iterable $messages, bool $newline = false, int $type = self::OUTPUT_NORMAL): void |
|
| 41 | + public function write(string | iterable $messages, bool $newline = false, int $type = self::OUTPUT_NORMAL): void |
|
| 42 | 42 | { |
| 43 | 43 | $this->output->write($messages, $newline, $type); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - public function writeln(string|iterable $messages, int $type = self::OUTPUT_NORMAL): void |
|
| 46 | + public function writeln(string | iterable $messages, int $type = self::OUTPUT_NORMAL): void |
|
| 47 | 47 | { |
| 48 | 48 | $this->output->writeln($messages, $type); |
| 49 | 49 | } |