@@ -253,18 +253,18 @@ |
||
253 | 253 | } |
254 | 254 | |
255 | 255 | if ($currentLineLength) { |
256 | - $prefix = substr($text, 0, $i = $width - $currentLineLength)."\n"; |
|
256 | + $prefix = substr($text, 0, $i = $width - $currentLineLength) . "\n"; |
|
257 | 257 | $text = substr($text, $i); |
258 | 258 | } else { |
259 | 259 | $prefix = ''; |
260 | 260 | } |
261 | 261 | |
262 | 262 | preg_match('~(\\n)$~', $text, $matches); |
263 | - $text = $prefix.$this->addLineBreaks($text, $width); |
|
264 | - $text = rtrim($text, "\n").($matches[1] ?? ''); |
|
263 | + $text = $prefix . $this->addLineBreaks($text, $width); |
|
264 | + $text = rtrim($text, "\n") . ($matches[1] ?? ''); |
|
265 | 265 | |
266 | 266 | if (!$currentLineLength && '' !== $current && "\n" !== substr($current, -1)) { |
267 | - $text = "\n".$text; |
|
267 | + $text = "\n" . $text; |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | $lines = explode("\n", $text); |
@@ -117,16 +117,16 @@ discard block |
||
117 | 117 | private function getInputOptionData(InputOption $option, bool $negated = false): array |
118 | 118 | { |
119 | 119 | return $negated ? [ |
120 | - 'name' => '--no-'.$option->getName(), |
|
120 | + 'name' => '--no-' . $option->getName(), |
|
121 | 121 | 'shortcut' => '', |
122 | 122 | 'accept_value' => false, |
123 | 123 | 'is_value_required' => false, |
124 | 124 | 'is_multiple' => false, |
125 | - 'description' => 'Negate the "--'.$option->getName().'" option', |
|
125 | + 'description' => 'Negate the "--' . $option->getName() . '" option', |
|
126 | 126 | 'default' => false, |
127 | 127 | ] : [ |
128 | - 'name' => '--'.$option->getName(), |
|
129 | - 'shortcut' => $option->getShortcut() ? '-'.str_replace('|', '|-', $option->getShortcut()) : '', |
|
128 | + 'name' => '--' . $option->getName(), |
|
129 | + 'shortcut' => $option->getShortcut() ? '-' . str_replace('|', '|-', $option->getShortcut()) : '', |
|
130 | 130 | 'accept_value' => $option->acceptValue(), |
131 | 131 | 'is_value_required' => $option->isValueRequired(), |
132 | 132 | 'is_multiple' => $option->isArray(), |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | foreach ($definition->getOptions() as $name => $option) { |
147 | 147 | $inputOptions[$name] = $this->getInputOptionData($option); |
148 | 148 | if ($option->isNegatable()) { |
149 | - $inputOptions['no-'.$name] = $this->getInputOptionData($option, true); |
|
149 | + $inputOptions['no-' . $name] = $this->getInputOptionData($option, true); |
|
150 | 150 | } |
151 | 151 | } |
152 | 152 |
@@ -205,13 +205,13 @@ discard block |
||
205 | 205 | $dom = new \DOMDocument('1.0', 'UTF-8'); |
206 | 206 | |
207 | 207 | $dom->appendChild($objectXML = $dom->createElement('option')); |
208 | - $objectXML->setAttribute('name', '--'.$option->getName()); |
|
208 | + $objectXML->setAttribute('name', '--' . $option->getName()); |
|
209 | 209 | $pos = strpos($option->getShortcut() ?? '', '|'); |
210 | 210 | if (false !== $pos) { |
211 | - $objectXML->setAttribute('shortcut', '-'.substr($option->getShortcut(), 0, $pos)); |
|
212 | - $objectXML->setAttribute('shortcuts', '-'.str_replace('|', '|-', $option->getShortcut())); |
|
211 | + $objectXML->setAttribute('shortcut', '-' . substr($option->getShortcut(), 0, $pos)); |
|
212 | + $objectXML->setAttribute('shortcuts', '-' . str_replace('|', '|-', $option->getShortcut())); |
|
213 | 213 | } else { |
214 | - $objectXML->setAttribute('shortcut', $option->getShortcut() ? '-'.$option->getShortcut() : ''); |
|
214 | + $objectXML->setAttribute('shortcut', $option->getShortcut() ? '-' . $option->getShortcut() : ''); |
|
215 | 215 | } |
216 | 216 | $objectXML->setAttribute('accept_value', $option->acceptValue() ? 1 : 0); |
217 | 217 | $objectXML->setAttribute('is_value_required', $option->isValueRequired() ? 1 : 0); |
@@ -233,13 +233,13 @@ discard block |
||
233 | 233 | |
234 | 234 | if ($option->isNegatable()) { |
235 | 235 | $dom->appendChild($objectXML = $dom->createElement('option')); |
236 | - $objectXML->setAttribute('name', '--no-'.$option->getName()); |
|
236 | + $objectXML->setAttribute('name', '--no-' . $option->getName()); |
|
237 | 237 | $objectXML->setAttribute('shortcut', ''); |
238 | 238 | $objectXML->setAttribute('accept_value', 0); |
239 | 239 | $objectXML->setAttribute('is_value_required', 0); |
240 | 240 | $objectXML->setAttribute('is_multiple', 0); |
241 | 241 | $objectXML->appendChild($descriptionXML = $dom->createElement('description')); |
242 | - $descriptionXML->appendChild($dom->createTextNode('Negate the "--'.$option->getName().'" option')); |
|
242 | + $descriptionXML->appendChild($dom->createTextNode('Negate the "--' . $option->getName() . '" option')); |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | return $dom; |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $argument->getName(), |
47 | 47 | str_repeat(' ', $spacingWidth), |
48 | 48 | // + 4 = 2 spaces before <info>, 2 spaces after </info> |
49 | - preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $argument->getDescription()), |
|
49 | + preg_replace('/\s*[\r\n]\s*/', "\n" . str_repeat(' ', $totalWidth + 4), $argument->getDescription()), |
|
50 | 50 | $default |
51 | 51 | ), $options); |
52 | 52 | } |
@@ -64,10 +64,10 @@ discard block |
||
64 | 64 | |
65 | 65 | $value = ''; |
66 | 66 | if ($option->acceptValue()) { |
67 | - $value = '='.strtoupper($option->getName()); |
|
67 | + $value = '=' . strtoupper($option->getName()); |
|
68 | 68 | |
69 | 69 | if ($option->isValueOptional()) { |
70 | - $value = '['.$value.']'; |
|
70 | + $value = '[' . $value . ']'; |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $synopsis, |
84 | 84 | str_repeat(' ', $spacingWidth), |
85 | 85 | // + 4 = 2 spaces before <info>, 2 spaces after </info> |
86 | - preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $option->getDescription()), |
|
86 | + preg_replace('/\s*[\r\n]\s*/', "\n" . str_repeat(' ', $totalWidth + 4), $option->getDescription()), |
|
87 | 87 | $default, |
88 | 88 | $option->isArray() ? '<comment> (multiple values allowed)</comment>' : '' |
89 | 89 | ), $options); |
@@ -141,14 +141,14 @@ discard block |
||
141 | 141 | if ($description = $command->getDescription()) { |
142 | 142 | $this->writeText('<comment>Description:</comment>', $options); |
143 | 143 | $this->writeText("\n"); |
144 | - $this->writeText(' '.$description); |
|
144 | + $this->writeText(' ' . $description); |
|
145 | 145 | $this->writeText("\n\n"); |
146 | 146 | } |
147 | 147 | |
148 | 148 | $this->writeText('<comment>Usage:</comment>', $options); |
149 | 149 | foreach (array_merge([$command->getSynopsis(true)], $command->getAliases(), $command->getUsages()) as $usage) { |
150 | 150 | $this->writeText("\n"); |
151 | - $this->writeText(' '.OutputFormatter::escape($usage), $options); |
|
151 | + $this->writeText(' ' . OutputFormatter::escape($usage), $options); |
|
152 | 152 | } |
153 | 153 | $this->writeText("\n"); |
154 | 154 | |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | $this->writeText("\n"); |
165 | 165 | $this->writeText('<comment>Help:</comment>', $options); |
166 | 166 | $this->writeText("\n"); |
167 | - $this->writeText(' '.str_replace("\n", "\n ", $help), $options); |
|
167 | + $this->writeText(' ' . str_replace("\n", "\n ", $help), $options); |
|
168 | 168 | $this->writeText("\n"); |
169 | 169 | } |
170 | 170 | } |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | } |
209 | 209 | |
210 | 210 | // calculate max. width based on available commands per namespace |
211 | - $width = $this->getColumnWidth(array_merge(...array_values(array_map(function ($namespace) use ($commands) { |
|
211 | + $width = $this->getColumnWidth(array_merge(...array_values(array_map(function($namespace) use ($commands) { |
|
212 | 212 | return array_intersect($namespace['commands'], array_keys($commands)); |
213 | 213 | }, array_values($namespaces))))); |
214 | 214 | |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | } |
220 | 220 | |
221 | 221 | foreach ($namespaces as $namespace) { |
222 | - $namespace['commands'] = array_filter($namespace['commands'], function ($name) use ($commands) { |
|
222 | + $namespace['commands'] = array_filter($namespace['commands'], function($name) use ($commands) { |
|
223 | 223 | return isset($commands[$name]); |
224 | 224 | }); |
225 | 225 | |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | |
230 | 230 | if (!$describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) { |
231 | 231 | $this->writeText("\n"); |
232 | - $this->writeText(' <comment>'.$namespace['id'].'</comment>', $options); |
|
232 | + $this->writeText(' <comment>' . $namespace['id'] . '</comment>', $options); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | foreach ($namespace['commands'] as $name) { |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | $spacingWidth = $width - Helper::width($name); |
238 | 238 | $command = $commands[$name]; |
239 | 239 | $commandAliases = $name === $command->getName() ? $this->getCommandAliasesText($command) : ''; |
240 | - $this->writeText(sprintf(' <info>%s</info>%s%s', $name, str_repeat(' ', $spacingWidth), $commandAliases.$command->getDescription()), $options); |
|
240 | + $this->writeText(sprintf(' <info>%s</info>%s%s', $name, str_repeat(' ', $spacingWidth), $commandAliases . $command->getDescription()), $options); |
|
241 | 241 | } |
242 | 242 | } |
243 | 243 | |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | $aliases = $command->getAliases(); |
266 | 266 | |
267 | 267 | if ($aliases) { |
268 | - $text = '['.implode('|', $aliases).'] '; |
|
268 | + $text = '[' . implode('|', $aliases) . '] '; |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | return $text; |
@@ -55,11 +55,11 @@ discard block |
||
55 | 55 | protected function describeInputArgument(InputArgument $argument, array $options = []) |
56 | 56 | { |
57 | 57 | $this->write( |
58 | - '#### `'.($argument->getName() ?: '<none>')."`\n\n" |
|
59 | - .($argument->getDescription() ? preg_replace('/\s*[\r\n]\s*/', "\n", $argument->getDescription())."\n\n" : '') |
|
60 | - .'* Is required: '.($argument->isRequired() ? 'yes' : 'no')."\n" |
|
61 | - .'* Is array: '.($argument->isArray() ? 'yes' : 'no')."\n" |
|
62 | - .'* Default: `'.str_replace("\n", '', var_export($argument->getDefault(), true)).'`' |
|
58 | + '#### `' . ($argument->getName() ?: '<none>') . "`\n\n" |
|
59 | + .($argument->getDescription() ? preg_replace('/\s*[\r\n]\s*/', "\n", $argument->getDescription()) . "\n\n" : '') |
|
60 | + .'* Is required: ' . ($argument->isRequired() ? 'yes' : 'no') . "\n" |
|
61 | + .'* Is array: ' . ($argument->isArray() ? 'yes' : 'no') . "\n" |
|
62 | + .'* Default: `' . str_replace("\n", '', var_export($argument->getDefault(), true)) . '`' |
|
63 | 63 | ); |
64 | 64 | } |
65 | 65 | |
@@ -68,22 +68,22 @@ discard block |
||
68 | 68 | */ |
69 | 69 | protected function describeInputOption(InputOption $option, array $options = []) |
70 | 70 | { |
71 | - $name = '--'.$option->getName(); |
|
71 | + $name = '--' . $option->getName(); |
|
72 | 72 | if ($option->isNegatable()) { |
73 | - $name .= '|--no-'.$option->getName(); |
|
73 | + $name .= '|--no-' . $option->getName(); |
|
74 | 74 | } |
75 | 75 | if ($option->getShortcut()) { |
76 | - $name .= '|-'.str_replace('|', '|-', $option->getShortcut()).''; |
|
76 | + $name .= '|-' . str_replace('|', '|-', $option->getShortcut()) . ''; |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | $this->write( |
80 | - '#### `'.$name.'`'."\n\n" |
|
81 | - .($option->getDescription() ? preg_replace('/\s*[\r\n]\s*/', "\n", $option->getDescription())."\n\n" : '') |
|
82 | - .'* Accept value: '.($option->acceptValue() ? 'yes' : 'no')."\n" |
|
83 | - .'* Is value required: '.($option->isValueRequired() ? 'yes' : 'no')."\n" |
|
84 | - .'* Is multiple: '.($option->isArray() ? 'yes' : 'no')."\n" |
|
85 | - .'* Is negatable: '.($option->isNegatable() ? 'yes' : 'no')."\n" |
|
86 | - .'* Default: `'.str_replace("\n", '', var_export($option->getDefault(), true)).'`' |
|
80 | + '#### `' . $name . '`' . "\n\n" |
|
81 | + .($option->getDescription() ? preg_replace('/\s*[\r\n]\s*/', "\n", $option->getDescription()) . "\n\n" : '') |
|
82 | + .'* Accept value: ' . ($option->acceptValue() ? 'yes' : 'no') . "\n" |
|
83 | + .'* Is value required: ' . ($option->isValueRequired() ? 'yes' : 'no') . "\n" |
|
84 | + .'* Is multiple: ' . ($option->isArray() ? 'yes' : 'no') . "\n" |
|
85 | + .'* Is negatable: ' . ($option->isNegatable() ? 'yes' : 'no') . "\n" |
|
86 | + .'* Default: `' . str_replace("\n", '', var_export($option->getDefault(), true)) . '`' |
|
87 | 87 | ); |
88 | 88 | } |
89 | 89 | |
@@ -124,12 +124,12 @@ discard block |
||
124 | 124 | { |
125 | 125 | if ($options['short'] ?? false) { |
126 | 126 | $this->write( |
127 | - '`'.$command->getName()."`\n" |
|
128 | - .str_repeat('-', Helper::width($command->getName()) + 2)."\n\n" |
|
129 | - .($command->getDescription() ? $command->getDescription()."\n\n" : '') |
|
130 | - .'### Usage'."\n\n" |
|
131 | - .array_reduce($command->getAliases(), function ($carry, $usage) { |
|
132 | - return $carry.'* `'.$usage.'`'."\n"; |
|
127 | + '`' . $command->getName() . "`\n" |
|
128 | + .str_repeat('-', Helper::width($command->getName()) + 2) . "\n\n" |
|
129 | + .($command->getDescription() ? $command->getDescription() . "\n\n" : '') |
|
130 | + .'### Usage' . "\n\n" |
|
131 | + .array_reduce($command->getAliases(), function($carry, $usage) { |
|
132 | + return $carry . '* `' . $usage . '`' . "\n"; |
|
133 | 133 | }) |
134 | 134 | ); |
135 | 135 | |
@@ -139,12 +139,12 @@ discard block |
||
139 | 139 | $command->mergeApplicationDefinition(false); |
140 | 140 | |
141 | 141 | $this->write( |
142 | - '`'.$command->getName()."`\n" |
|
143 | - .str_repeat('-', Helper::width($command->getName()) + 2)."\n\n" |
|
144 | - .($command->getDescription() ? $command->getDescription()."\n\n" : '') |
|
145 | - .'### Usage'."\n\n" |
|
146 | - .array_reduce(array_merge([$command->getSynopsis()], $command->getAliases(), $command->getUsages()), function ($carry, $usage) { |
|
147 | - return $carry.'* `'.$usage.'`'."\n"; |
|
142 | + '`' . $command->getName() . "`\n" |
|
143 | + .str_repeat('-', Helper::width($command->getName()) + 2) . "\n\n" |
|
144 | + .($command->getDescription() ? $command->getDescription() . "\n\n" : '') |
|
145 | + .'### Usage' . "\n\n" |
|
146 | + .array_reduce(array_merge([$command->getSynopsis()], $command->getAliases(), $command->getUsages()), function($carry, $usage) { |
|
147 | + return $carry . '* `' . $usage . '`' . "\n"; |
|
148 | 148 | }) |
149 | 149 | ); |
150 | 150 | |
@@ -169,16 +169,16 @@ discard block |
||
169 | 169 | $description = new ApplicationDescription($application, $describedNamespace); |
170 | 170 | $title = $this->getApplicationTitle($application); |
171 | 171 | |
172 | - $this->write($title."\n".str_repeat('=', Helper::width($title))); |
|
172 | + $this->write($title . "\n" . str_repeat('=', Helper::width($title))); |
|
173 | 173 | |
174 | 174 | foreach ($description->getNamespaces() as $namespace) { |
175 | 175 | if (ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) { |
176 | 176 | $this->write("\n\n"); |
177 | - $this->write('**'.$namespace['id'].':**'); |
|
177 | + $this->write('**' . $namespace['id'] . ':**'); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | $this->write("\n\n"); |
181 | - $this->write(implode("\n", array_map(function ($commandName) use ($description) { |
|
181 | + $this->write(implode("\n", array_map(function($commandName) use ($description) { |
|
182 | 182 | return sprintf('* [`%s`](#%s)', $commandName, str_replace(':', '', $description->getCommand($commandName)->getName())); |
183 | 183 | }, $namespace['commands']))); |
184 | 184 | } |
@@ -115,9 +115,9 @@ |
||
115 | 115 | } elseif ($val instanceof \DateTimeInterface) { |
116 | 116 | $replacements["{{$key}}"] = $val->format(\DateTime::RFC3339); |
117 | 117 | } elseif (\is_object($val)) { |
118 | - $replacements["{{$key}}"] = '[object '.\get_class($val).']'; |
|
118 | + $replacements["{{$key}}"] = '[object ' . \get_class($val) . ']'; |
|
119 | 119 | } else { |
120 | - $replacements["{{$key}}"] = '['.\gettype($val).']'; |
|
120 | + $replacements["{{$key}}"] = '[' . \gettype($val) . ']'; |
|
121 | 121 | } |
122 | 122 | } |
123 | 123 |
@@ -137,8 +137,8 @@ discard block |
||
137 | 137 | public function run(?InputInterface $input = null, ?OutputInterface $output = null) |
138 | 138 | { |
139 | 139 | if (\function_exists('putenv')) { |
140 | - @putenv('LINES='.$this->terminal->getHeight()); |
|
141 | - @putenv('COLUMNS='.$this->terminal->getWidth()); |
|
140 | + @putenv('LINES=' . $this->terminal->getHeight()); |
|
141 | + @putenv('COLUMNS=' . $this->terminal->getWidth()); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | if (null === $input) { |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | $output = new ConsoleOutput(); |
150 | 150 | } |
151 | 151 | |
152 | - $renderException = function (\Throwable $e) use ($output) { |
|
152 | + $renderException = function(\Throwable $e) use ($output) { |
|
153 | 153 | if ($output instanceof ConsoleOutputInterface) { |
154 | 154 | $this->renderThrowable($e, $output->getErrorOutput()); |
155 | 155 | } else { |
@@ -631,8 +631,8 @@ discard block |
||
631 | 631 | public function findNamespace(string $namespace) |
632 | 632 | { |
633 | 633 | $allNamespaces = $this->getNamespaces(); |
634 | - $expr = implode('[^:]*:', array_map('preg_quote', explode(':', $namespace))).'[^:]*'; |
|
635 | - $namespaces = preg_grep('{^'.$expr.'}', $allNamespaces); |
|
634 | + $expr = implode('[^:]*:', array_map('preg_quote', explode(':', $namespace))) . '[^:]*'; |
|
635 | + $namespaces = preg_grep('{^' . $expr . '}', $allNamespaces); |
|
636 | 636 | |
637 | 637 | if (empty($namespaces)) { |
638 | 638 | $message = sprintf('There are no commands defined in the "%s" namespace.', $namespace); |
@@ -687,15 +687,15 @@ discard block |
||
687 | 687 | } |
688 | 688 | |
689 | 689 | $allCommands = $this->commandLoader ? array_merge($this->commandLoader->getNames(), array_keys($this->commands)) : array_keys($this->commands); |
690 | - $expr = implode('[^:]*:', array_map('preg_quote', explode(':', $name))).'[^:]*'; |
|
691 | - $commands = preg_grep('{^'.$expr.'}', $allCommands); |
|
690 | + $expr = implode('[^:]*:', array_map('preg_quote', explode(':', $name))) . '[^:]*'; |
|
691 | + $commands = preg_grep('{^' . $expr . '}', $allCommands); |
|
692 | 692 | |
693 | 693 | if (empty($commands)) { |
694 | - $commands = preg_grep('{^'.$expr.'}i', $allCommands); |
|
694 | + $commands = preg_grep('{^' . $expr . '}i', $allCommands); |
|
695 | 695 | } |
696 | 696 | |
697 | 697 | // if no commands matched or we just matched namespaces |
698 | - if (empty($commands) || \count(preg_grep('{^'.$expr.'$}i', $commands)) < 1) { |
|
698 | + if (empty($commands) || \count(preg_grep('{^' . $expr . '$}i', $commands)) < 1) { |
|
699 | 699 | if (false !== $pos = strrpos($name, ':')) { |
700 | 700 | // check if a namespace exists and contains commands |
701 | 701 | $this->findNamespace(substr($name, 0, $pos)); |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | |
706 | 706 | if ($alternatives = $this->findAlternatives($name, $allCommands)) { |
707 | 707 | // remove hidden commands |
708 | - $alternatives = array_filter($alternatives, function ($name) { |
|
708 | + $alternatives = array_filter($alternatives, function($name) { |
|
709 | 709 | return !$this->get($name)->isHidden(); |
710 | 710 | }); |
711 | 711 | |
@@ -723,7 +723,7 @@ discard block |
||
723 | 723 | // filter out aliases for commands which are already on the list |
724 | 724 | if (\count($commands) > 1) { |
725 | 725 | $commandList = $this->commandLoader ? array_merge(array_flip($this->commandLoader->getNames()), $this->commands) : $this->commands; |
726 | - $commands = array_unique(array_filter($commands, function ($nameOrAlias) use (&$commandList, $commands, &$aliases) { |
|
726 | + $commands = array_unique(array_filter($commands, function($nameOrAlias) use (&$commandList, $commands, &$aliases) { |
|
727 | 727 | if (!$commandList[$nameOrAlias] instanceof Command) { |
728 | 728 | $commandList[$nameOrAlias] = $this->commandLoader->get($nameOrAlias); |
729 | 729 | } |
@@ -743,16 +743,16 @@ discard block |
||
743 | 743 | foreach ($abbrevs as $abbrev) { |
744 | 744 | $maxLen = max(Helper::width($abbrev), $maxLen); |
745 | 745 | } |
746 | - $abbrevs = array_map(function ($cmd) use ($commandList, $usableWidth, $maxLen, &$commands) { |
|
746 | + $abbrevs = array_map(function($cmd) use ($commandList, $usableWidth, $maxLen, &$commands) { |
|
747 | 747 | if ($commandList[$cmd]->isHidden()) { |
748 | 748 | unset($commands[array_search($cmd, $commands)]); |
749 | 749 | |
750 | 750 | return false; |
751 | 751 | } |
752 | 752 | |
753 | - $abbrev = str_pad($cmd, $maxLen, ' ').' '.$commandList[$cmd]->getDescription(); |
|
753 | + $abbrev = str_pad($cmd, $maxLen, ' ') . ' ' . $commandList[$cmd]->getDescription(); |
|
754 | 754 | |
755 | - return Helper::width($abbrev) > $usableWidth ? Helper::substr($abbrev, 0, $usableWidth - 3).'...' : $abbrev; |
|
755 | + return Helper::width($abbrev) > $usableWidth ? Helper::substr($abbrev, 0, $usableWidth - 3) . '...' : $abbrev; |
|
756 | 756 | }, array_values($commands)); |
757 | 757 | |
758 | 758 | if (\count($commands) > 1) { |
@@ -851,15 +851,15 @@ discard block |
||
851 | 851 | $message = trim($e->getMessage()); |
852 | 852 | if ('' === $message || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) { |
853 | 853 | $class = get_debug_type($e); |
854 | - $title = sprintf(' [%s%s] ', $class, 0 !== ($code = $e->getCode()) ? ' ('.$code.')' : ''); |
|
854 | + $title = sprintf(' [%s%s] ', $class, 0 !== ($code = $e->getCode()) ? ' (' . $code . ')' : ''); |
|
855 | 855 | $len = Helper::width($title); |
856 | 856 | } else { |
857 | 857 | $len = 0; |
858 | 858 | } |
859 | 859 | |
860 | 860 | if (str_contains($message, "@anonymous\0")) { |
861 | - $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]++/', function ($m) { |
|
862 | - return class_exists($m[0], false) ? (get_parent_class($m[0]) ?: key(class_implements($m[0])) ?: 'class').'@anonymous' : $m[0]; |
|
861 | + $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]++/', function($m) { |
|
862 | + return class_exists($m[0], false) ? (get_parent_class($m[0]) ?: key(class_implements($m[0])) ?: 'class') . '@anonymous' : $m[0]; |
|
863 | 863 | }, $message); |
864 | 864 | } |
865 | 865 | |
@@ -911,7 +911,7 @@ discard block |
||
911 | 911 | $file = $trace[$i]['file'] ?? 'n/a'; |
912 | 912 | $line = $trace[$i]['line'] ?? 'n/a'; |
913 | 913 | |
914 | - $output->writeln(sprintf(' %s%s at <info>%s:%s</info>', $class, $function ? $type.$function.'()' : '', $file, $line), OutputInterface::VERBOSITY_QUIET); |
|
914 | + $output->writeln(sprintf(' %s%s at <info>%s:%s</info>', $class, $function ? $type . $function . '()' : '', $file, $line), OutputInterface::VERBOSITY_QUIET); |
|
915 | 915 | } |
916 | 916 | |
917 | 917 | $output->writeln('', OutputInterface::VERBOSITY_QUIET); |
@@ -973,7 +973,7 @@ discard block |
||
973 | 973 | } |
974 | 974 | |
975 | 975 | if (\function_exists('putenv')) { |
976 | - @putenv('SHELL_VERBOSITY='.$shellVerbosity); |
|
976 | + @putenv('SHELL_VERBOSITY=' . $shellVerbosity); |
|
977 | 977 | } |
978 | 978 | $_ENV['SHELL_VERBOSITY'] = $shellVerbosity; |
979 | 979 | $_SERVER['SHELL_VERBOSITY'] = $shellVerbosity; |
@@ -1007,8 +1007,8 @@ discard block |
||
1007 | 1007 | $sttyMode = shell_exec('stty -g'); |
1008 | 1008 | |
1009 | 1009 | foreach ([\SIGINT, \SIGTERM] as $signal) { |
1010 | - $this->signalRegistry->register($signal, static function () use ($sttyMode) { |
|
1011 | - shell_exec('stty '.$sttyMode); |
|
1010 | + $this->signalRegistry->register($signal, static function() use ($sttyMode) { |
|
1011 | + shell_exec('stty ' . $sttyMode); |
|
1012 | 1012 | }); |
1013 | 1013 | } |
1014 | 1014 | } |
@@ -1018,7 +1018,7 @@ discard block |
||
1018 | 1018 | foreach ($this->signalsToDispatchEvent as $signal) { |
1019 | 1019 | $event = new ConsoleSignalEvent($command, $input, $output, $signal); |
1020 | 1020 | |
1021 | - $this->signalRegistry->register($signal, function ($signal, $hasNext) use ($event) { |
|
1021 | + $this->signalRegistry->register($signal, function($signal, $hasNext) use ($event) { |
|
1022 | 1022 | $this->dispatcher->dispatch($event, ConsoleEvents::SIGNAL); |
1023 | 1023 | |
1024 | 1024 | // No more handlers, we try to simulate PHP default behavior |
@@ -1098,7 +1098,7 @@ discard block |
||
1098 | 1098 | { |
1099 | 1099 | return new InputDefinition([ |
1100 | 1100 | new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'), |
1101 | - 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'), |
|
1101 | + 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'), |
|
1102 | 1102 | new InputOption('--quiet', '-q', InputOption::VALUE_NONE, 'Do not output any message'), |
1103 | 1103 | 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'), |
1104 | 1104 | new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version'), |
@@ -1137,7 +1137,7 @@ discard block |
||
1137 | 1137 | */ |
1138 | 1138 | private function getAbbreviationSuggestions(array $abbrevs): string |
1139 | 1139 | { |
1140 | - return ' '.implode("\n ", $abbrevs); |
|
1140 | + return ' ' . implode("\n ", $abbrevs); |
|
1141 | 1141 | } |
1142 | 1142 | |
1143 | 1143 | /** |
@@ -1196,7 +1196,7 @@ discard block |
||
1196 | 1196 | } |
1197 | 1197 | } |
1198 | 1198 | |
1199 | - $alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2 * $threshold; }); |
|
1199 | + $alternatives = array_filter($alternatives, function($lev) use ($threshold) { return $lev < 2 * $threshold; }); |
|
1200 | 1200 | ksort($alternatives, \SORT_NATURAL | \SORT_FLAG_CASE); |
1201 | 1201 | |
1202 | 1202 | return array_keys($alternatives); |
@@ -1248,7 +1248,7 @@ discard block |
||
1248 | 1248 | |
1249 | 1249 | foreach (preg_split('//u', $m[0]) as $char) { |
1250 | 1250 | // test if $char could be appended to current line |
1251 | - if (mb_strwidth($line.$char, 'utf8') <= $width) { |
|
1251 | + if (mb_strwidth($line . $char, 'utf8') <= $width) { |
|
1252 | 1252 | $line .= $char; |
1253 | 1253 | continue; |
1254 | 1254 | } |
@@ -1278,7 +1278,7 @@ discard block |
||
1278 | 1278 | |
1279 | 1279 | foreach ($parts as $part) { |
1280 | 1280 | if (\count($namespaces)) { |
1281 | - $namespaces[] = end($namespaces).':'.$part; |
|
1281 | + $namespaces[] = end($namespaces) . ':' . $part; |
|
1282 | 1282 | } else { |
1283 | 1283 | $namespaces[] = $part; |
1284 | 1284 | } |
@@ -23,9 +23,9 @@ |
||
23 | 23 | { |
24 | 24 | $values = $suggestions->getValueSuggestions(); |
25 | 25 | foreach ($suggestions->getOptionSuggestions() as $option) { |
26 | - $values[] = '--'.$option->getName(); |
|
26 | + $values[] = '--' . $option->getName(); |
|
27 | 27 | if ($option->isNegatable()) { |
28 | - $values[] = '--no-'.$option->getName(); |
|
28 | + $values[] = '--no-' . $option->getName(); |
|
29 | 29 | } |
30 | 30 | } |
31 | 31 | $output->writeln(implode("\n", $values)); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | protected function configure(): void |
50 | 50 | { |
51 | 51 | $this |
52 | - ->addOption('shell', 's', InputOption::VALUE_REQUIRED, 'The shell type ("'.implode('", "', array_keys($this->completionOutputs)).'")') |
|
52 | + ->addOption('shell', 's', InputOption::VALUE_REQUIRED, 'The shell type ("' . implode('", "', array_keys($this->completionOutputs)) . '")') |
|
53 | 53 | ->addOption('input', 'i', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'An array of input tokens (e.g. COMP_WORDS or argv)') |
54 | 54 | ->addOption('current', 'c', InputOption::VALUE_REQUIRED, 'The index of the "input" array that the cursor is in (e.g. COMP_CWORD)') |
55 | 55 | ->addOption('symfony', 'S', InputOption::VALUE_REQUIRED, 'The version of the completion script') |
@@ -89,11 +89,11 @@ discard block |
||
89 | 89 | |
90 | 90 | $this->log([ |
91 | 91 | '', |
92 | - '<comment>'.date('Y-m-d H:i:s').'</>', |
|
92 | + '<comment>' . date('Y-m-d H:i:s') . '</>', |
|
93 | 93 | '<info>Input:</> <comment>("|" indicates the cursor position)</>', |
94 | - ' '.(string) $completionInput, |
|
94 | + ' ' . (string) $completionInput, |
|
95 | 95 | '<info>Command:</>', |
96 | - ' '.(string) implode(' ', $_SERVER['argv']), |
|
96 | + ' ' . (string) implode(' ', $_SERVER['argv']), |
|
97 | 97 | '<info>Messages:</>', |
98 | 98 | ]); |
99 | 99 | |
@@ -116,16 +116,16 @@ discard block |
||
116 | 116 | $completionInput->bind($command->getDefinition()); |
117 | 117 | |
118 | 118 | if (CompletionInput::TYPE_OPTION_NAME === $completionInput->getCompletionType()) { |
119 | - $this->log(' Completing option names for the <comment>'.\get_class($command instanceof LazyCommand ? $command->getCommand() : $command).'</> command.'); |
|
119 | + $this->log(' Completing option names for the <comment>' . \get_class($command instanceof LazyCommand ? $command->getCommand() : $command) . '</> command.'); |
|
120 | 120 | |
121 | 121 | $suggestions->suggestOptions($command->getDefinition()->getOptions()); |
122 | 122 | } else { |
123 | 123 | $this->log([ |
124 | - ' Completing using the <comment>'.\get_class($command instanceof LazyCommand ? $command->getCommand() : $command).'</> class.', |
|
125 | - ' Completing <comment>'.$completionInput->getCompletionType().'</> for <comment>'.$completionInput->getCompletionName().'</>', |
|
124 | + ' Completing using the <comment>' . \get_class($command instanceof LazyCommand ? $command->getCommand() : $command) . '</> class.', |
|
125 | + ' Completing <comment>' . $completionInput->getCompletionType() . '</> for <comment>' . $completionInput->getCompletionName() . '</>', |
|
126 | 126 | ]); |
127 | 127 | if (null !== $compval = $completionInput->getCompletionValue()) { |
128 | - $this->log(' Current value: <comment>'.$compval.'</>'); |
|
128 | + $this->log(' Current value: <comment>' . $compval . '</>'); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | $command->complete($completionInput, $suggestions); |
@@ -137,9 +137,9 @@ discard block |
||
137 | 137 | |
138 | 138 | $this->log('<info>Suggestions:</>'); |
139 | 139 | if ($options = $suggestions->getOptionSuggestions()) { |
140 | - $this->log(' --'.implode(' --', array_map(function ($o) { return $o->getName(); }, $options))); |
|
140 | + $this->log(' --' . implode(' --', array_map(function($o) { return $o->getName(); }, $options))); |
|
141 | 141 | } elseif ($values = $suggestions->getValueSuggestions()) { |
142 | - $this->log(' '.implode(' ', $values)); |
|
142 | + $this->log(' ' . implode(' ', $values)); |
|
143 | 143 | } else { |
144 | 144 | $this->log(' <comment>No suggestions were provided</>'); |
145 | 145 | } |
@@ -200,6 +200,6 @@ discard block |
||
200 | 200 | } |
201 | 201 | |
202 | 202 | $commandName = basename($_SERVER['argv'][0]); |
203 | - file_put_contents(sys_get_temp_dir().'/sf_'.$commandName.'.log', implode(\PHP_EOL, (array) $messages).\PHP_EOL, \FILE_APPEND); |
|
203 | + file_put_contents(sys_get_temp_dir() . '/sf_' . $commandName . '.log', implode(\PHP_EOL, (array) $messages) . \PHP_EOL, \FILE_APPEND); |
|
204 | 204 | } |
205 | 205 | } |