@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | ContainerInterface $container, |
| 37 | 37 | private readonly DirectoriesInterface $directories, |
| 38 | 38 | private readonly BinderInterface $binder |
| 39 | - ) { |
|
| 39 | + ){ |
|
| 40 | 40 | $this->loaders = [ |
| 41 | 41 | 'php' => $container->get(PhpLoader::class), |
| 42 | 42 | 'json' => $container->get(JsonLoader::class), |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | public function addLoader(string $ext, FileLoaderInterface $loader): void |
| 49 | 49 | { |
| 50 | - if (!isset($this->loaders[$ext]) || $this->loaders[$ext]::class !== $loader::class) { |
|
| 50 | + if (!isset($this->loaders[$ext]) || $this->loaders[$ext]::class !== $loader::class){ |
|
| 51 | 51 | $this->loaders[$ext] = $loader; |
| 52 | 52 | $this->binder->bindSingleton(ConfigManager::class, $this->createConfigManager()); |
| 53 | 53 | } |
@@ -47,7 +47,8 @@ |
||
| 47 | 47 | |
| 48 | 48 | public function addLoader(string $ext, FileLoaderInterface $loader): void |
| 49 | 49 | { |
| 50 | - if (!isset($this->loaders[$ext]) || $this->loaders[$ext]::class !== $loader::class) { |
|
| 50 | + if (!isset($this->loaders[$ext]) || $this->loaders[$ext]::class !== $loader::class) |
|
| 51 | + { |
|
| 51 | 52 | $this->loaders[$ext] = $loader; |
| 52 | 53 | $this->binder->bindSingleton(ConfigManager::class, $this->createConfigManager()); |
| 53 | 54 | } |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | { |
| 27 | 27 | $this->dispatcher?->dispatch(new Finalizing($this)); |
| 28 | 28 | |
| 29 | - foreach ($this->finalizers as $finalizer) { |
|
| 29 | + foreach ($this->finalizers as $finalizer){ |
|
| 30 | 30 | \call_user_func($finalizer, $terminate); |
| 31 | 31 | } |
| 32 | 32 | } |
@@ -26,7 +26,8 @@ |
||
| 26 | 26 | { |
| 27 | 27 | $this->dispatcher?->dispatch(new Finalizing($this)); |
| 28 | 28 | |
| 29 | - foreach ($this->finalizers as $finalizer) { |
|
| 29 | + foreach ($this->finalizers as $finalizer) |
|
| 30 | + { |
|
| 30 | 31 | \call_user_func($finalizer, $terminate); |
| 31 | 32 | } |
| 32 | 33 | } |
@@ -41,11 +41,11 @@ |
||
| 41 | 41 | public function testConfigure(): void |
| 42 | 42 | { |
| 43 | 43 | $core = $this->getCore( |
| 44 | - $this->getStaticLocator([ |
|
| 45 | - HelperCommand::class, |
|
| 46 | - ConfigureCommand::class, |
|
| 47 | - TestCommand::class, |
|
| 48 | - ]) |
|
| 44 | + $this->getStaticLocator([ |
|
| 45 | + HelperCommand::class, |
|
| 46 | + ConfigureCommand::class, |
|
| 47 | + TestCommand::class, |
|
| 48 | + ]) |
|
| 49 | 49 | ); |
| 50 | 50 | |
| 51 | 51 | $this->container->bind(Console::class, $core); |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | public function testLazyCommandCreationInCommandLocator(): void |
| 15 | 15 | { |
| 16 | 16 | $locator = $this->getCommandLocator( |
| 17 | - new class() implements ScopedClassesInterface { |
|
| 17 | + new class() implements ScopedClassesInterface{ |
|
| 18 | 18 | public function getScopedClasses(string $scope, $target = null): array |
| 19 | 19 | { |
| 20 | 20 | return [ |
@@ -14,7 +14,8 @@ |
||
| 14 | 14 | public function testLazyCommandCreationInCommandLocator(): void |
| 15 | 15 | { |
| 16 | 16 | $locator = $this->getCommandLocator( |
| 17 | - new class() implements ScopedClassesInterface { |
|
| 17 | + new class() implements ScopedClassesInterface |
|
| 18 | + { |
|
| 18 | 19 | public function getScopedClasses(string $scope, $target = null): array |
| 19 | 20 | { |
| 20 | 21 | return [ |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | public function getInterceptors(): array |
| 40 | 40 | { |
| 41 | - if (!\array_key_exists('interceptors', $this->config)) { |
|
| 41 | + if (!\array_key_exists('interceptors', $this->config)){ |
|
| 42 | 42 | return []; |
| 43 | 43 | } |
| 44 | 44 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | public function getCommands(): array |
| 52 | 52 | { |
| 53 | - if (!\array_key_exists('commands', $this->config)) { |
|
| 53 | + if (!\array_key_exists('commands', $this->config)){ |
|
| 54 | 54 | //Legacy config support |
| 55 | 55 | return []; |
| 56 | 56 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | { |
| 70 | 70 | $sequence = (array)($this->config['sequences'][$name] ?? []); |
| 71 | 71 | |
| 72 | - foreach ($sequence as $item) { |
|
| 72 | + foreach ($sequence as $item){ |
|
| 73 | 73 | yield $this->parseSequence($item); |
| 74 | 74 | } |
| 75 | 75 | } |
@@ -108,17 +108,17 @@ discard block |
||
| 108 | 108 | * } $item |
| 109 | 109 | * @throws \JsonException |
| 110 | 110 | */ |
| 111 | - protected function parseSequence(SequenceInterface|string|array $item): SequenceInterface |
|
| 111 | + protected function parseSequence(SequenceInterface | string | array $item): SequenceInterface |
|
| 112 | 112 | { |
| 113 | - if ($item instanceof SequenceInterface) { |
|
| 113 | + if ($item instanceof SequenceInterface){ |
|
| 114 | 114 | return $item; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - if (\is_callable($item)) { |
|
| 117 | + if (\is_callable($item)){ |
|
| 118 | 118 | return new CallableSequence($item); |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - if (\is_array($item) && isset($item['command'])) { |
|
| 121 | + if (\is_array($item) && isset($item['command'])){ |
|
| 122 | 122 | return new CommandSequence( |
| 123 | 123 | $item['command'], |
| 124 | 124 | $item['options'] ?? [], |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | ); |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - if (\is_array($item) && isset($item['invoke'])) { |
|
| 130 | + if (\is_array($item) && isset($item['invoke'])){ |
|
| 131 | 131 | return new CallableSequence( |
| 132 | 132 | $item['invoke'], |
| 133 | 133 | $item['header'] ?? '', |
@@ -38,7 +38,8 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | public function getInterceptors(): array |
| 40 | 40 | { |
| 41 | - if (!\array_key_exists('interceptors', $this->config)) { |
|
| 41 | + if (!\array_key_exists('interceptors', $this->config)) |
|
| 42 | + { |
|
| 42 | 43 | return []; |
| 43 | 44 | } |
| 44 | 45 | |
@@ -50,7 +51,8 @@ discard block |
||
| 50 | 51 | */ |
| 51 | 52 | public function getCommands(): array |
| 52 | 53 | { |
| 53 | - if (!\array_key_exists('commands', $this->config)) { |
|
| 54 | + if (!\array_key_exists('commands', $this->config)) |
|
| 55 | + { |
|
| 54 | 56 | //Legacy config support |
| 55 | 57 | return []; |
| 56 | 58 | } |
@@ -69,7 +71,8 @@ discard block |
||
| 69 | 71 | { |
| 70 | 72 | $sequence = (array)($this->config['sequences'][$name] ?? []); |
| 71 | 73 | |
| 72 | - foreach ($sequence as $item) { |
|
| 74 | + foreach ($sequence as $item) |
|
| 75 | + { |
|
| 73 | 76 | yield $this->parseSequence($item); |
| 74 | 77 | } |
| 75 | 78 | } |
@@ -110,15 +113,18 @@ discard block |
||
| 110 | 113 | */ |
| 111 | 114 | protected function parseSequence(SequenceInterface|string|array $item): SequenceInterface |
| 112 | 115 | { |
| 113 | - if ($item instanceof SequenceInterface) { |
|
| 116 | + if ($item instanceof SequenceInterface) |
|
| 117 | + { |
|
| 114 | 118 | return $item; |
| 115 | 119 | } |
| 116 | 120 | |
| 117 | - if (\is_callable($item)) { |
|
| 121 | + if (\is_callable($item)) |
|
| 122 | + { |
|
| 118 | 123 | return new CallableSequence($item); |
| 119 | 124 | } |
| 120 | 125 | |
| 121 | - if (\is_array($item) && isset($item['command'])) { |
|
| 126 | + if (\is_array($item) && isset($item['command'])) |
|
| 127 | + { |
|
| 122 | 128 | return new CommandSequence( |
| 123 | 129 | $item['command'], |
| 124 | 130 | $item['options'] ?? [], |
@@ -127,7 +133,8 @@ discard block |
||
| 127 | 133 | ); |
| 128 | 134 | } |
| 129 | 135 | |
| 130 | - if (\is_array($item) && isset($item['invoke'])) { |
|
| 136 | + if (\is_array($item) && isset($item['invoke'])) |
|
| 137 | + { |
|
| 131 | 138 | return new CallableSequence( |
| 132 | 139 | $item['invoke'], |
| 133 | 140 | $item['header'] ?? '', |
@@ -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)); |
@@ -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 |
@@ -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 | } |