@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | public function getCommands(): array |
| 57 | 57 | { |
| 58 | - if (!array_key_exists('commands', $this->config)) { |
|
| 58 | + if (!array_key_exists('commands', $this->config)){ |
|
| 59 | 59 | //Legacy config support |
| 60 | 60 | return []; |
| 61 | 61 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | public function configureSequence(): \Generator |
| 74 | 74 | { |
| 75 | 75 | $sequence = $this->config['configure'] ?? $this->config['configureSequence'] ?? []; |
| 76 | - foreach ($sequence as $item) { |
|
| 76 | + foreach ($sequence as $item){ |
|
| 77 | 77 | yield $this->parseSequence($item); |
| 78 | 78 | } |
| 79 | 79 | } |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | public function updateSequence(): \Generator |
| 89 | 89 | { |
| 90 | 90 | $sequence = $this->config['update'] ?? $this->config['updateSequence'] ?? []; |
| 91 | - foreach ($sequence as $item) { |
|
| 91 | + foreach ($sequence as $item){ |
|
| 92 | 92 | yield $this->parseSequence($item); |
| 93 | 93 | } |
| 94 | 94 | } |
@@ -101,15 +101,15 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | protected function parseSequence($item): SequenceInterface |
| 103 | 103 | { |
| 104 | - if ($item instanceof SequenceInterface) { |
|
| 104 | + if ($item instanceof SequenceInterface){ |
|
| 105 | 105 | return $item; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - if (is_string($item)) { |
|
| 108 | + if (is_string($item)){ |
|
| 109 | 109 | return new CallableSequence($item); |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - if (is_array($item) && isset($item['command'])) { |
|
| 112 | + if (is_array($item) && isset($item['command'])){ |
|
| 113 | 113 | return new CommandSequence( |
| 114 | 114 | $item['command'], |
| 115 | 115 | $item['options'] ?? [], |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | ); |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - if (is_array($item) && isset($item['invoke'])) { |
|
| 121 | + if (is_array($item) && isset($item['invoke'])){ |
|
| 122 | 122 | return new CallableSequence( |
| 123 | 123 | $item['invoke'], |
| 124 | 124 | $item['parameters'] ?? [], |
@@ -55,7 +55,8 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | public function getCommands(): array |
| 57 | 57 | { |
| 58 | - if (!array_key_exists('commands', $this->config)) { |
|
| 58 | + if (!array_key_exists('commands', $this->config)) |
|
| 59 | + { |
|
| 59 | 60 | //Legacy config support |
| 60 | 61 | return []; |
| 61 | 62 | } |
@@ -73,7 +74,8 @@ discard block |
||
| 73 | 74 | public function configureSequence(): \Generator |
| 74 | 75 | { |
| 75 | 76 | $sequence = $this->config['configure'] ?? $this->config['configureSequence'] ?? []; |
| 76 | - foreach ($sequence as $item) { |
|
| 77 | + foreach ($sequence as $item) |
|
| 78 | + { |
|
| 77 | 79 | yield $this->parseSequence($item); |
| 78 | 80 | } |
| 79 | 81 | } |
@@ -88,7 +90,8 @@ discard block |
||
| 88 | 90 | public function updateSequence(): \Generator |
| 89 | 91 | { |
| 90 | 92 | $sequence = $this->config['update'] ?? $this->config['updateSequence'] ?? []; |
| 91 | - foreach ($sequence as $item) { |
|
| 93 | + foreach ($sequence as $item) |
|
| 94 | + { |
|
| 92 | 95 | yield $this->parseSequence($item); |
| 93 | 96 | } |
| 94 | 97 | } |
@@ -101,15 +104,18 @@ discard block |
||
| 101 | 104 | */ |
| 102 | 105 | protected function parseSequence($item): SequenceInterface |
| 103 | 106 | { |
| 104 | - if ($item instanceof SequenceInterface) { |
|
| 107 | + if ($item instanceof SequenceInterface) |
|
| 108 | + { |
|
| 105 | 109 | return $item; |
| 106 | 110 | } |
| 107 | 111 | |
| 108 | - if (is_string($item)) { |
|
| 112 | + if (is_string($item)) |
|
| 113 | + { |
|
| 109 | 114 | return new CallableSequence($item); |
| 110 | 115 | } |
| 111 | 116 | |
| 112 | - if (is_array($item) && isset($item['command'])) { |
|
| 117 | + if (is_array($item) && isset($item['command'])) |
|
| 118 | + { |
|
| 113 | 119 | return new CommandSequence( |
| 114 | 120 | $item['command'], |
| 115 | 121 | $item['options'] ?? [], |
@@ -118,7 +124,8 @@ discard block |
||
| 118 | 124 | ); |
| 119 | 125 | } |
| 120 | 126 | |
| 121 | - if (is_array($item) && isset($item['invoke'])) { |
|
| 127 | + if (is_array($item) && isset($item['invoke'])) |
|
| 128 | + { |
|
| 122 | 129 | return new CallableSequence( |
| 123 | 130 | $item['invoke'], |
| 124 | 131 | $item['parameters'] ?? [], |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | class ConfigureTest extends BaseTest |
| 25 | 25 | { |
| 26 | 26 | public const TOKENIZER_CONFIG = [ |
| 27 | - 'directories' => [__DIR__ . '/../src/Command', __DIR__ . '/Fixtures/'], |
|
| 27 | + 'directories' => [__DIR__.'/../src/Command', __DIR__.'/Fixtures/'], |
|
| 28 | 28 | 'exclude' => [] |
| 29 | 29 | ]; |
| 30 | 30 | |
@@ -34,9 +34,9 @@ discard block |
||
| 34 | 34 | ['command' => 'test', 'header' => 'Test Command'], |
| 35 | 35 | ['command' => 'helper', 'options' => ['helper' => 'writeln'], 'footer' => 'Good!'], |
| 36 | 36 | ['invoke' => [self::class, 'do']], |
| 37 | - ['invoke' => self::class . '::do'], |
|
| 37 | + ['invoke' => self::class.'::do'], |
|
| 38 | 38 | 'Spiral\Tests\Console\ok', |
| 39 | - ['invoke' => self::class . '::err'], |
|
| 39 | + ['invoke' => self::class.'::err'], |
|
| 40 | 40 | ] |
| 41 | 41 | ]; |
| 42 | 42 | |
@@ -126,10 +126,12 @@ |
||
| 126 | 126 | $this->assertEquals(1, $output->getCode()); |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - public function do(OutputInterface $output): void |
|
| 129 | + public function do{ |
|
| 130 | + (OutputInterface $output): void |
|
| 130 | 131 | { |
| 131 | 132 | $output->write('OK'); |
| 132 | 133 | } |
| 134 | + } |
|
| 133 | 135 | |
| 134 | 136 | public function err(OutputInterface $output): void |
| 135 | 137 | { |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | abstract class BaseTest extends TestCase |
| 22 | 22 | { |
| 23 | 23 | public const TOKENIZER_CONFIG = [ |
| 24 | - 'directories' => [__DIR__ . '/Fixtures/'], |
|
| 24 | + 'directories' => [__DIR__.'/Fixtures/'], |
|
| 25 | 25 | 'exclude' => ['User'], |
| 26 | 26 | ]; |
| 27 | 27 | |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | class UpdateTest extends BaseTest |
| 25 | 25 | { |
| 26 | 26 | public const TOKENIZER_CONFIG = [ |
| 27 | - 'directories' => [__DIR__ . '/../src/Command', __DIR__ . '/Fixtures/'], |
|
| 27 | + 'directories' => [__DIR__.'/../src/Command', __DIR__.'/Fixtures/'], |
|
| 28 | 28 | 'exclude' => [] |
| 29 | 29 | ]; |
| 30 | 30 | |
@@ -35,9 +35,9 @@ discard block |
||
| 35 | 35 | ['command' => 'test', 'header' => 'Test Command'], |
| 36 | 36 | ['command' => 'helper', 'options' => ['helper' => 'writeln'], 'footer' => 'Good!'], |
| 37 | 37 | ['invoke' => [self::class, 'do']], |
| 38 | - ['invoke' => self::class . '::do'], |
|
| 38 | + ['invoke' => self::class.'::do'], |
|
| 39 | 39 | 'Spiral\Tests\Console\ok', |
| 40 | - ['invoke' => self::class . '::err'], |
|
| 40 | + ['invoke' => self::class.'::err'], |
|
| 41 | 41 | ] |
| 42 | 42 | ]; |
| 43 | 43 | |
@@ -126,10 +126,12 @@ |
||
| 126 | 126 | $this->assertEquals(1, $output->getCode()); |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - public function do(OutputInterface $output): void |
|
| 129 | + public function do{ |
|
| 130 | + (OutputInterface $output): void |
|
| 130 | 131 | { |
| 131 | 132 | $output->write('OK'); |
| 132 | 133 | } |
| 134 | + } |
|
| 133 | 135 | |
| 134 | 136 | public function err(OutputInterface $output): void |
| 135 | 137 | { |
@@ -22,6 +22,6 @@ |
||
| 22 | 22 | */ |
| 23 | 23 | public function perform(): void |
| 24 | 24 | { |
| 25 | - throw new Exception('Unhandled another failed command error at ' . __METHOD__ . ' (line ' . __LINE__ . ')'); |
|
| 25 | + throw new Exception('Unhandled another failed command error at '.__METHOD__.' (line '.__LINE__.')'); |
|
| 26 | 26 | } |
| 27 | 27 | } |
@@ -22,6 +22,6 @@ |
||
| 22 | 22 | */ |
| 23 | 23 | public function perform(): void |
| 24 | 24 | { |
| 25 | - throw new Exception('Unhandled failed command error at ' . __METHOD__ . ' (line ' . __LINE__ . ')'); |
|
| 25 | + throw new Exception('Unhandled failed command error at '.__METHOD__.' (line '.__LINE__.')'); |
|
| 26 | 26 | } |
| 27 | 27 | } |
@@ -22,6 +22,6 @@ |
||
| 22 | 22 | |
| 23 | 23 | public function perform(): void |
| 24 | 24 | { |
| 25 | - $this->write('Hello World - ' . ($this->count++)); |
|
| 25 | + $this->write('Hello World - '.($this->count++)); |
|
| 26 | 26 | } |
| 27 | 27 | } |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | |
| 27 | 27 | public function perform(): void |
| 28 | 28 | { |
| 29 | - switch ($this->argument('helper')) { |
|
| 29 | + switch ($this->argument('helper')){ |
|
| 30 | 30 | case 'verbose': |
| 31 | 31 | $this->write($this->isVerbose() ? 'true' : 'false'); |
| 32 | 32 | break; |
@@ -26,7 +26,8 @@ |
||
| 26 | 26 | |
| 27 | 27 | public function perform(): void |
| 28 | 28 | { |
| 29 | - switch ($this->argument('helper')) { |
|
| 29 | + switch ($this->argument('helper')) |
|
| 30 | + { |
|
| 30 | 31 | case 'verbose': |
| 31 | 32 | $this->write($this->isVerbose() ? 'true' : 'false'); |
| 32 | 33 | break; |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | $headers = $acceptHeader->getAll(); |
| 119 | 119 | $this->assertCount(count($expected), $headers); |
| 120 | 120 | |
| 121 | - foreach ($expected as $i => $value) { |
|
| 121 | + foreach ($expected as $i => $value){ |
|
| 122 | 122 | $this->assertSame($value, $headers[$i]->getValue()); |
| 123 | 123 | } |
| 124 | 124 | } |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | $headers = $acceptHeader->getAll(); |
| 165 | 165 | $this->assertCount(count($expected), $headers); |
| 166 | 166 | |
| 167 | - foreach ($expected as $i => $value) { |
|
| 167 | + foreach ($expected as $i => $value){ |
|
| 168 | 168 | $this->assertSame($value, (string)$headers[$i]); |
| 169 | 169 | } |
| 170 | 170 | } |
@@ -118,7 +118,8 @@ discard block |
||
| 118 | 118 | $headers = $acceptHeader->getAll(); |
| 119 | 119 | $this->assertCount(count($expected), $headers); |
| 120 | 120 | |
| 121 | - foreach ($expected as $i => $value) { |
|
| 121 | + foreach ($expected as $i => $value) |
|
| 122 | + { |
|
| 122 | 123 | $this->assertSame($value, $headers[$i]->getValue()); |
| 123 | 124 | } |
| 124 | 125 | } |
@@ -164,7 +165,8 @@ discard block |
||
| 164 | 165 | $headers = $acceptHeader->getAll(); |
| 165 | 166 | $this->assertCount(count($expected), $headers); |
| 166 | 167 | |
| 167 | - foreach ($expected as $i => $value) { |
|
| 168 | + foreach ($expected as $i => $value) |
|
| 169 | + { |
|
| 168 | 170 | $this->assertSame($value, (string)$headers[$i]); |
| 169 | 171 | } |
| 170 | 172 | } |