@@ -16,8 +16,7 @@ |
||
16 | 16 | * |
17 | 17 | * @author Fabien Potencier <[email protected]> |
18 | 18 | */ |
19 | -final class ConsoleCommandEvent extends ConsoleEvent |
|
20 | -{ |
|
19 | +final class ConsoleCommandEvent extends ConsoleEvent { |
|
21 | 20 | /** |
22 | 21 | * The return code for skipped commands, this will also be passed into the terminate event. |
23 | 22 | */ |
@@ -20,13 +20,11 @@ |
||
20 | 20 | * |
21 | 21 | * @author Wouter de Jong <[email protected]> |
22 | 22 | */ |
23 | -final class ConsoleErrorEvent extends ConsoleEvent |
|
24 | -{ |
|
23 | +final class ConsoleErrorEvent extends ConsoleEvent { |
|
25 | 24 | private $error; |
26 | 25 | private $exitCode; |
27 | 26 | |
28 | - public function __construct(InputInterface $input, OutputInterface $output, \Throwable $error, Command $command = null) |
|
29 | - { |
|
27 | + public function __construct(InputInterface $input, OutputInterface $output, \Throwable $error, Command $command = null) { |
|
30 | 28 | parent::__construct($command, $input, $output); |
31 | 29 | |
32 | 30 | $this->error = $error; |
@@ -20,12 +20,10 @@ |
||
20 | 20 | * |
21 | 21 | * @author Francesco Levorato <[email protected]> |
22 | 22 | */ |
23 | -final class ConsoleTerminateEvent extends ConsoleEvent |
|
24 | -{ |
|
23 | +final class ConsoleTerminateEvent extends ConsoleEvent { |
|
25 | 24 | private $exitCode; |
26 | 25 | |
27 | - public function __construct(Command $command, InputInterface $input, OutputInterface $output, int $exitCode) |
|
28 | - { |
|
26 | + public function __construct(Command $command, InputInterface $input, OutputInterface $output, int $exitCode) { |
|
29 | 27 | parent::__construct($command, $input, $output); |
30 | 28 | |
31 | 29 | $this->setExitCode($exitCode); |
@@ -21,15 +21,13 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @author Francesco Levorato <[email protected]> |
23 | 23 | */ |
24 | -class ConsoleEvent extends Event |
|
25 | -{ |
|
24 | +class ConsoleEvent extends Event { |
|
26 | 25 | protected $command; |
27 | 26 | |
28 | 27 | private $input; |
29 | 28 | private $output; |
30 | 29 | |
31 | - public function __construct(?Command $command, InputInterface $input, OutputInterface $output) |
|
32 | - { |
|
30 | + public function __construct(?Command $command, InputInterface $input, OutputInterface $output) { |
|
33 | 31 | $this->command = $command; |
34 | 32 | $this->input = $input; |
35 | 33 | $this->output = $output; |
@@ -40,8 +38,7 @@ discard block |
||
40 | 38 | * |
41 | 39 | * @return Command|null A Command instance |
42 | 40 | */ |
43 | - public function getCommand() |
|
44 | - { |
|
41 | + public function getCommand() { |
|
45 | 42 | return $this->command; |
46 | 43 | } |
47 | 44 | |
@@ -50,8 +47,7 @@ discard block |
||
50 | 47 | * |
51 | 48 | * @return InputInterface An InputInterface instance |
52 | 49 | */ |
53 | - public function getInput() |
|
54 | - { |
|
50 | + public function getInput() { |
|
55 | 51 | return $this->input; |
56 | 52 | } |
57 | 53 | |
@@ -60,8 +56,7 @@ discard block |
||
60 | 56 | * |
61 | 57 | * @return OutputInterface An OutputInterface instance |
62 | 58 | */ |
63 | - public function getOutput() |
|
64 | - { |
|
59 | + public function getOutput() { |
|
65 | 60 | return $this->output; |
66 | 61 | } |
67 | 62 | } |
@@ -18,12 +18,10 @@ |
||
18 | 18 | /** |
19 | 19 | * @author marie <[email protected]> |
20 | 20 | */ |
21 | -final class ConsoleSignalEvent extends ConsoleEvent |
|
22 | -{ |
|
21 | +final class ConsoleSignalEvent extends ConsoleEvent { |
|
23 | 22 | private $handlingSignal; |
24 | 23 | |
25 | - public function __construct(Command $command, InputInterface $input, OutputInterface $output, int $handlingSignal) |
|
26 | - { |
|
24 | + public function __construct(Command $command, InputInterface $input, OutputInterface $output, int $handlingSignal) { |
|
27 | 25 | parent::__construct($command, $input, $output); |
28 | 26 | $this->handlingSignal = $handlingSignal; |
29 | 27 | } |
@@ -15,8 +15,7 @@ |
||
15 | 15 | * Service tag to autoconfigure commands. |
16 | 16 | */ |
17 | 17 | #[\Attribute(\Attribute::TARGET_CLASS)] |
18 | -class AsCommand |
|
19 | -{ |
|
18 | +class AsCommand { |
|
20 | 19 | public function __construct( |
21 | 20 | public string $name, |
22 | 21 | public ?string $description = null, |
@@ -26,13 +26,11 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @internal |
28 | 28 | */ |
29 | -class TextDescriptor extends Descriptor |
|
30 | -{ |
|
29 | +class TextDescriptor extends Descriptor { |
|
31 | 30 | /** |
32 | 31 | * {@inheritdoc} |
33 | 32 | */ |
34 | - protected function describeInputArgument(InputArgument $argument, array $options = []) |
|
35 | - { |
|
33 | + protected function describeInputArgument(InputArgument $argument, array $options = []) { |
|
36 | 34 | if (null !== $argument->getDefault() && (!\is_array($argument->getDefault()) || \count($argument->getDefault()))) { |
37 | 35 | $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($argument->getDefault())); |
38 | 36 | } else { |
@@ -54,8 +52,7 @@ discard block |
||
54 | 52 | /** |
55 | 53 | * {@inheritdoc} |
56 | 54 | */ |
57 | - protected function describeInputOption(InputOption $option, array $options = []) |
|
58 | - { |
|
55 | + protected function describeInputOption(InputOption $option, array $options = []) { |
|
59 | 56 | if ($option->acceptValue() && null !== $option->getDefault() && (!\is_array($option->getDefault()) || \count($option->getDefault()))) { |
60 | 57 | $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($option->getDefault())); |
61 | 58 | } else { |
@@ -92,8 +89,7 @@ discard block |
||
92 | 89 | /** |
93 | 90 | * {@inheritdoc} |
94 | 91 | */ |
95 | - protected function describeInputDefinition(InputDefinition $definition, array $options = []) |
|
96 | - { |
|
92 | + protected function describeInputDefinition(InputDefinition $definition, array $options = []) { |
|
97 | 93 | $totalWidth = $this->calculateTotalWidthForOptions($definition->getOptions()); |
98 | 94 | foreach ($definition->getArguments() as $argument) { |
99 | 95 | $totalWidth = max($totalWidth, Helper::width($argument->getName())); |
@@ -134,8 +130,7 @@ discard block |
||
134 | 130 | /** |
135 | 131 | * {@inheritdoc} |
136 | 132 | */ |
137 | - protected function describeCommand(Command $command, array $options = []) |
|
138 | - { |
|
133 | + protected function describeCommand(Command $command, array $options = []) { |
|
139 | 134 | $command->mergeApplicationDefinition(false); |
140 | 135 | |
141 | 136 | if ($description = $command->getDescription()) { |
@@ -172,8 +167,7 @@ discard block |
||
172 | 167 | /** |
173 | 168 | * {@inheritdoc} |
174 | 169 | */ |
175 | - protected function describeApplication(Application $application, array $options = []) |
|
176 | - { |
|
170 | + protected function describeApplication(Application $application, array $options = []) { |
|
177 | 171 | $describedNamespace = $options['namespace'] ?? null; |
178 | 172 | $description = new ApplicationDescription($application, $describedNamespace); |
179 | 173 | |
@@ -248,8 +242,7 @@ discard block |
||
248 | 242 | /** |
249 | 243 | * {@inheritdoc} |
250 | 244 | */ |
251 | - private function writeText(string $content, array $options = []) |
|
252 | - { |
|
245 | + private function writeText(string $content, array $options = []) { |
|
253 | 246 | $this->write( |
254 | 247 | isset($options['raw_text']) && $options['raw_text'] ? strip_tags($content) : $content, |
255 | 248 | isset($options['raw_output']) ? !$options['raw_output'] : true |
@@ -26,13 +26,11 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @internal |
28 | 28 | */ |
29 | -class MarkdownDescriptor extends Descriptor |
|
30 | -{ |
|
29 | +class MarkdownDescriptor extends Descriptor { |
|
31 | 30 | /** |
32 | 31 | * {@inheritdoc} |
33 | 32 | */ |
34 | - public function describe(OutputInterface $output, object $object, array $options = []) |
|
35 | - { |
|
33 | + public function describe(OutputInterface $output, object $object, array $options = []) { |
|
36 | 34 | $decorated = $output->isDecorated(); |
37 | 35 | $output->setDecorated(false); |
38 | 36 | |
@@ -44,16 +42,14 @@ discard block |
||
44 | 42 | /** |
45 | 43 | * {@inheritdoc} |
46 | 44 | */ |
47 | - protected function write(string $content, bool $decorated = true) |
|
48 | - { |
|
45 | + protected function write(string $content, bool $decorated = true) { |
|
49 | 46 | parent::write($content, $decorated); |
50 | 47 | } |
51 | 48 | |
52 | 49 | /** |
53 | 50 | * {@inheritdoc} |
54 | 51 | */ |
55 | - protected function describeInputArgument(InputArgument $argument, array $options = []) |
|
56 | - { |
|
52 | + protected function describeInputArgument(InputArgument $argument, array $options = []) { |
|
57 | 53 | $this->write( |
58 | 54 | '#### `'.($argument->getName() ?: '<none>')."`\n\n" |
59 | 55 | .($argument->getDescription() ? preg_replace('/\s*[\r\n]\s*/', "\n", $argument->getDescription())."\n\n" : '') |
@@ -66,8 +62,7 @@ discard block |
||
66 | 62 | /** |
67 | 63 | * {@inheritdoc} |
68 | 64 | */ |
69 | - protected function describeInputOption(InputOption $option, array $options = []) |
|
70 | - { |
|
65 | + protected function describeInputOption(InputOption $option, array $options = []) { |
|
71 | 66 | $name = '--'.$option->getName(); |
72 | 67 | if ($option->isNegatable()) { |
73 | 68 | $name .= '|--no-'.$option->getName(); |
@@ -90,8 +85,7 @@ discard block |
||
90 | 85 | /** |
91 | 86 | * {@inheritdoc} |
92 | 87 | */ |
93 | - protected function describeInputDefinition(InputDefinition $definition, array $options = []) |
|
94 | - { |
|
88 | + protected function describeInputDefinition(InputDefinition $definition, array $options = []) { |
|
95 | 89 | if ($showArguments = \count($definition->getArguments()) > 0) { |
96 | 90 | $this->write('### Arguments'); |
97 | 91 | foreach ($definition->getArguments() as $argument) { |
@@ -120,8 +114,7 @@ discard block |
||
120 | 114 | /** |
121 | 115 | * {@inheritdoc} |
122 | 116 | */ |
123 | - protected function describeCommand(Command $command, array $options = []) |
|
124 | - { |
|
117 | + protected function describeCommand(Command $command, array $options = []) { |
|
125 | 118 | if ($options['short'] ?? false) { |
126 | 119 | $this->write( |
127 | 120 | '`'.$command->getName()."`\n" |
@@ -163,8 +156,7 @@ discard block |
||
163 | 156 | /** |
164 | 157 | * {@inheritdoc} |
165 | 158 | */ |
166 | - protected function describeApplication(Application $application, array $options = []) |
|
167 | - { |
|
159 | + protected function describeApplication(Application $application, array $options = []) { |
|
168 | 160 | $describedNamespace = $options['namespace'] ?? null; |
169 | 161 | $description = new ApplicationDescription($application, $describedNamespace); |
170 | 162 | $title = $this->getApplicationTitle($application); |
@@ -24,8 +24,7 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @internal |
26 | 26 | */ |
27 | -abstract class Descriptor implements DescriptorInterface |
|
28 | -{ |
|
27 | +abstract class Descriptor implements DescriptorInterface { |
|
29 | 28 | /** |
30 | 29 | * @var OutputInterface |
31 | 30 | */ |
@@ -34,8 +33,7 @@ discard block |
||
34 | 33 | /** |
35 | 34 | * {@inheritdoc} |
36 | 35 | */ |
37 | - public function describe(OutputInterface $output, object $object, array $options = []) |
|
38 | - { |
|
36 | + public function describe(OutputInterface $output, object $object, array $options = []) { |
|
39 | 37 | $this->output = $output; |
40 | 38 | |
41 | 39 | switch (true) { |
@@ -62,8 +60,7 @@ discard block |
||
62 | 60 | /** |
63 | 61 | * Writes content to output. |
64 | 62 | */ |
65 | - protected function write(string $content, bool $decorated = false) |
|
66 | - { |
|
63 | + protected function write(string $content, bool $decorated = false) { |
|
67 | 64 | $this->output->write($content, false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW); |
68 | 65 | } |
69 | 66 |