@@ -43,14 +43,14 @@ |
||
| 43 | 43 | ? $class::DESCRIPTION |
| 44 | 44 | : '', |
| 45 | 45 | false, |
| 46 | - function () use ($class): SymfonyCommand { |
|
| 46 | + function () use ($class) : SymfonyCommand { |
|
| 47 | 47 | /** @var SpiralCommand $command */ |
| 48 | 48 | $command = $this->container->get($class); |
| 49 | 49 | |
| 50 | 50 | $command->setContainer($this->container); |
| 51 | 51 | $command->setInterceptors($this->interceptors); |
| 52 | 52 | |
| 53 | - if ($this->dispatcher !== null && $command instanceof EventDispatcherAwareInterface) { |
|
| 53 | + if ($this->dispatcher !== null && $command instanceof EventDispatcherAwareInterface){ |
|
| 54 | 54 | $command->setEventDispatcher($this->dispatcher); |
| 55 | 55 | } |
| 56 | 56 | |
@@ -50,7 +50,8 @@ |
||
| 50 | 50 | $command->setContainer($this->container); |
| 51 | 51 | $command->setInterceptors($this->interceptors); |
| 52 | 52 | |
| 53 | - if ($this->dispatcher !== null && $command instanceof EventDispatcherAwareInterface) { |
|
| 53 | + if ($this->dispatcher !== null && $command instanceof EventDispatcherAwareInterface) |
|
| 54 | + { |
|
| 54 | 55 | $command->setEventDispatcher($this->dispatcher); |
| 55 | 56 | } |
| 56 | 57 | |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | protected function warning(string $string): void |
| 136 | 136 | { |
| 137 | - if (!$this->output->getFormatter()->hasStyle('warning')) { |
|
| 137 | + if (!$this->output->getFormatter()->hasStyle('warning')){ |
|
| 138 | 138 | $style = new OutputFormatterStyle('yellow'); |
| 139 | 139 | $this->output->getFormatter()->setStyle('warning', $style); |
| 140 | 140 | } |
@@ -151,8 +151,8 @@ discard block |
||
| 151 | 151 | $stringLines = explode("\n", wordwrap($string, 300)); |
| 152 | 152 | |
| 153 | 153 | $this->comment(\str_repeat('*', $length)); |
| 154 | - foreach ($stringLines as $line) { |
|
| 155 | - $this->comment('* ' . $line . ' *'); |
|
| 154 | + foreach ($stringLines as $line){ |
|
| 155 | + $this->comment('* '.$line.' *'); |
|
| 156 | 156 | } |
| 157 | 157 | $this->comment(\str_repeat('*', $length)); |
| 158 | 158 | |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | * |
| 199 | 199 | * @throws \InvalidArgumentException When unknown output type is given |
| 200 | 200 | */ |
| 201 | - protected function write(string|iterable $messages, bool $newline = false): void |
|
| 201 | + protected function write(string | iterable $messages, bool $newline = false): void |
|
| 202 | 202 | { |
| 203 | 203 | $this->output->write(messages: $messages, newline: $newline); |
| 204 | 204 | } |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | * |
| 211 | 211 | * @throws \InvalidArgumentException When unknown output type is given |
| 212 | 212 | */ |
| 213 | - protected function writeln(string|iterable $messages): void |
|
| 213 | + protected function writeln(string | iterable $messages): void |
|
| 214 | 214 | { |
| 215 | 215 | $this->output->writeln(messages: $messages); |
| 216 | 216 | } |
@@ -134,7 +134,8 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | protected function warning(string $string): void |
| 136 | 136 | { |
| 137 | - if (!$this->output->getFormatter()->hasStyle('warning')) { |
|
| 137 | + if (!$this->output->getFormatter()->hasStyle('warning')) |
|
| 138 | + { |
|
| 138 | 139 | $style = new OutputFormatterStyle('yellow'); |
| 139 | 140 | $this->output->getFormatter()->setStyle('warning', $style); |
| 140 | 141 | } |
@@ -151,7 +152,8 @@ discard block |
||
| 151 | 152 | $stringLines = explode("\n", wordwrap($string, 300)); |
| 152 | 153 | |
| 153 | 154 | $this->comment(\str_repeat('*', $length)); |
| 154 | - foreach ($stringLines as $line) { |
|
| 155 | + foreach ($stringLines as $line) |
|
| 156 | + { |
|
| 155 | 157 | $this->comment('* ' . $line . ' *'); |
| 156 | 158 | } |
| 157 | 159 | $this->comment(\str_repeat('*', $length)); |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | private readonly ContainerInterface $container = new Container(), |
| 36 | 36 | private readonly ScopeInterface $scope = new Container(), |
| 37 | 37 | private readonly ?EventDispatcherInterface $dispatcher = null |
| 38 | - ) { |
|
| 38 | + ){ |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | /** |
@@ -63,14 +63,14 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | public function run( |
| 65 | 65 | ?string $command, |
| 66 | - array|InputInterface $input = [], |
|
| 66 | + array | InputInterface $input = [], |
|
| 67 | 67 | OutputInterface $output = new BufferedOutput() |
| 68 | 68 | ): CommandOutput { |
| 69 | 69 | $input = \is_array($input) ? new ArrayInput($input) : $input; |
| 70 | 70 | |
| 71 | 71 | $this->configureIO($input, $output); |
| 72 | 72 | |
| 73 | - if ($command !== null) { |
|
| 73 | + if ($command !== null){ |
|
| 74 | 74 | $input = new InputProxy($input, ['firstArgument' => $command]); |
| 75 | 75 | } |
| 76 | 76 | |
@@ -89,18 +89,18 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | public function getApplication(): Application |
| 91 | 91 | { |
| 92 | - if ($this->application !== null) { |
|
| 92 | + if ($this->application !== null){ |
|
| 93 | 93 | return $this->application; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | $this->application = new Application($this->config->getName(), $this->config->getVersion()); |
| 97 | 97 | $this->application->setCatchExceptions(false); |
| 98 | 98 | $this->application->setAutoExit(false); |
| 99 | - if ($this->dispatcher instanceof SymfonyEventDispatcherInterface) { |
|
| 99 | + if ($this->dispatcher instanceof SymfonyEventDispatcherInterface){ |
|
| 100 | 100 | $this->application->setDispatcher($this->dispatcher); |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - if ($this->locator !== null) { |
|
| 103 | + if ($this->locator !== null){ |
|
| 104 | 104 | $this->addCommands($this->locator->locateCommands()); |
| 105 | 105 | } |
| 106 | 106 | |
@@ -120,13 +120,13 @@ discard block |
||
| 120 | 120 | { |
| 121 | 121 | $interceptors = $this->config->getInterceptors(); |
| 122 | 122 | |
| 123 | - foreach ($commands as $command) { |
|
| 124 | - if ($command instanceof Command) { |
|
| 123 | + foreach ($commands as $command){ |
|
| 124 | + if ($command instanceof Command){ |
|
| 125 | 125 | $command->setContainer($this->container); |
| 126 | 126 | $command->setInterceptors($interceptors); |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - if ($this->dispatcher !== null && $command instanceof EventDispatcherAwareInterface) { |
|
| 129 | + if ($this->dispatcher !== null && $command instanceof EventDispatcherAwareInterface){ |
|
| 130 | 130 | $command->setEventDispatcher($this->dispatcher); |
| 131 | 131 | } |
| 132 | 132 | |
@@ -141,27 +141,27 @@ discard block |
||
| 141 | 141 | */ |
| 142 | 142 | private function configureIO(InputInterface $input, OutputInterface $output): void |
| 143 | 143 | { |
| 144 | - if ($input->hasParameterOption(['--ansi'], true)) { |
|
| 144 | + if ($input->hasParameterOption(['--ansi'], true)){ |
|
| 145 | 145 | $output->setDecorated(true); |
| 146 | - } elseif ($input->hasParameterOption(['--no-ansi'], true)) { |
|
| 146 | + } elseif ($input->hasParameterOption(['--no-ansi'], true)){ |
|
| 147 | 147 | $output->setDecorated(false); |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | - if ($input->hasParameterOption(['--no-interaction', '-n'], true)) { |
|
| 150 | + if ($input->hasParameterOption(['--no-interaction', '-n'], true)){ |
|
| 151 | 151 | $input->setInteractive(false); |
| 152 | - } elseif (\function_exists('posix_isatty')) { |
|
| 152 | + } elseif (\function_exists('posix_isatty')){ |
|
| 153 | 153 | $inputStream = null; |
| 154 | 154 | |
| 155 | - if ($input instanceof StreamableInputInterface) { |
|
| 155 | + if ($input instanceof StreamableInputInterface){ |
|
| 156 | 156 | $inputStream = $input->getStream(); |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | - if (!@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE')) { |
|
| 159 | + if (!@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE')){ |
|
| 160 | 160 | $input->setInteractive(false); |
| 161 | 161 | } |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | - match ($shellVerbosity = (int) getenv('SHELL_VERBOSITY')) { |
|
| 164 | + match ($shellVerbosity = (int)getenv('SHELL_VERBOSITY')) { |
|
| 165 | 165 | -1 => $output->setVerbosity(OutputInterface::VERBOSITY_QUIET), |
| 166 | 166 | 1 => $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE), |
| 167 | 167 | 2 => $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE), |
@@ -169,22 +169,22 @@ discard block |
||
| 169 | 169 | default => $shellVerbosity = 0 |
| 170 | 170 | }; |
| 171 | 171 | |
| 172 | - if ($input->hasParameterOption(['--quiet', '-q'], true)) { |
|
| 172 | + if ($input->hasParameterOption(['--quiet', '-q'], true)){ |
|
| 173 | 173 | $output->setVerbosity(OutputInterface::VERBOSITY_QUIET); |
| 174 | 174 | $shellVerbosity = -1; |
| 175 | - } else { |
|
| 175 | + }else{ |
|
| 176 | 176 | if ( |
| 177 | 177 | $input->hasParameterOption('-vvv', true) |
| 178 | 178 | || $input->hasParameterOption('--verbose=3', true) |
| 179 | 179 | || 3 === $input->getParameterOption('--verbose', false, true) |
| 180 | - ) { |
|
| 180 | + ){ |
|
| 181 | 181 | $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG); |
| 182 | 182 | $shellVerbosity = 3; |
| 183 | 183 | } elseif ( |
| 184 | 184 | $input->hasParameterOption('-vv', true) |
| 185 | 185 | || $input->hasParameterOption('--verbose=2', true) |
| 186 | 186 | || 2 === $input->getParameterOption('--verbose', false, true) |
| 187 | - ) { |
|
| 187 | + ){ |
|
| 188 | 188 | $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE); |
| 189 | 189 | $shellVerbosity = 2; |
| 190 | 190 | } elseif ( |
@@ -192,17 +192,17 @@ discard block |
||
| 192 | 192 | || $input->hasParameterOption('--verbose=1', true) |
| 193 | 193 | || $input->hasParameterOption('--verbose', true) |
| 194 | 194 | || $input->getParameterOption('--verbose', false, true) |
| 195 | - ) { |
|
| 195 | + ){ |
|
| 196 | 196 | $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE); |
| 197 | 197 | $shellVerbosity = 1; |
| 198 | 198 | } |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | - if (-1 === $shellVerbosity) { |
|
| 201 | + if (-1 === $shellVerbosity){ |
|
| 202 | 202 | $input->setInteractive(false); |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | - \putenv('SHELL_VERBOSITY=' . $shellVerbosity); |
|
| 205 | + \putenv('SHELL_VERBOSITY='.$shellVerbosity); |
|
| 206 | 206 | $_ENV['SHELL_VERBOSITY'] = $shellVerbosity; |
| 207 | 207 | $_SERVER['SHELL_VERBOSITY'] = $shellVerbosity; |
| 208 | 208 | } |
@@ -70,7 +70,8 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | $this->configureIO($input, $output); |
| 72 | 72 | |
| 73 | - if ($command !== null) { |
|
| 73 | + if ($command !== null) |
|
| 74 | + { |
|
| 74 | 75 | $input = new InputProxy($input, ['firstArgument' => $command]); |
| 75 | 76 | } |
| 76 | 77 | |
@@ -89,18 +90,21 @@ discard block |
||
| 89 | 90 | */ |
| 90 | 91 | public function getApplication(): Application |
| 91 | 92 | { |
| 92 | - if ($this->application !== null) { |
|
| 93 | + if ($this->application !== null) |
|
| 94 | + { |
|
| 93 | 95 | return $this->application; |
| 94 | 96 | } |
| 95 | 97 | |
| 96 | 98 | $this->application = new Application($this->config->getName(), $this->config->getVersion()); |
| 97 | 99 | $this->application->setCatchExceptions(false); |
| 98 | 100 | $this->application->setAutoExit(false); |
| 99 | - if ($this->dispatcher instanceof SymfonyEventDispatcherInterface) { |
|
| 101 | + if ($this->dispatcher instanceof SymfonyEventDispatcherInterface) |
|
| 102 | + { |
|
| 100 | 103 | $this->application->setDispatcher($this->dispatcher); |
| 101 | 104 | } |
| 102 | 105 | |
| 103 | - if ($this->locator !== null) { |
|
| 106 | + if ($this->locator !== null) |
|
| 107 | + { |
|
| 104 | 108 | $this->addCommands($this->locator->locateCommands()); |
| 105 | 109 | } |
| 106 | 110 | |
@@ -120,13 +124,16 @@ discard block |
||
| 120 | 124 | { |
| 121 | 125 | $interceptors = $this->config->getInterceptors(); |
| 122 | 126 | |
| 123 | - foreach ($commands as $command) { |
|
| 124 | - if ($command instanceof Command) { |
|
| 127 | + foreach ($commands as $command) |
|
| 128 | + { |
|
| 129 | + if ($command instanceof Command) |
|
| 130 | + { |
|
| 125 | 131 | $command->setContainer($this->container); |
| 126 | 132 | $command->setInterceptors($interceptors); |
| 127 | 133 | } |
| 128 | 134 | |
| 129 | - if ($this->dispatcher !== null && $command instanceof EventDispatcherAwareInterface) { |
|
| 135 | + if ($this->dispatcher !== null && $command instanceof EventDispatcherAwareInterface) |
|
| 136 | + { |
|
| 130 | 137 | $command->setEventDispatcher($this->dispatcher); |
| 131 | 138 | } |
| 132 | 139 | |
@@ -141,22 +148,30 @@ discard block |
||
| 141 | 148 | */ |
| 142 | 149 | private function configureIO(InputInterface $input, OutputInterface $output): void |
| 143 | 150 | { |
| 144 | - if ($input->hasParameterOption(['--ansi'], true)) { |
|
| 151 | + if ($input->hasParameterOption(['--ansi'], true)) |
|
| 152 | + { |
|
| 145 | 153 | $output->setDecorated(true); |
| 146 | - } elseif ($input->hasParameterOption(['--no-ansi'], true)) { |
|
| 154 | + } |
|
| 155 | + elseif ($input->hasParameterOption(['--no-ansi'], true)) |
|
| 156 | + { |
|
| 147 | 157 | $output->setDecorated(false); |
| 148 | 158 | } |
| 149 | 159 | |
| 150 | - if ($input->hasParameterOption(['--no-interaction', '-n'], true)) { |
|
| 160 | + if ($input->hasParameterOption(['--no-interaction', '-n'], true)) |
|
| 161 | + { |
|
| 151 | 162 | $input->setInteractive(false); |
| 152 | - } elseif (\function_exists('posix_isatty')) { |
|
| 163 | + } |
|
| 164 | + elseif (\function_exists('posix_isatty')) |
|
| 165 | + { |
|
| 153 | 166 | $inputStream = null; |
| 154 | 167 | |
| 155 | - if ($input instanceof StreamableInputInterface) { |
|
| 168 | + if ($input instanceof StreamableInputInterface) |
|
| 169 | + { |
|
| 156 | 170 | $inputStream = $input->getStream(); |
| 157 | 171 | } |
| 158 | 172 | |
| 159 | - if (!@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE')) { |
|
| 173 | + if (!@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE')) |
|
| 174 | + { |
|
| 160 | 175 | $input->setInteractive(false); |
| 161 | 176 | } |
| 162 | 177 | } |
@@ -169,10 +184,13 @@ discard block |
||
| 169 | 184 | default => $shellVerbosity = 0 |
| 170 | 185 | }; |
| 171 | 186 | |
| 172 | - if ($input->hasParameterOption(['--quiet', '-q'], true)) { |
|
| 187 | + if ($input->hasParameterOption(['--quiet', '-q'], true)) |
|
| 188 | + { |
|
| 173 | 189 | $output->setVerbosity(OutputInterface::VERBOSITY_QUIET); |
| 174 | 190 | $shellVerbosity = -1; |
| 175 | - } else { |
|
| 191 | + } |
|
| 192 | + else |
|
| 193 | + { |
|
| 176 | 194 | if ( |
| 177 | 195 | $input->hasParameterOption('-vvv', true) |
| 178 | 196 | || $input->hasParameterOption('--verbose=3', true) |
@@ -180,14 +198,16 @@ discard block |
||
| 180 | 198 | ) { |
| 181 | 199 | $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG); |
| 182 | 200 | $shellVerbosity = 3; |
| 183 | - } elseif ( |
|
| 201 | + } |
|
| 202 | + elseif ( |
|
| 184 | 203 | $input->hasParameterOption('-vv', true) |
| 185 | 204 | || $input->hasParameterOption('--verbose=2', true) |
| 186 | 205 | || 2 === $input->getParameterOption('--verbose', false, true) |
| 187 | 206 | ) { |
| 188 | 207 | $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE); |
| 189 | 208 | $shellVerbosity = 2; |
| 190 | - } elseif ( |
|
| 209 | + } |
|
| 210 | + elseif ( |
|
| 191 | 211 | $input->hasParameterOption('-v', true) |
| 192 | 212 | || $input->hasParameterOption('--verbose=1', true) |
| 193 | 213 | || $input->hasParameterOption('--verbose', true) |
@@ -198,7 +218,8 @@ discard block |
||
| 198 | 218 | } |
| 199 | 219 | } |
| 200 | 220 | |
| 201 | - if (-1 === $shellVerbosity) { |
|
| 221 | + if (-1 === $shellVerbosity) |
|
| 222 | + { |
|
| 202 | 223 | $input->setInteractive(false); |
| 203 | 224 | } |
| 204 | 225 | |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | public function __construct( |
| 12 | 12 | private readonly int $code, |
| 13 | 13 | private readonly OutputInterface $output |
| 14 | - ) { |
|
| 14 | + ){ |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | public function getCode(): int |
@@ -23,14 +23,14 @@ discard block |
||
| 23 | 23 | public function __construct( |
| 24 | 24 | private readonly ConsoleBootloader $bootloader, |
| 25 | 25 | ContainerInterface $container |
| 26 | - ) { |
|
| 26 | + ){ |
|
| 27 | 27 | $this->container = $container; |
| 28 | 28 | $this->target = new \ReflectionClass(SymfonyCommand::class); |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | public function listen(\ReflectionClass $class): void |
| 32 | 32 | { |
| 33 | - if (!$this->isTargeted($class, $this->target)) { |
|
| 33 | + if (!$this->isTargeted($class, $this->target)){ |
|
| 34 | 34 | return; |
| 35 | 35 | } |
| 36 | 36 | |
@@ -39,8 +39,8 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | public function finalize(): void |
| 41 | 41 | { |
| 42 | - foreach ($this->commands as $class) { |
|
| 43 | - if ($class->isAbstract()) { |
|
| 42 | + foreach ($this->commands as $class){ |
|
| 43 | + if ($class->isAbstract()){ |
|
| 44 | 44 | continue; |
| 45 | 45 | } |
| 46 | 46 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | protected function isTargeted(\ReflectionClass $class, \ReflectionClass $target): bool |
| 55 | 55 | { |
| 56 | - if (!$target->isTrait()) { |
|
| 56 | + if (!$target->isTrait()){ |
|
| 57 | 57 | //Target is interface or class |
| 58 | 58 | return $class->isSubclassOf($target) || $class->getName() === $target->getName(); |
| 59 | 59 | } |
@@ -30,7 +30,8 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | public function listen(\ReflectionClass $class): void |
| 32 | 32 | { |
| 33 | - if (!$this->isTargeted($class, $this->target)) { |
|
| 33 | + if (!$this->isTargeted($class, $this->target)) |
|
| 34 | + { |
|
| 34 | 35 | return; |
| 35 | 36 | } |
| 36 | 37 | |
@@ -39,8 +40,10 @@ discard block |
||
| 39 | 40 | |
| 40 | 41 | public function finalize(): void |
| 41 | 42 | { |
| 42 | - foreach ($this->commands as $class) { |
|
| 43 | - if ($class->isAbstract()) { |
|
| 43 | + foreach ($this->commands as $class) |
|
| 44 | + { |
|
| 45 | + if ($class->isAbstract()) |
|
| 46 | + { |
|
| 44 | 47 | continue; |
| 45 | 48 | } |
| 46 | 49 | |
@@ -53,7 +56,8 @@ discard block |
||
| 53 | 56 | */ |
| 54 | 57 | protected function isTargeted(\ReflectionClass $class, \ReflectionClass $target): bool |
| 55 | 58 | { |
| 56 | - if (!$target->isTrait()) { |
|
| 59 | + if (!$target->isTrait()) |
|
| 60 | + { |
|
| 57 | 61 | //Target is interface or class |
| 58 | 62 | return $class->isSubclassOf($target) || $class->getName() === $target->getName(); |
| 59 | 63 | } |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | { |
| 14 | 14 | public function __construct( |
| 15 | 15 | private readonly InvokerInterface $invoker |
| 16 | - ) { |
|
| 16 | + ){ |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | /** |
@@ -15,6 +15,6 @@ |
||
| 15 | 15 | public readonly int $exitCode, |
| 16 | 16 | public readonly InputInterface $input, |
| 17 | 17 | public readonly OutputInterface $output |
| 18 | - ) { |
|
| 18 | + ){ |
|
| 19 | 19 | } |
| 20 | 20 | } |
@@ -14,6 +14,6 @@ |
||
| 14 | 14 | public readonly Command $command, |
| 15 | 15 | public readonly InputInterface $input, |
| 16 | 16 | public readonly OutputInterface $output |
| 17 | - ) { |
|
| 17 | + ){ |
|
| 18 | 18 | } |
| 19 | 19 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | protected function execute(InputInterface $input, OutputInterface $output): int |
| 71 | 71 | { |
| 72 | - if ($this->container === null) { |
|
| 72 | + if ($this->container === null){ |
|
| 73 | 73 | throw new ScopeException('Container is not set'); |
| 74 | 74 | } |
| 75 | 75 | |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | |
| 78 | 78 | $core = $this->buildCore(); |
| 79 | 79 | |
| 80 | - try { |
|
| 80 | + try{ |
|
| 81 | 81 | [$this->input, $this->output] = [$this->prepareInput($input), $this->prepareOutput($input, $output)]; |
| 82 | 82 | |
| 83 | 83 | $this->eventDispatcher?->dispatch(new CommandStarting($this, $this->input, $this->output)); |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | $this->eventDispatcher?->dispatch(new CommandFinished($this, $code, $this->input, $this->output)); |
| 93 | 93 | |
| 94 | 94 | return $code; |
| 95 | - } finally { |
|
| 95 | + }finally{ |
|
| 96 | 96 | [$this->input, $this->output] = [null, null]; |
| 97 | 97 | } |
| 98 | 98 | } |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | $interceptableCore = new InterceptableCore($core, $this->eventDispatcher); |
| 105 | 105 | |
| 106 | - foreach ($this->interceptors as $interceptor) { |
|
| 106 | + foreach ($this->interceptors as $interceptor){ |
|
| 107 | 107 | $interceptableCore->addInterceptor($this->container->get($interceptor)); |
| 108 | 108 | } |
| 109 | 109 | |
@@ -125,19 +125,19 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | protected function configure(): void |
| 127 | 127 | { |
| 128 | - if (static::SIGNATURE !== null) { |
|
| 128 | + if (static::SIGNATURE !== null){ |
|
| 129 | 129 | $this->configureViaSignature((string)static::SIGNATURE); |
| 130 | - } else { |
|
| 130 | + }else{ |
|
| 131 | 131 | $this->setName(static::NAME); |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | $this->setDescription((string)static::DESCRIPTION); |
| 135 | 135 | |
| 136 | - foreach ($this->defineOptions() as $option) { |
|
| 136 | + foreach ($this->defineOptions() as $option){ |
|
| 137 | 137 | \call_user_func_array([$this, 'addOption'], $option); |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - foreach ($this->defineArguments() as $argument) { |
|
| 140 | + foreach ($this->defineArguments() as $argument){ |
|
| 141 | 141 | \call_user_func_array([$this, 'addArgument'], $argument); |
| 142 | 142 | } |
| 143 | 143 | } |
@@ -148,11 +148,11 @@ discard block |
||
| 148 | 148 | |
| 149 | 149 | $this->setName($result->name); |
| 150 | 150 | |
| 151 | - foreach ($result->options as $option) { |
|
| 151 | + foreach ($result->options as $option){ |
|
| 152 | 152 | $this->getDefinition()->addOption($option); |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - foreach ($result->arguments as $argument) { |
|
| 155 | + foreach ($result->arguments as $argument){ |
|
| 156 | 156 | $this->getDefinition()->addArgument($argument); |
| 157 | 157 | } |
| 158 | 158 | } |
@@ -69,7 +69,8 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | protected function execute(InputInterface $input, OutputInterface $output): int |
| 71 | 71 | { |
| 72 | - if ($this->container === null) { |
|
| 72 | + if ($this->container === null) |
|
| 73 | + { |
|
| 73 | 74 | throw new ScopeException('Container is not set'); |
| 74 | 75 | } |
| 75 | 76 | |
@@ -77,7 +78,8 @@ discard block |
||
| 77 | 78 | |
| 78 | 79 | $core = $this->buildCore(); |
| 79 | 80 | |
| 80 | - try { |
|
| 81 | + try |
|
| 82 | + { |
|
| 81 | 83 | [$this->input, $this->output] = [$this->prepareInput($input), $this->prepareOutput($input, $output)]; |
| 82 | 84 | |
| 83 | 85 | $this->eventDispatcher?->dispatch(new CommandStarting($this, $this->input, $this->output)); |
@@ -92,7 +94,9 @@ discard block |
||
| 92 | 94 | $this->eventDispatcher?->dispatch(new CommandFinished($this, $code, $this->input, $this->output)); |
| 93 | 95 | |
| 94 | 96 | return $code; |
| 95 | - } finally { |
|
| 97 | + } |
|
| 98 | + finally |
|
| 99 | + { |
|
| 96 | 100 | [$this->input, $this->output] = [null, null]; |
| 97 | 101 | } |
| 98 | 102 | } |
@@ -103,7 +107,8 @@ discard block |
||
| 103 | 107 | |
| 104 | 108 | $interceptableCore = new InterceptableCore($core, $this->eventDispatcher); |
| 105 | 109 | |
| 106 | - foreach ($this->interceptors as $interceptor) { |
|
| 110 | + foreach ($this->interceptors as $interceptor) |
|
| 111 | + { |
|
| 107 | 112 | $interceptableCore->addInterceptor($this->container->get($interceptor)); |
| 108 | 113 | } |
| 109 | 114 | |
@@ -125,19 +130,24 @@ discard block |
||
| 125 | 130 | */ |
| 126 | 131 | protected function configure(): void |
| 127 | 132 | { |
| 128 | - if (static::SIGNATURE !== null) { |
|
| 133 | + if (static::SIGNATURE !== null) |
|
| 134 | + { |
|
| 129 | 135 | $this->configureViaSignature((string)static::SIGNATURE); |
| 130 | - } else { |
|
| 136 | + } |
|
| 137 | + else |
|
| 138 | + { |
|
| 131 | 139 | $this->setName(static::NAME); |
| 132 | 140 | } |
| 133 | 141 | |
| 134 | 142 | $this->setDescription((string)static::DESCRIPTION); |
| 135 | 143 | |
| 136 | - foreach ($this->defineOptions() as $option) { |
|
| 144 | + foreach ($this->defineOptions() as $option) |
|
| 145 | + { |
|
| 137 | 146 | \call_user_func_array([$this, 'addOption'], $option); |
| 138 | 147 | } |
| 139 | 148 | |
| 140 | - foreach ($this->defineArguments() as $argument) { |
|
| 149 | + foreach ($this->defineArguments() as $argument) |
|
| 150 | + { |
|
| 141 | 151 | \call_user_func_array([$this, 'addArgument'], $argument); |
| 142 | 152 | } |
| 143 | 153 | } |
@@ -148,11 +158,13 @@ discard block |
||
| 148 | 158 | |
| 149 | 159 | $this->setName($result->name); |
| 150 | 160 | |
| 151 | - foreach ($result->options as $option) { |
|
| 161 | + foreach ($result->options as $option) |
|
| 162 | + { |
|
| 152 | 163 | $this->getDefinition()->addOption($option); |
| 153 | 164 | } |
| 154 | 165 | |
| 155 | - foreach ($result->arguments as $argument) { |
|
| 166 | + foreach ($result->arguments as $argument) |
|
| 167 | + { |
|
| 156 | 168 | $this->getDefinition()->addArgument($argument); |
| 157 | 169 | } |
| 158 | 170 | } |