@@ -187,7 +187,7 @@ |
||
| 187 | 187 | $stream = fopen('php://memory', 'r+', false); |
| 188 | 188 | |
| 189 | 189 | foreach ($inputs as $input) { |
| 190 | - fwrite($stream, $input.\PHP_EOL); |
|
| 190 | + fwrite($stream, $input . \PHP_EOL); |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | rewind($stream); |
@@ -48,7 +48,7 @@ |
||
| 48 | 48 | |
| 49 | 49 | $options = []; |
| 50 | 50 | foreach ($suggestions->getOptionSuggestions() as $option) { |
| 51 | - $options[] = '--'.$option->getName(); |
|
| 51 | + $options[] = '--' . $option->getName(); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | return array_map('strval', array_merge($options, $suggestions->getValueSuggestions())); |
@@ -69,7 +69,7 @@ |
||
| 69 | 69 | return false; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - return self::$stty = (bool) shell_exec('stty 2> '.('\\' === \DIRECTORY_SEPARATOR ? 'NUL' : '/dev/null')); |
|
| 72 | + return self::$stty = (bool) shell_exec('stty 2> ' . ('\\' === \DIRECTORY_SEPARATOR ? 'NUL' : '/dev/null')); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | private static function initDimensions() |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | if (null === $commandName) { |
| 81 | 81 | if (!$definition->isPublic() || $definition->isPrivate() || $definition->hasTag($this->privateTagName)) { |
| 82 | - $commandId = 'console.command.public_alias.'.$id; |
|
| 82 | + $commandId = 'console.command.public_alias.' . $id; |
|
| 83 | 83 | $container->setAlias($commandId, $id)->setPublic(true); |
| 84 | 84 | $id = $commandId; |
| 85 | 85 | } |
@@ -130,10 +130,10 @@ discard block |
||
| 130 | 130 | if ($description) { |
| 131 | 131 | $definition->addMethodCall('setDescription', [$description]); |
| 132 | 132 | |
| 133 | - $container->register('.'.$id.'.lazy', LazyCommand::class) |
|
| 133 | + $container->register('.' . $id . '.lazy', LazyCommand::class) |
|
| 134 | 134 | ->setArguments([$commandName, $aliases, $description, $isHidden, new ServiceClosureArgument($lazyCommandRefs[$id])]); |
| 135 | 135 | |
| 136 | - $lazyCommandRefs[$id] = new Reference('.'.$id.'.lazy'); |
|
| 136 | + $lazyCommandRefs[$id] = new Reference('.' . $id . '.lazy'); |
|
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | 139 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | public function listing(array $elements) |
| 103 | 103 | { |
| 104 | 104 | $this->autoPrependText(); |
| 105 | - $elements = array_map(function ($element) { |
|
| 105 | + $elements = array_map(function($element) { |
|
| 106 | 106 | return sprintf(' * %s', $element); |
| 107 | 107 | }, $elements); |
| 108 | 108 | |
@@ -502,10 +502,10 @@ discard block |
||
| 502 | 502 | |
| 503 | 503 | foreach ($lines as $i => &$line) { |
| 504 | 504 | if (null !== $type) { |
| 505 | - $line = $firstLineIndex === $i ? $type.$line : $lineIndentation.$line; |
|
| 505 | + $line = $firstLineIndex === $i ? $type . $line : $lineIndentation . $line; |
|
| 506 | 506 | } |
| 507 | 507 | |
| 508 | - $line = $prefix.$line; |
|
| 508 | + $line = $prefix . $line; |
|
| 509 | 509 | $line .= str_repeat(' ', max($this->lineLength - Helper::width(Helper::removeDecoration($this->getFormatter(), $line)), 0)); |
| 510 | 510 | |
| 511 | 511 | if ($style) { |
@@ -156,12 +156,12 @@ |
||
| 156 | 156 | if (\is_array($values)) { |
| 157 | 157 | $values = $this->isAssoc($values) ? array_merge(array_keys($values), array_values($values)) : array_values($values); |
| 158 | 158 | |
| 159 | - $callback = static function () use ($values) { |
|
| 159 | + $callback = static function() use ($values) { |
|
| 160 | 160 | return $values; |
| 161 | 161 | }; |
| 162 | 162 | } elseif ($values instanceof \Traversable) { |
| 163 | 163 | $valueCache = null; |
| 164 | - $callback = static function () use ($values, &$valueCache) { |
|
| 164 | + $callback = static function() use ($values, &$valueCache) { |
|
| 165 | 165 | return $valueCache ?? $valueCache = iterator_to_array($values, false); |
| 166 | 166 | }; |
| 167 | 167 | } else { |
@@ -122,7 +122,7 @@ |
||
| 122 | 122 | $multiselect = $this->multiselect; |
| 123 | 123 | $isAssoc = $this->isAssoc($choices); |
| 124 | 124 | |
| 125 | - return function ($selected) use ($choices, $errorMessage, $multiselect, $isAssoc) { |
|
| 125 | + return function($selected) use ($choices, $errorMessage, $multiselect, $isAssoc) { |
|
| 126 | 126 | if ($multiselect) { |
| 127 | 127 | // Check for a separated comma values |
| 128 | 128 | if (!preg_match('/^[^,]+(?:,[^,]+)*$/', (string) $selected, $matches)) { |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | $default = $this->getDefault(); |
| 42 | 42 | $regex = $this->trueAnswerRegex; |
| 43 | 43 | |
| 44 | - return function ($answer) use ($default, $regex) { |
|
| 44 | + return function($answer) use ($default, $regex) { |
|
| 45 | 45 | if (\is_bool($answer)) { |
| 46 | 46 | return $answer; |
| 47 | 47 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | return $this->doAsk($output, $question); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - $interviewer = function () use ($output, $question) { |
|
| 71 | + $interviewer = function() use ($output, $question) { |
|
| 72 | 72 | return $this->doAsk($output, $question); |
| 73 | 73 | }; |
| 74 | 74 | |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | if (null !== $this->getHelperSet() && $this->getHelperSet()->has('formatter')) { |
| 240 | 240 | $message = $this->getHelperSet()->get('formatter')->formatBlock($error->getMessage(), 'error'); |
| 241 | 241 | } else { |
| 242 | - $message = '<error>'.$error->getMessage().'</error>'; |
|
| 242 | + $message = '<error>' . $error->getMessage() . '</error>'; |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | $output->writeln($message); |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | |
| 284 | 284 | // as opposed to fgets(), fread() returns an empty string when the stream content is empty, not false. |
| 285 | 285 | if (false === $c || ('' === $ret && '' === $c && null === $question->getDefault())) { |
| 286 | - shell_exec('stty '.$sttyMode); |
|
| 286 | + shell_exec('stty ' . $sttyMode); |
|
| 287 | 287 | throw new MissingInputException('Aborted.'); |
| 288 | 288 | } elseif ("\177" === $c) { // Backspace Character |
| 289 | 289 | if (0 === $numMatches && 0 !== $i) { |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | |
| 333 | 333 | $matches = array_filter( |
| 334 | 334 | $autocomplete($ret), |
| 335 | - function ($match) use ($ret) { |
|
| 335 | + function($match) use ($ret) { |
|
| 336 | 336 | return '' === $ret || str_starts_with($match, $ret); |
| 337 | 337 | } |
| 338 | 338 | ); |
@@ -382,13 +382,13 @@ discard block |
||
| 382 | 382 | $cursor->savePosition(); |
| 383 | 383 | // Write highlighted text, complete the partially entered response |
| 384 | 384 | $charactersEntered = \strlen(trim($this->mostRecentlyEnteredValue($fullChoice))); |
| 385 | - $output->write('<hl>'.OutputFormatter::escapeTrailingBackslash(substr($matches[$ofs], $charactersEntered)).'</hl>'); |
|
| 385 | + $output->write('<hl>' . OutputFormatter::escapeTrailingBackslash(substr($matches[$ofs], $charactersEntered)) . '</hl>'); |
|
| 386 | 386 | $cursor->restorePosition(); |
| 387 | 387 | } |
| 388 | 388 | } |
| 389 | 389 | |
| 390 | 390 | // Reset stty so it behaves normally again |
| 391 | - shell_exec('stty '.$sttyMode); |
|
| 391 | + shell_exec('stty ' . $sttyMode); |
|
| 392 | 392 | |
| 393 | 393 | return $fullChoice; |
| 394 | 394 | } |
@@ -419,16 +419,16 @@ discard block |
||
| 419 | 419 | private function getHiddenResponse(OutputInterface $output, $inputStream, bool $trimmable = true): string |
| 420 | 420 | { |
| 421 | 421 | if ('\\' === \DIRECTORY_SEPARATOR) { |
| 422 | - $exe = __DIR__.'/../Resources/bin/hiddeninput.exe'; |
|
| 422 | + $exe = __DIR__ . '/../Resources/bin/hiddeninput.exe'; |
|
| 423 | 423 | |
| 424 | 424 | // handle code running from a phar |
| 425 | 425 | if ('phar:' === substr(__FILE__, 0, 5)) { |
| 426 | - $tmpExe = sys_get_temp_dir().'/hiddeninput.exe'; |
|
| 426 | + $tmpExe = sys_get_temp_dir() . '/hiddeninput.exe'; |
|
| 427 | 427 | copy($exe, $tmpExe); |
| 428 | 428 | $exe = $tmpExe; |
| 429 | 429 | } |
| 430 | 430 | |
| 431 | - $sExec = shell_exec('"'.$exe.'"'); |
|
| 431 | + $sExec = shell_exec('"' . $exe . '"'); |
|
| 432 | 432 | $value = $trimmable ? rtrim($sExec) : $sExec; |
| 433 | 433 | $output->writeln(''); |
| 434 | 434 | |
@@ -449,7 +449,7 @@ discard block |
||
| 449 | 449 | $value = fgets($inputStream, 4096); |
| 450 | 450 | |
| 451 | 451 | if (self::$stty && Terminal::hasSttyAvailable()) { |
| 452 | - shell_exec('stty '.$sttyMode); |
|
| 452 | + shell_exec('stty ' . $sttyMode); |
|
| 453 | 453 | } |
| 454 | 454 | |
| 455 | 455 | if (false === $value) { |