@@ -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 | } |
@@ -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,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 | |