@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | { |
| 15 | 15 | public function __construct( |
| 16 | 16 | private readonly Parser $parser |
| 17 | - ) { |
|
| 17 | + ){ |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | public function canConfigure(Command $command, \ReflectionClass $reflection): bool |
@@ -27,14 +27,14 @@ discard block |
||
| 27 | 27 | $result = $this->parser->parse($reflection); |
| 28 | 28 | |
| 29 | 29 | $command->setName($result->name); |
| 30 | - $command->setDescription($result->description ?? (string) $reflection->getConstant('DESCRIPTION')); |
|
| 31 | - $command->setHelp((string) $result->help); |
|
| 30 | + $command->setDescription($result->description ?? (string)$reflection->getConstant('DESCRIPTION')); |
|
| 31 | + $command->setHelp((string)$result->help); |
|
| 32 | 32 | |
| 33 | - foreach ($result->options as $option) { |
|
| 33 | + foreach ($result->options as $option){ |
|
| 34 | 34 | $command->getDefinition()->addOption($option); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - foreach ($result->arguments as $argument) { |
|
| 37 | + foreach ($result->arguments as $argument){ |
|
| 38 | 38 | $command->getDefinition()->addArgument($argument); |
| 39 | 39 | } |
| 40 | 40 | } |
@@ -30,11 +30,13 @@ |
||
| 30 | 30 | $command->setDescription($result->description ?? (string) $reflection->getConstant('DESCRIPTION')); |
| 31 | 31 | $command->setHelp((string) $result->help); |
| 32 | 32 | |
| 33 | - foreach ($result->options as $option) { |
|
| 33 | + foreach ($result->options as $option) |
|
| 34 | + { |
|
| 34 | 35 | $command->getDefinition()->addOption($option); |
| 35 | 36 | } |
| 36 | 37 | |
| 37 | - foreach ($result->arguments as $argument) { |
|
| 38 | + foreach ($result->arguments as $argument) |
|
| 39 | + { |
|
| 38 | 40 | $command->getDefinition()->addArgument($argument); |
| 39 | 41 | } |
| 40 | 42 | } |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | { |
| 15 | 15 | public function __construct( |
| 16 | 16 | private readonly Parser $parser |
| 17 | - ) { |
|
| 17 | + ){ |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | public function canConfigure(Command $command, \ReflectionClass $reflection): bool |
@@ -24,16 +24,16 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | public function configure(Command $command, \ReflectionClass $reflection): void |
| 26 | 26 | { |
| 27 | - $result = $this->parser->parse((string) $reflection->getConstant('SIGNATURE')); |
|
| 27 | + $result = $this->parser->parse((string)$reflection->getConstant('SIGNATURE')); |
|
| 28 | 28 | |
| 29 | 29 | $command->setName($result->name); |
| 30 | - $command->setDescription($result->description ?? (string) $reflection->getConstant('DESCRIPTION')); |
|
| 30 | + $command->setDescription($result->description ?? (string)$reflection->getConstant('DESCRIPTION')); |
|
| 31 | 31 | |
| 32 | - foreach ($result->options as $option) { |
|
| 32 | + foreach ($result->options as $option){ |
|
| 33 | 33 | $command->getDefinition()->addOption($option); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - foreach ($result->arguments as $argument) { |
|
| 36 | + foreach ($result->arguments as $argument){ |
|
| 37 | 37 | $command->getDefinition()->addArgument($argument); |
| 38 | 38 | } |
| 39 | 39 | } |
@@ -29,11 +29,13 @@ |
||
| 29 | 29 | $command->setName($result->name); |
| 30 | 30 | $command->setDescription($result->description ?? (string) $reflection->getConstant('DESCRIPTION')); |
| 31 | 31 | |
| 32 | - foreach ($result->options as $option) { |
|
| 32 | + foreach ($result->options as $option) |
|
| 33 | + { |
|
| 33 | 34 | $command->getDefinition()->addOption($option); |
| 34 | 35 | } |
| 35 | 36 | |
| 36 | - foreach ($result->arguments as $argument) { |
|
| 37 | + foreach ($result->arguments as $argument) |
|
| 38 | + { |
|
| 37 | 39 | $command->getDefinition()->addArgument($argument); |
| 38 | 40 | } |
| 39 | 41 | } |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | { |
| 14 | 14 | $core = $this->getCore( |
| 15 | 15 | $this->getStaticLocator([ |
| 16 | - new class extends Command { |
|
| 16 | + new class extends Command{ |
|
| 17 | 17 | protected const SIGNATURE = 'foo:bar {arg?} {--o|option}'; |
| 18 | 18 | |
| 19 | 19 | public function perform(): int |
@@ -21,11 +21,11 @@ discard block |
||
| 21 | 21 | $argument = $this->argument('arg'); |
| 22 | 22 | $option = $this->option('option'); |
| 23 | 23 | |
| 24 | - if ($argument) { |
|
| 24 | + if ($argument){ |
|
| 25 | 25 | $this->write('argument : '.$argument); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - if ($option) { |
|
| 28 | + if ($option){ |
|
| 29 | 29 | $this->write('option : '.$option); |
| 30 | 30 | } |
| 31 | 31 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | { |
| 66 | 66 | $core = $this->getCore( |
| 67 | 67 | $this->getStaticLocator([ |
| 68 | - new class extends Command { |
|
| 68 | + new class extends Command{ |
|
| 69 | 69 | protected const SIGNATURE = 'foo:bar {arg[]?} {--o|option[]=}'; |
| 70 | 70 | |
| 71 | 71 | public function perform(): int |
@@ -73,11 +73,11 @@ discard block |
||
| 73 | 73 | $argument = (array)$this->argument('arg'); |
| 74 | 74 | $option = (array)$this->option('option'); |
| 75 | 75 | |
| 76 | - if ($argument) { |
|
| 76 | + if ($argument){ |
|
| 77 | 77 | $this->write('argument : '.\implode(',', $argument)); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - if ($option) { |
|
| 80 | + if ($option){ |
|
| 81 | 81 | $this->write('option : '.\implode(',', $option)); |
| 82 | 82 | } |
| 83 | 83 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | { |
| 119 | 119 | $core = $this->getCore( |
| 120 | 120 | $this->getStaticLocator([ |
| 121 | - new class extends Command { |
|
| 121 | + new class extends Command{ |
|
| 122 | 122 | protected const SIGNATURE = 'foo:bar |
| 123 | 123 | {foo : Foo arg description. } |
| 124 | 124 | {bar=default : Bar arg description. } |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | { |
| 168 | 168 | $core = $this->getCore( |
| 169 | 169 | $this->getStaticLocator([ |
| 170 | - new class extends Command { |
|
| 170 | + new class extends Command{ |
|
| 171 | 171 | protected const SIGNATURE = 'foo:bar'; |
| 172 | 172 | protected const DESCRIPTION = 'baz'; |
| 173 | 173 | |
@@ -13,7 +13,8 @@ discard block |
||
| 13 | 13 | { |
| 14 | 14 | $core = $this->getCore( |
| 15 | 15 | $this->getStaticLocator([ |
| 16 | - new class extends Command { |
|
| 16 | + new class extends Command |
|
| 17 | + { |
|
| 17 | 18 | protected const SIGNATURE = 'foo:bar {arg?} {--o|option}'; |
| 18 | 19 | |
| 19 | 20 | public function perform(): int |
@@ -21,11 +22,13 @@ discard block |
||
| 21 | 22 | $argument = $this->argument('arg'); |
| 22 | 23 | $option = $this->option('option'); |
| 23 | 24 | |
| 24 | - if ($argument) { |
|
| 25 | + if ($argument) |
|
| 26 | + { |
|
| 25 | 27 | $this->write('argument : '.$argument); |
| 26 | 28 | } |
| 27 | 29 | |
| 28 | - if ($option) { |
|
| 30 | + if ($option) |
|
| 31 | + { |
|
| 29 | 32 | $this->write('option : '.$option); |
| 30 | 33 | } |
| 31 | 34 | |
@@ -65,7 +68,8 @@ discard block |
||
| 65 | 68 | { |
| 66 | 69 | $core = $this->getCore( |
| 67 | 70 | $this->getStaticLocator([ |
| 68 | - new class extends Command { |
|
| 71 | + new class extends Command |
|
| 72 | + { |
|
| 69 | 73 | protected const SIGNATURE = 'foo:bar {arg[]?} {--o|option[]=}'; |
| 70 | 74 | |
| 71 | 75 | public function perform(): int |
@@ -73,11 +77,13 @@ discard block |
||
| 73 | 77 | $argument = (array)$this->argument('arg'); |
| 74 | 78 | $option = (array)$this->option('option'); |
| 75 | 79 | |
| 76 | - if ($argument) { |
|
| 80 | + if ($argument) |
|
| 81 | + { |
|
| 77 | 82 | $this->write('argument : '.\implode(',', $argument)); |
| 78 | 83 | } |
| 79 | 84 | |
| 80 | - if ($option) { |
|
| 85 | + if ($option) |
|
| 86 | + { |
|
| 81 | 87 | $this->write('option : '.\implode(',', $option)); |
| 82 | 88 | } |
| 83 | 89 | |
@@ -118,7 +124,8 @@ discard block |
||
| 118 | 124 | { |
| 119 | 125 | $core = $this->getCore( |
| 120 | 126 | $this->getStaticLocator([ |
| 121 | - new class extends Command { |
|
| 127 | + new class extends Command |
|
| 128 | + { |
|
| 122 | 129 | protected const SIGNATURE = 'foo:bar |
| 123 | 130 | {foo : Foo arg description. } |
| 124 | 131 | {bar=default : Bar arg description. } |
@@ -167,7 +174,8 @@ discard block |
||
| 167 | 174 | { |
| 168 | 175 | $core = $this->getCore( |
| 169 | 176 | $this->getStaticLocator([ |
| 170 | - new class extends Command { |
|
| 177 | + new class extends Command |
|
| 178 | + { |
|
| 171 | 179 | protected const SIGNATURE = 'foo:bar'; |
| 172 | 180 | protected const DESCRIPTION = 'baz'; |
| 173 | 181 | |