@@ -138,14 +138,14 @@ discard block |
||
| 138 | 138 | public function run(?InputInterface $input = null, ?OutputInterface $output = null): int |
| 139 | 139 | { |
| 140 | 140 | if (\function_exists('putenv')) { |
| 141 | - @putenv('LINES='.$this->terminal->getHeight()); |
|
| 142 | - @putenv('COLUMNS='.$this->terminal->getWidth()); |
|
| 141 | + @putenv('LINES=' . $this->terminal->getHeight()); |
|
| 142 | + @putenv('COLUMNS=' . $this->terminal->getWidth()); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | $input ??= new ArgvInput(); |
| 146 | 146 | $output ??= new ConsoleOutput(); |
| 147 | 147 | |
| 148 | - $renderException = function (\Throwable $e) use ($output) { |
|
| 148 | + $renderException = function(\Throwable $e) use ($output) { |
|
| 149 | 149 | if ($output instanceof ConsoleOutputInterface) { |
| 150 | 150 | $this->renderThrowable($e, $output->getErrorOutput()); |
| 151 | 151 | } else { |
@@ -617,8 +617,8 @@ discard block |
||
| 617 | 617 | public function findNamespace(string $namespace): string |
| 618 | 618 | { |
| 619 | 619 | $allNamespaces = $this->getNamespaces(); |
| 620 | - $expr = implode('[^:]*:', array_map('preg_quote', explode(':', $namespace))).'[^:]*'; |
|
| 621 | - $namespaces = preg_grep('{^'.$expr.'}', $allNamespaces); |
|
| 620 | + $expr = implode('[^:]*:', array_map('preg_quote', explode(':', $namespace))) . '[^:]*'; |
|
| 621 | + $namespaces = preg_grep('{^' . $expr . '}', $allNamespaces); |
|
| 622 | 622 | |
| 623 | 623 | if (!$namespaces) { |
| 624 | 624 | $message = sprintf('There are no commands defined in the "%s" namespace.', $namespace); |
@@ -671,15 +671,15 @@ discard block |
||
| 671 | 671 | } |
| 672 | 672 | |
| 673 | 673 | $allCommands = $this->commandLoader ? array_merge($this->commandLoader->getNames(), array_keys($this->commands)) : array_keys($this->commands); |
| 674 | - $expr = implode('[^:]*:', array_map('preg_quote', explode(':', $name))).'[^:]*'; |
|
| 675 | - $commands = preg_grep('{^'.$expr.'}', $allCommands); |
|
| 674 | + $expr = implode('[^:]*:', array_map('preg_quote', explode(':', $name))) . '[^:]*'; |
|
| 675 | + $commands = preg_grep('{^' . $expr . '}', $allCommands); |
|
| 676 | 676 | |
| 677 | 677 | if (!$commands) { |
| 678 | - $commands = preg_grep('{^'.$expr.'}i', $allCommands); |
|
| 678 | + $commands = preg_grep('{^' . $expr . '}i', $allCommands); |
|
| 679 | 679 | } |
| 680 | 680 | |
| 681 | 681 | // if no commands matched or we just matched namespaces |
| 682 | - if (!$commands || \count(preg_grep('{^'.$expr.'$}i', $commands)) < 1) { |
|
| 682 | + if (!$commands || \count(preg_grep('{^' . $expr . '$}i', $commands)) < 1) { |
|
| 683 | 683 | if (false !== $pos = strrpos($name, ':')) { |
| 684 | 684 | // check if a namespace exists and contains commands |
| 685 | 685 | $this->findNamespace(substr($name, 0, $pos)); |
@@ -705,7 +705,7 @@ discard block |
||
| 705 | 705 | // filter out aliases for commands which are already on the list |
| 706 | 706 | if (\count($commands) > 1) { |
| 707 | 707 | $commandList = $this->commandLoader ? array_merge(array_flip($this->commandLoader->getNames()), $this->commands) : $this->commands; |
| 708 | - $commands = array_unique(array_filter($commands, function ($nameOrAlias) use (&$commandList, $commands, &$aliases) { |
|
| 708 | + $commands = array_unique(array_filter($commands, function($nameOrAlias) use (&$commandList, $commands, &$aliases) { |
|
| 709 | 709 | if (!$commandList[$nameOrAlias] instanceof Command) { |
| 710 | 710 | $commandList[$nameOrAlias] = $this->commandLoader->get($nameOrAlias); |
| 711 | 711 | } |
@@ -725,16 +725,16 @@ discard block |
||
| 725 | 725 | foreach ($abbrevs as $abbrev) { |
| 726 | 726 | $maxLen = max(Helper::width($abbrev), $maxLen); |
| 727 | 727 | } |
| 728 | - $abbrevs = array_map(function ($cmd) use ($commandList, $usableWidth, $maxLen, &$commands) { |
|
| 728 | + $abbrevs = array_map(function($cmd) use ($commandList, $usableWidth, $maxLen, &$commands) { |
|
| 729 | 729 | if ($commandList[$cmd]->isHidden()) { |
| 730 | 730 | unset($commands[array_search($cmd, $commands)]); |
| 731 | 731 | |
| 732 | 732 | return false; |
| 733 | 733 | } |
| 734 | 734 | |
| 735 | - $abbrev = str_pad($cmd, $maxLen, ' ').' '.$commandList[$cmd]->getDescription(); |
|
| 735 | + $abbrev = str_pad($cmd, $maxLen, ' ') . ' ' . $commandList[$cmd]->getDescription(); |
|
| 736 | 736 | |
| 737 | - return Helper::width($abbrev) > $usableWidth ? Helper::substr($abbrev, 0, $usableWidth - 3).'...' : $abbrev; |
|
| 737 | + return Helper::width($abbrev) > $usableWidth ? Helper::substr($abbrev, 0, $usableWidth - 3) . '...' : $abbrev; |
|
| 738 | 738 | }, array_values($commands)); |
| 739 | 739 | |
| 740 | 740 | if (\count($commands) > 1) { |
@@ -833,14 +833,14 @@ discard block |
||
| 833 | 833 | $message = trim($e->getMessage()); |
| 834 | 834 | if ('' === $message || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) { |
| 835 | 835 | $class = get_debug_type($e); |
| 836 | - $title = sprintf(' [%s%s] ', $class, 0 !== ($code = $e->getCode()) ? ' ('.$code.')' : ''); |
|
| 836 | + $title = sprintf(' [%s%s] ', $class, 0 !== ($code = $e->getCode()) ? ' (' . $code . ')' : ''); |
|
| 837 | 837 | $len = Helper::width($title); |
| 838 | 838 | } else { |
| 839 | 839 | $len = 0; |
| 840 | 840 | } |
| 841 | 841 | |
| 842 | 842 | if (str_contains($message, "@anonymous\0")) { |
| 843 | - $message = preg_replace_callback('/[a-zA-Z_\x7f-\xff][\\\\a-zA-Z0-9_\x7f-\xff]*+@anonymous\x00.*?\.php(?:0x?|:[0-9]++\$)[0-9a-fA-F]++/', fn ($m) => class_exists($m[0], false) ? (get_parent_class($m[0]) ?: key(class_implements($m[0])) ?: 'class').'@anonymous' : $m[0], $message); |
|
| 843 | + $message = preg_replace_callback('/[a-zA-Z_\x7f-\xff][\\\\a-zA-Z0-9_\x7f-\xff]*+@anonymous\x00.*?\.php(?:0x?|:[0-9]++\$)[0-9a-fA-F]++/', fn ($m) => class_exists($m[0], false) ? (get_parent_class($m[0]) ?: key(class_implements($m[0])) ?: 'class') . '@anonymous' : $m[0], $message); |
|
| 844 | 844 | } |
| 845 | 845 | |
| 846 | 846 | $width = $this->terminal->getWidth() ? $this->terminal->getWidth() - 1 : \PHP_INT_MAX; |
@@ -891,7 +891,7 @@ discard block |
||
| 891 | 891 | $file = $trace[$i]['file'] ?? 'n/a'; |
| 892 | 892 | $line = $trace[$i]['line'] ?? 'n/a'; |
| 893 | 893 | |
| 894 | - $output->writeln(sprintf(' %s%s at <info>%s:%s</info>', $class, $function ? $type.$function.'()' : '', $file, $line), OutputInterface::VERBOSITY_QUIET); |
|
| 894 | + $output->writeln(sprintf(' %s%s at <info>%s:%s</info>', $class, $function ? $type . $function . '()' : '', $file, $line), OutputInterface::VERBOSITY_QUIET); |
|
| 895 | 895 | } |
| 896 | 896 | |
| 897 | 897 | $output->writeln('', OutputInterface::VERBOSITY_QUIET); |
@@ -953,7 +953,7 @@ discard block |
||
| 953 | 953 | } |
| 954 | 954 | |
| 955 | 955 | if (\function_exists('putenv')) { |
| 956 | - @putenv('SHELL_VERBOSITY='.$shellVerbosity); |
|
| 956 | + @putenv('SHELL_VERBOSITY=' . $shellVerbosity); |
|
| 957 | 957 | } |
| 958 | 958 | $_ENV['SHELL_VERBOSITY'] = $shellVerbosity; |
| 959 | 959 | $_SERVER['SHELL_VERBOSITY'] = $shellVerbosity; |
@@ -985,7 +985,7 @@ discard block |
||
| 985 | 985 | $sttyMode = shell_exec('stty -g'); |
| 986 | 986 | |
| 987 | 987 | foreach ([\SIGINT, \SIGQUIT, \SIGTERM] as $signal) { |
| 988 | - $this->signalRegistry->register($signal, static fn () => shell_exec('stty '.$sttyMode)); |
|
| 988 | + $this->signalRegistry->register($signal, static fn () => shell_exec('stty ' . $sttyMode)); |
|
| 989 | 989 | } |
| 990 | 990 | } |
| 991 | 991 | |
@@ -994,7 +994,7 @@ discard block |
||
| 994 | 994 | foreach ($this->signalsToDispatchEvent as $signal) { |
| 995 | 995 | $event = new ConsoleSignalEvent($command, $input, $output, $signal); |
| 996 | 996 | |
| 997 | - $this->signalRegistry->register($signal, function ($signal) use ($event, $command, $commandSignals) { |
|
| 997 | + $this->signalRegistry->register($signal, function($signal) use ($event, $command, $commandSignals) { |
|
| 998 | 998 | $this->dispatcher->dispatch($event, ConsoleEvents::SIGNAL); |
| 999 | 999 | $exitCode = $event->getExitCode(); |
| 1000 | 1000 | |
@@ -1017,7 +1017,7 @@ discard block |
||
| 1017 | 1017 | } |
| 1018 | 1018 | |
| 1019 | 1019 | foreach ($commandSignals as $signal) { |
| 1020 | - $this->signalRegistry->register($signal, function (int $signal) use ($command): void { |
|
| 1020 | + $this->signalRegistry->register($signal, function(int $signal) use ($command): void { |
|
| 1021 | 1021 | if (false !== $exitCode = $command->handleSignal($signal)) { |
| 1022 | 1022 | exit($exitCode); |
| 1023 | 1023 | } |
@@ -1083,7 +1083,7 @@ discard block |
||
| 1083 | 1083 | { |
| 1084 | 1084 | return new InputDefinition([ |
| 1085 | 1085 | new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'), |
| 1086 | - new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display help for the given command. When no command is given display help for the <info>'.$this->defaultCommand.'</info> command'), |
|
| 1086 | + new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display help for the given command. When no command is given display help for the <info>' . $this->defaultCommand . '</info> command'), |
|
| 1087 | 1087 | new InputOption('--quiet', '-q', InputOption::VALUE_NONE, 'Do not output any message'), |
| 1088 | 1088 | new InputOption('--verbose', '-v|vv|vvv', InputOption::VALUE_NONE, 'Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug'), |
| 1089 | 1089 | new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version'), |
@@ -1120,7 +1120,7 @@ discard block |
||
| 1120 | 1120 | */ |
| 1121 | 1121 | private function getAbbreviationSuggestions(array $abbrevs): string |
| 1122 | 1122 | { |
| 1123 | - return ' '.implode("\n ", $abbrevs); |
|
| 1123 | + return ' ' . implode("\n ", $abbrevs); |
|
| 1124 | 1124 | } |
| 1125 | 1125 | |
| 1126 | 1126 | /** |
@@ -1229,7 +1229,7 @@ discard block |
||
| 1229 | 1229 | |
| 1230 | 1230 | foreach (preg_split('//u', $m[0]) as $char) { |
| 1231 | 1231 | // test if $char could be appended to current line |
| 1232 | - if (mb_strwidth($line.$char, 'utf8') <= $width) { |
|
| 1232 | + if (mb_strwidth($line . $char, 'utf8') <= $width) { |
|
| 1233 | 1233 | $line .= $char; |
| 1234 | 1234 | continue; |
| 1235 | 1235 | } |
@@ -1259,7 +1259,7 @@ discard block |
||
| 1259 | 1259 | |
| 1260 | 1260 | foreach ($parts as $part) { |
| 1261 | 1261 | if (\count($namespaces)) { |
| 1262 | - $namespaces[] = end($namespaces).':'.$part; |
|
| 1262 | + $namespaces[] = end($namespaces) . ':' . $part; |
|
| 1263 | 1263 | } else { |
| 1264 | 1264 | $namespaces[] = $part; |
| 1265 | 1265 | } |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | final class RunCommandFailedException extends RuntimeException |
| 20 | 20 | { |
| 21 | - public function __construct(\Throwable|string $exception, public readonly RunCommandContext $context) |
|
| 21 | + public function __construct(\Throwable | string $exception, public readonly RunCommandContext $context) |
|
| 22 | 22 | { |
| 23 | 23 | parent::__construct( |
| 24 | 24 | $exception instanceof \Throwable ? $exception->getMessage() : $exception, |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | foreach ($command->options as $optName => $optValue) { |
| 75 | 75 | if ($baseDefinition->hasOption($optName)) { |
| 76 | - $this->data['application_inputs']['--'.$optName] = $this->cloneVar($optValue); |
|
| 76 | + $this->data['application_inputs']['--' . $optName] = $this->cloneVar($optValue); |
|
| 77 | 77 | } else { |
| 78 | 78 | $this->data['options'][$optName] = $this->cloneVar($optValue); |
| 79 | 79 | } |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | if (Command::class !== $r->getDeclaringClass()) { |
| 102 | 102 | return [ |
| 103 | - 'executor' => $class.'::'.$r->name, |
|
| 103 | + 'executor' => $class . '::' . $r->name, |
|
| 104 | 104 | 'file' => $r->getFileName(), |
| 105 | 105 | 'line' => $r->getStartLine(), |
| 106 | 106 | ]; |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | private string $name; |
| 54 | 54 | private ?string $shortcut; |
| 55 | 55 | private int $mode; |
| 56 | - private string|int|bool|array|float|null $default; |
|
| 56 | + private string | int | bool | array | float | null $default; |
|
| 57 | 57 | |
| 58 | 58 | /** |
| 59 | 59 | * @param string|array|null $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts |
@@ -65,11 +65,11 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | public function __construct( |
| 67 | 67 | string $name, |
| 68 | - string|array|null $shortcut = null, |
|
| 68 | + string | array | null $shortcut = null, |
|
| 69 | 69 | ?int $mode = null, |
| 70 | 70 | private string $description = '', |
| 71 | - string|bool|int|float|array|null $default = null, |
|
| 72 | - private array|\Closure $suggestedValues = [], |
|
| 71 | + string | bool | int | float | array | null $default = null, |
|
| 72 | + private array | \Closure $suggestedValues = [], |
|
| 73 | 73 | ) { |
| 74 | 74 | if (str_starts_with($name, '--')) { |
| 75 | 75 | $name = substr($name, 2); |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | /** |
| 189 | 189 | * Sets the default value. |
| 190 | 190 | */ |
| 191 | - public function setDefault(string|bool|int|float|array|null $default): void |
|
| 191 | + public function setDefault(string | bool | int | float | array | null $default): void |
|
| 192 | 192 | { |
| 193 | 193 | if (self::VALUE_NONE === (self::VALUE_NONE & $this->mode) && null !== $default) { |
| 194 | 194 | throw new LogicException('Cannot set a default value when using InputOption::VALUE_NONE mode.'); |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | /** |
| 209 | 209 | * Returns the default value. |
| 210 | 210 | */ |
| 211 | - public function getDefault(): string|bool|int|float|array|null |
|
| 211 | + public function getDefault(): string | bool | int | float | array | null |
|
| 212 | 212 | { |
| 213 | 213 | return $this->default; |
| 214 | 214 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | return null; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - public function hasParameterOption(string|array $values, bool $onlyParams = false): bool |
|
| 48 | + public function hasParameterOption(string | array $values, bool $onlyParams = false): bool |
|
| 49 | 49 | { |
| 50 | 50 | $values = (array) $values; |
| 51 | 51 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | return false; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - public function getParameterOption(string|array $values, string|bool|int|float|array|null $default = false, bool $onlyParams = false): mixed |
|
| 69 | + public function getParameterOption(string | array $values, string | bool | int | float | array | null $default = false, bool $onlyParams = false): mixed |
|
| 70 | 70 | { |
| 71 | 71 | $values = (array) $values; |
| 72 | 72 | |
@@ -98,10 +98,10 @@ discard block |
||
| 98 | 98 | $glue = ('-' === $param[1]) ? '=' : ' '; |
| 99 | 99 | if (\is_array($val)) { |
| 100 | 100 | foreach ($val as $v) { |
| 101 | - $params[] = $param.('' != $v ? $glue.$this->escapeToken($v) : ''); |
|
| 101 | + $params[] = $param . ('' != $v ? $glue . $this->escapeToken($v) : ''); |
|
| 102 | 102 | } |
| 103 | 103 | } else { |
| 104 | - $params[] = $param.('' != $val ? $glue.$this->escapeToken($val) : ''); |
|
| 104 | + $params[] = $param . ('' != $val ? $glue . $this->escapeToken($val) : ''); |
|
| 105 | 105 | } |
| 106 | 106 | } else { |
| 107 | 107 | $params[] = \is_array($val) ? implode(' ', array_map($this->escapeToken(...), $val)) : $this->escapeToken($val); |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | * |
| 181 | 181 | * @throws InvalidArgumentException When argument given doesn't exist |
| 182 | 182 | */ |
| 183 | - private function addArgument(string|int $name, mixed $value): void |
|
| 183 | + private function addArgument(string | int $name, mixed $value): void |
|
| 184 | 184 | { |
| 185 | 185 | if (!$this->definition->hasArgument($name)) { |
| 186 | 186 | throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name)); |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | return null; |
| 296 | 296 | } |
| 297 | 297 | |
| 298 | - public function hasParameterOption(string|array $values, bool $onlyParams = false): bool |
|
| 298 | + public function hasParameterOption(string | array $values, bool $onlyParams = false): bool |
|
| 299 | 299 | { |
| 300 | 300 | $values = (array) $values; |
| 301 | 301 | |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | // Options with values: |
| 308 | 308 | // For long options, test for '--option=' at beginning |
| 309 | 309 | // For short options, test for '-o' at beginning |
| 310 | - $leading = str_starts_with($value, '--') ? $value.'=' : $value; |
|
| 310 | + $leading = str_starts_with($value, '--') ? $value . '=' : $value; |
|
| 311 | 311 | if ($token === $value || '' !== $leading && str_starts_with($token, $leading)) { |
| 312 | 312 | return true; |
| 313 | 313 | } |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | return false; |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | - public function getParameterOption(string|array $values, string|bool|int|float|array|null $default = false, bool $onlyParams = false): mixed |
|
| 320 | + public function getParameterOption(string | array $values, string | bool | int | float | array | null $default = false, bool $onlyParams = false): mixed |
|
| 321 | 321 | { |
| 322 | 322 | $values = (array) $values; |
| 323 | 323 | $tokens = $this->tokens; |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | // Options with values: |
| 336 | 336 | // For long options, test for '--option=' at beginning |
| 337 | 337 | // For short options, test for '-o' at beginning |
| 338 | - $leading = str_starts_with($value, '--') ? $value.'=' : $value; |
|
| 338 | + $leading = str_starts_with($value, '--') ? $value . '=' : $value; |
|
| 339 | 339 | if ('' !== $leading && str_starts_with($token, $leading)) { |
| 340 | 340 | return substr($token, \strlen($leading)); |
| 341 | 341 | } |
@@ -379,9 +379,9 @@ discard block |
||
| 379 | 379 | */ |
| 380 | 380 | public function __toString(): string |
| 381 | 381 | { |
| 382 | - $tokens = array_map(function ($token) { |
|
| 382 | + $tokens = array_map(function($token) { |
|
| 383 | 383 | if (preg_match('{^(-[^=]+=)(.+)}', $token, $match)) { |
| 384 | - return $match[1].$this->escapeToken($match[2]); |
|
| 384 | + return $match[1] . $this->escapeToken($match[2]); |
|
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | if ($token && '-' !== $token[0]) { |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | * @param string|array $values The values to look for in the raw parameters (can be an array) |
| 38 | 38 | * @param bool $onlyParams Only check real parameters, skip those following an end of options (--) signal |
| 39 | 39 | */ |
| 40 | - public function hasParameterOption(string|array $values, bool $onlyParams = false): bool; |
|
| 40 | + public function hasParameterOption(string | array $values, bool $onlyParams = false): bool; |
|
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | 43 | * Returns the value of a raw option (not parsed). |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | * @param string|bool|int|float|array|null $default The default value to return if no result is found |
| 52 | 52 | * @param bool $onlyParams Only check real parameters, skip those following an end of options (--) signal |
| 53 | 53 | */ |
| 54 | - public function getParameterOption(string|array $values, string|bool|int|float|array|null $default = false, bool $onlyParams = false): mixed; |
|
| 54 | + public function getParameterOption(string | array $values, string | bool | int | float | array | null $default = false, bool $onlyParams = false): mixed; |
|
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | 57 | * Binds the current Input instance with the given arguments and options. |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | public const IS_ARRAY = 4; |
| 42 | 42 | |
| 43 | 43 | private int $mode; |
| 44 | - private string|int|bool|array|float|null $default; |
|
| 44 | + private string | int | bool | array | float | null $default; |
|
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | 47 | * @param string $name The argument name |
@@ -56,8 +56,8 @@ discard block |
||
| 56 | 56 | private string $name, |
| 57 | 57 | ?int $mode = null, |
| 58 | 58 | private string $description = '', |
| 59 | - string|bool|int|float|array|null $default = null, |
|
| 60 | - private \Closure|array $suggestedValues = [], |
|
| 59 | + string | bool | int | float | array | null $default = null, |
|
| 60 | + private \Closure | array $suggestedValues = [], |
|
| 61 | 61 | ) { |
| 62 | 62 | if (null === $mode) { |
| 63 | 63 | $mode = self::OPTIONAL; |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | /** |
| 102 | 102 | * Sets the default value. |
| 103 | 103 | */ |
| 104 | - public function setDefault(string|bool|int|float|array|null $default): void |
|
| 104 | + public function setDefault(string | bool | int | float | array | null $default): void |
|
| 105 | 105 | { |
| 106 | 106 | if ($this->isRequired() && null !== $default) { |
| 107 | 107 | throw new LogicException('Cannot set a default value except for InputArgument::OPTIONAL mode.'); |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | /** |
| 122 | 122 | * Returns the default value. |
| 123 | 123 | */ |
| 124 | - public function getDefault(): string|bool|int|float|array|null |
|
| 124 | + public function getDefault(): string | bool | int | float | array | null |
|
| 125 | 125 | { |
| 126 | 126 | return $this->default; |
| 127 | 127 | } |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | * |
| 127 | 127 | * @throws InvalidArgumentException When argument given doesn't exist |
| 128 | 128 | */ |
| 129 | - public function getArgument(string|int $name): InputArgument |
|
| 129 | + public function getArgument(string | int $name): InputArgument |
|
| 130 | 130 | { |
| 131 | 131 | if (!$this->hasArgument($name)) { |
| 132 | 132 | throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name)); |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | /** |
| 141 | 141 | * Returns true if an InputArgument object exists by name or position. |
| 142 | 142 | */ |
| 143 | - public function hasArgument(string|int $name): bool |
|
| 143 | + public function hasArgument(string | int $name): bool |
|
| 144 | 144 | { |
| 145 | 145 | $arguments = \is_int($name) ? array_values($this->arguments) : $this->arguments; |
| 146 | 146 | |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | if ($option->isNegatable()) { |
| 242 | - $negatedName = 'no-'.$option->getName(); |
|
| 242 | + $negatedName = 'no-' . $option->getName(); |
|
| 243 | 243 | if (isset($this->options[$negatedName])) { |
| 244 | 244 | throw new LogicException(sprintf('An option named "%s" already exists.', $negatedName)); |
| 245 | 245 | } |
@@ -384,19 +384,19 @@ discard block |
||
| 384 | 384 | |
| 385 | 385 | $tail = ''; |
| 386 | 386 | foreach ($this->getArguments() as $argument) { |
| 387 | - $element = '<'.$argument->getName().'>'; |
|
| 387 | + $element = '<' . $argument->getName() . '>'; |
|
| 388 | 388 | if ($argument->isArray()) { |
| 389 | 389 | $element .= '...'; |
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | if (!$argument->isRequired()) { |
| 393 | - $element = '['.$element; |
|
| 393 | + $element = '[' . $element; |
|
| 394 | 394 | $tail .= ']'; |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | 397 | $elements[] = $element; |
| 398 | 398 | } |
| 399 | 399 | |
| 400 | - return implode(' ', $elements).$tail; |
|
| 400 | + return implode(' ', $elements) . $tail; |
|
| 401 | 401 | } |
| 402 | 402 | } |