Test Failed
Pull Request — master (#878)
by butschster
08:18
created
src/Console/tests/Configurator/Attribute/FillPropertiesTest.php 1 patch
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,7 +36,8 @@  discard block
 block discarded – undo
36 36
             ->method('getArgument')
37 37
             ->willReturnOnConsecutiveCalls(5, 'foo', ['foo', 'bar'], 0.5, true);
38 38
 
39
-        $command = new #[AsCommand('foo')] class extends Command {
39
+        $command = new #[AsCommand('foo')] class extends Command
40
+        {
40 41
             #[Argument]
41 42
             public int $intVal;
42 43
 
@@ -75,7 +76,8 @@  discard block
 block discarded – undo
75 76
             ->expects($this->never())
76 77
             ->method('getArgument');
77 78
 
78
-        $command = new #[AsCommand('foo')] class extends Command {
79
+        $command = new #[AsCommand('foo')] class extends Command
80
+        {
79 81
             #[Argument]
80 82
             public int $arg;
81 83
         };
@@ -98,7 +100,8 @@  discard block
 block discarded – undo
98 100
             ->method('getOption')
99 101
             ->willReturnOnConsecutiveCalls(5, 'foo', ['foo', 'bar'], 0.5, true, true);
100 102
 
101
-        $command = new #[AsCommand('foo')] class extends Command {
103
+        $command = new #[AsCommand('foo')] class extends Command
104
+        {
102 105
             #[Option(mode: InputOption::VALUE_REQUIRED)]
103 106
             public int $intVal;
104 107
 
@@ -141,7 +144,8 @@  discard block
 block discarded – undo
141 144
             ->expects($this->never())
142 145
             ->method('getOption');
143 146
 
144
-        $command = new #[AsCommand('foo')] class extends Command {
147
+        $command = new #[AsCommand('foo')] class extends Command
148
+        {
145 149
             #[Option(mode: InputOption::VALUE_REQUIRED)]
146 150
             public int $option;
147 151
         };
Please login to merge, or discard this patch.
src/Console/tests/Configurator/Attribute/OptionsTest.php 1 patch
Braces   +28 added lines, -14 removed lines patch added patch discarded remove patch
@@ -26,7 +26,8 @@  discard block
 block discarded – undo
26 26
     public function testRequired(): void
27 27
     {
28 28
         $result = $this->parser->parse(new \ReflectionClass(
29
-            new #[AsCommand(name: 'foo')] class {
29
+            new #[AsCommand(name: 'foo')] class
30
+            {
30 31
                 #[Option(mode: InputOption::VALUE_REQUIRED)]
31 32
                 private int $option;
32 33
             }
@@ -44,7 +45,8 @@  discard block
 block discarded – undo
44 45
     public function testDefaultValue(): void
45 46
     {
46 47
         $result = $this->parser->parse(new \ReflectionClass(
47
-            new #[AsCommand(name: 'foo')] class {
48
+            new #[AsCommand(name: 'foo')] class
49
+            {
48 50
                 #[Option(mode: InputOption::VALUE_OPTIONAL)]
49 51
                 private string $option = 'some';
50 52
             }
@@ -62,7 +64,8 @@  discard block
 block discarded – undo
62 64
     public function testNullable(): void
63 65
     {
64 66
         $result = $this->parser->parse(new \ReflectionClass(
65
-            new #[AsCommand(name: 'foo')] class {
67
+            new #[AsCommand(name: 'foo')] class
68
+            {
66 69
                 #[Option(mode: InputOption::VALUE_OPTIONAL)]
67 70
                 private ?string $option;
68 71
             }
@@ -80,7 +83,8 @@  discard block
 block discarded – undo
80 83
     public function testWithName(): void
81 84
     {
82 85
         $result = $this->parser->parse(new \ReflectionClass(
83
-            new #[AsCommand(name: 'foo')] class {
86
+            new #[AsCommand(name: 'foo')] class
87
+            {
84 88
                 #[Option(name: 'customName', mode: InputOption::VALUE_OPTIONAL)]
85 89
                 private ?string $option;
86 90
             }
@@ -98,7 +102,8 @@  discard block
 block discarded – undo
98 102
     public function testWithShortcut(): void
99 103
     {
100 104
         $result = $this->parser->parse(new \ReflectionClass(
101
-            new #[AsCommand(name: 'foo')] class {
105
+            new #[AsCommand(name: 'foo')] class
106
+            {
102 107
                 #[Option(shortcut: 't', mode: InputOption::VALUE_OPTIONAL)]
103 108
                 private ?string $option;
104 109
             }
@@ -116,7 +121,8 @@  discard block
 block discarded – undo
116 121
     public function testWithDescription(): void
117 122
     {
118 123
         $result = $this->parser->parse(new \ReflectionClass(
119
-            new #[AsCommand(name: 'foo')] class {
124
+            new #[AsCommand(name: 'foo')] class
125
+            {
120 126
                 #[Option(description: 'Some description', mode: InputOption::VALUE_OPTIONAL)]
121 127
                 private ?string $option;
122 128
             }
@@ -134,7 +140,8 @@  discard block
 block discarded – undo
134 140
     public function testModeOptionalArray(): void
135 141
     {
136 142
         $result = $this->parser->parse(new \ReflectionClass(
137
-            new #[AsCommand(name: 'foo')] class {
143
+            new #[AsCommand(name: 'foo')] class
144
+            {
138 145
                 #[Option(mode: InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY)]
139 146
                 private array $option = [];
140 147
             }
@@ -152,7 +159,8 @@  discard block
 block discarded – undo
152 159
     public function testModeRequiredArray(): void
153 160
     {
154 161
         $result = $this->parser->parse(new \ReflectionClass(
155
-            new #[AsCommand(name: 'foo')] class {
162
+            new #[AsCommand(name: 'foo')] class
163
+            {
156 164
                 #[Option(mode: InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY)]
157 165
                 private array $option = [];
158 166
             }
@@ -170,7 +178,8 @@  discard block
 block discarded – undo
170 178
     public function testModeValueNegatable(): void
171 179
     {
172 180
         $result = $this->parser->parse(new \ReflectionClass(
173
-            new #[AsCommand(name: 'foo')] class {
181
+            new #[AsCommand(name: 'foo')] class
182
+            {
174 183
                 #[Option(mode: InputOption::VALUE_NEGATABLE)]
175 184
                 private bool $option;
176 185
             }
@@ -188,7 +197,8 @@  discard block
 block discarded – undo
188 197
     public function testModeValueNone(): void
189 198
     {
190 199
         $result = $this->parser->parse(new \ReflectionClass(
191
-            new #[AsCommand(name: 'foo')] class {
200
+            new #[AsCommand(name: 'foo')] class
201
+            {
192 202
                 #[Option(mode: InputOption::VALUE_NONE)]
193 203
                 private bool $option;
194 204
             }
@@ -206,7 +216,8 @@  discard block
 block discarded – undo
206 216
     public function testWithSuggestedValue(): void
207 217
     {
208 218
         $result = $this->parser->parse(new \ReflectionClass(
209
-            new #[AsCommand(name: 'foo')] class {
219
+            new #[AsCommand(name: 'foo')] class
220
+            {
210 221
                 #[Option(mode: InputOption::VALUE_REQUIRED, suggestedValues: [1, 0])]
211 222
                 private int $option;
212 223
             }
@@ -232,7 +243,8 @@  discard block
 block discarded – undo
232 243
     public function testUnionTypeWithBuiltInAndNot(): void
233 244
     {
234 245
         $result = $this->parser->parse(new \ReflectionClass(
235
-            new #[AsCommand(name: 'foo')] class {
246
+            new #[AsCommand(name: 'foo')] class
247
+            {
236 248
                 #[Option(mode: InputOption::VALUE_OPTIONAL)]
237 249
                 private int|\stdClass $option;
238 250
             }
@@ -251,7 +263,8 @@  discard block
 block discarded – undo
251 263
     {
252 264
         $this->expectException(ConfiguratorException::class);
253 265
         $this->parser->parse(new \ReflectionClass(
254
-            new #[AsCommand(name: 'foo')] class {
266
+            new #[AsCommand(name: 'foo')] class
267
+            {
255 268
                 #[Option]
256 269
                 private \stdClass $option;
257 270
             }
@@ -262,7 +275,8 @@  discard block
 block discarded – undo
262 275
     {
263 276
         $this->expectException(ConfiguratorException::class);
264 277
         $this->parser->parse(new \ReflectionClass(
265
-            new #[AsCommand(name: 'foo')] class {
278
+            new #[AsCommand(name: 'foo')] class
279
+            {
266 280
                 #[Option]
267 281
                 private \stdClass&\Traversable $option;
268 282
             }
Please login to merge, or discard this patch.
src/Console/tests/Configurator/Attribute/ArgumentsTest.php 1 patch
Braces   +26 added lines, -13 removed lines patch added patch discarded remove patch
@@ -25,7 +25,8 @@  discard block
 block discarded – undo
25 25
     public function testRequired(): void
26 26
     {
27 27
         $result = $this->parser->parse(new \ReflectionClass(
28
-            new #[AsCommand(name: 'foo')] class {
28
+            new #[AsCommand(name: 'foo')] class
29
+            {
29 30
                 #[Argument]
30 31
                 private int $arg;
31 32
             }
@@ -41,7 +42,8 @@  discard block
 block discarded – undo
41 42
     public function testWithDefaultValue(): void
42 43
     {
43 44
         $result = $this->parser->parse(new \ReflectionClass(
44
-            new #[AsCommand(name: 'foo')] class {
45
+            new #[AsCommand(name: 'foo')] class
46
+            {
45 47
                 #[Argument]
46 48
                 private int $arg = 1;
47 49
             }
@@ -57,7 +59,8 @@  discard block
 block discarded – undo
57 59
     public function testNullable(): void
58 60
     {
59 61
         $result = $this->parser->parse(new \ReflectionClass(
60
-            new #[AsCommand(name: 'foo')] class {
62
+            new #[AsCommand(name: 'foo')] class
63
+            {
61 64
                 #[Argument]
62 65
                 private ?int $arg;
63 66
             }
@@ -73,7 +76,8 @@  discard block
 block discarded – undo
73 76
     public function testWithName(): void
74 77
     {
75 78
         $result = $this->parser->parse(new \ReflectionClass(
76
-            new #[AsCommand(name: 'foo')] class {
79
+            new #[AsCommand(name: 'foo')] class
80
+            {
77 81
                 #[Argument(name: 'customName')]
78 82
                 private int $arg;
79 83
             }
@@ -89,7 +93,8 @@  discard block
 block discarded – undo
89 93
     public function testWithDescription(): void
90 94
     {
91 95
         $result = $this->parser->parse(new \ReflectionClass(
92
-            new #[AsCommand(name: 'foo')] class {
96
+            new #[AsCommand(name: 'foo')] class
97
+            {
93 98
                 #[Argument(description: 'Some description')]
94 99
                 private int $arg;
95 100
             }
@@ -105,7 +110,8 @@  discard block
 block discarded – undo
105 110
     public function testWithSuggestedValue(): void
106 111
     {
107 112
         $result = $this->parser->parse(new \ReflectionClass(
108
-            new #[AsCommand(name: 'foo')] class {
113
+            new #[AsCommand(name: 'foo')] class
114
+            {
109 115
                 #[Argument(suggestedValues: [1, 0])]
110 116
                 private int $arg;
111 117
             }
@@ -129,7 +135,8 @@  discard block
 block discarded – undo
129 135
     public function testArrayRequired(): void
130 136
     {
131 137
         $result = $this->parser->parse(new \ReflectionClass(
132
-            new #[AsCommand(name: 'foo')] class {
138
+            new #[AsCommand(name: 'foo')] class
139
+            {
133 140
                 #[Argument]
134 141
                 private array $arg;
135 142
             }
@@ -145,7 +152,8 @@  discard block
 block discarded – undo
145 152
     public function testArrayNotRequired(): void
146 153
     {
147 154
         $result = $this->parser->parse(new \ReflectionClass(
148
-            new #[AsCommand(name: 'foo')] class {
155
+            new #[AsCommand(name: 'foo')] class
156
+            {
149 157
                 #[Argument]
150 158
                 private ?array $arg;
151 159
             }
@@ -161,7 +169,8 @@  discard block
 block discarded – undo
161 169
     public function testArrayShouldBeLast(): void
162 170
     {
163 171
         $result = $this->parser->parse(new \ReflectionClass(
164
-            new #[AsCommand(name: 'foo')] class {
172
+            new #[AsCommand(name: 'foo')] class
173
+            {
165 174
                 #[Argument]
166 175
                 private ?array $arg;
167 176
 
@@ -180,7 +189,8 @@  discard block
 block discarded – undo
180 189
     public function testUnionTypeWithBuiltInAndNot(): void
181 190
     {
182 191
         $result = $this->parser->parse(new \ReflectionClass(
183
-            new #[AsCommand(name: 'foo')] class {
192
+            new #[AsCommand(name: 'foo')] class
193
+            {
184 194
                 #[Argument]
185 195
                 private int|\stdClass $arg;
186 196
             }
@@ -197,7 +207,8 @@  discard block
 block discarded – undo
197 207
     {
198 208
         $this->expectException(ConfiguratorException::class);
199 209
         $this->parser->parse(new \ReflectionClass(
200
-            new #[AsCommand(name: 'foo')] class {
210
+            new #[AsCommand(name: 'foo')] class
211
+            {
201 212
                 #[Argument]
202 213
                 private \stdClass $arg;
203 214
             }
@@ -208,7 +219,8 @@  discard block
 block discarded – undo
208 219
     {
209 220
         $this->expectException(ConfiguratorException::class);
210 221
         $this->parser->parse(new \ReflectionClass(
211
-            new #[AsCommand(name: 'foo')] class {
222
+            new #[AsCommand(name: 'foo')] class
223
+            {
212 224
                 #[Argument]
213 225
                 private \stdClass&\Traversable $arg;
214 226
             }
@@ -219,7 +231,8 @@  discard block
 block discarded – undo
219 231
     {
220 232
         $this->expectException(ConfiguratorException::class);
221 233
         $this->parser->parse(new \ReflectionClass(
222
-            new #[AsCommand(name: 'foo')] class {
234
+            new #[AsCommand(name: 'foo')] class
235
+            {
223 236
                 #[Argument]
224 237
                 private array $arg;
225 238
 
Please login to merge, or discard this patch.
src/Console/src/Configurator/Configurator.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,8 +21,10 @@
 block discarded – undo
21 21
 
22 22
     public function configure(Command $command, \ReflectionClass $reflection): void
23 23
     {
24
-        foreach ($this->configurators as $configurator) {
25
-            if ($configurator->canConfigure($command, $reflection)) {
24
+        foreach ($this->configurators as $configurator)
25
+        {
26
+            if ($configurator->canConfigure($command, $reflection))
27
+            {
26 28
                 $configurator->configure($command, $reflection);
27 29
                 return;
28 30
             }
Please login to merge, or discard this patch.
src/Console/src/Command.php 1 patch
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -75,7 +75,8 @@  discard block
 block discarded – undo
75 75
      */
76 76
     protected function execute(InputInterface $input, OutputInterface $output): int
77 77
     {
78
-        if ($this->container === null) {
78
+        if ($this->container === null)
79
+        {
79 80
             throw new ScopeException('Container is not set');
80 81
         }
81 82
 
@@ -83,7 +84,8 @@  discard block
 block discarded – undo
83 84
 
84 85
         $core = $this->buildCore();
85 86
 
86
-        try {
87
+        try
88
+        {
87 89
             [$this->input, $this->output] = [$this->prepareInput($input), $this->prepareOutput($input, $output)];
88 90
 
89 91
             $this->eventDispatcher?->dispatch(new CommandStarting($this, $this->input, $this->output));
@@ -98,7 +100,9 @@  discard block
 block discarded – undo
98 100
             $this->eventDispatcher?->dispatch(new CommandFinished($this, $code, $this->input, $this->output));
99 101
 
100 102
             return $code;
101
-        } finally {
103
+        }
104
+        finally
105
+        {
102 106
             [$this->input, $this->output] = [null, null];
103 107
         }
104 108
     }
@@ -109,7 +113,8 @@  discard block
 block discarded – undo
109 113
 
110 114
         $interceptableCore = new InterceptableCore($core, $this->eventDispatcher);
111 115
 
112
-        foreach ($this->interceptors as $interceptor) {
116
+        foreach ($this->interceptors as $interceptor)
117
+        {
113 118
             $interceptableCore->addInterceptor($this->container->get($interceptor));
114 119
         }
115 120
         $interceptableCore->addInterceptor($this->container->get(AttributeInterceptor::class));
Please login to merge, or discard this patch.
src/Console/src/Configurator/Attribute/Parser.php 1 patch
Braces   +46 added lines, -23 removed lines patch added patch discarded remove patch
@@ -37,7 +37,8 @@  discard block
 block discarded – undo
37 37
     {
38 38
         $attribute = $this->reader->firstClassMetadata($reflection, AsCommand::class);
39 39
 
40
-        if ($attribute === null) {
40
+        if ($attribute === null)
41
+        {
41 42
             $attribute = $reflection->getAttributes(SymfonyAsCommand::class)[0]->newInstance();
42 43
         }
43 44
 
@@ -54,13 +55,16 @@  discard block
 block discarded – undo
54 55
     {
55 56
         $reflection = new \ReflectionClass($command);
56 57
 
57
-        foreach ($reflection->getProperties() as $property) {
58
+        foreach ($reflection->getProperties() as $property)
59
+        {
58 60
             $attribute = $this->reader->firstPropertyMetadata($property, Argument::class);
59
-            if ($attribute === null) {
61
+            if ($attribute === null)
62
+            {
60 63
                 continue;
61 64
             }
62 65
 
63
-            if ($input->hasArgument($attribute->name ?? $property->getName())) {
66
+            if ($input->hasArgument($attribute->name ?? $property->getName()))
67
+            {
64 68
                 $property->setValue(
65 69
                     $command,
66 70
                     $this->typecast($input->getArgument($attribute->name ?? $property->getName()), $property)
@@ -68,13 +72,16 @@  discard block
 block discarded – undo
68 72
             }
69 73
         }
70 74
 
71
-        foreach ($reflection->getProperties() as $property) {
75
+        foreach ($reflection->getProperties() as $property)
76
+        {
72 77
             $attribute = $this->reader->firstPropertyMetadata($property, Option::class);
73
-            if ($attribute === null) {
78
+            if ($attribute === null)
79
+            {
74 80
                 continue;
75 81
             }
76 82
 
77
-            if ($input->hasOption($attribute->name ?? $property->getName())) {
83
+            if ($input->hasOption($attribute->name ?? $property->getName()))
84
+            {
78 85
                 $property->setValue(
79 86
                     $command,
80 87
                     $this->typecast($input->getOption($attribute->name ?? $property->getName()), $property)
@@ -87,9 +94,11 @@  discard block
 block discarded – undo
87 94
     {
88 95
         $result = [];
89 96
         $arrayArgument = null;
90
-        foreach ($reflection->getProperties() as $property) {
97
+        foreach ($reflection->getProperties() as $property)
98
+        {
91 99
             $attribute = $this->reader->firstPropertyMetadata($property, Argument::class);
92
-            if ($attribute === null) {
100
+            if ($attribute === null)
101
+            {
93 102
                 continue;
94 103
             }
95 104
 
@@ -112,19 +121,22 @@  discard block
 block discarded – undo
112 121
                 suggestedValues: $attribute->suggestedValues
113 122
             );
114 123
 
115
-            if ($arrayArgument !== null && $isArray) {
124
+            if ($arrayArgument !== null && $isArray)
125
+            {
116 126
                 throw new ConfiguratorException('There must be only one array argument!');
117 127
             }
118 128
 
119 129
             // It must be used at the end of the argument list.
120
-            if ($isArray) {
130
+            if ($isArray)
131
+            {
121 132
                 $arrayArgument = $argument;
122 133
                 continue;
123 134
             }
124 135
             $result[] = $argument;
125 136
         }
126 137
 
127
-        if ($arrayArgument !== null) {
138
+        if ($arrayArgument !== null)
139
+        {
128 140
             $result[] = $arrayArgument;
129 141
         }
130 142
 
@@ -134,16 +146,20 @@  discard block
 block discarded – undo
134 146
     private function parseOptions(\ReflectionClass $reflection): array
135 147
     {
136 148
         $result = [];
137
-        foreach ($reflection->getProperties() as $property) {
149
+        foreach ($reflection->getProperties() as $property)
150
+        {
138 151
             $attribute = $this->reader->firstPropertyMetadata($property, Option::class);
139
-            if ($attribute === null) {
152
+            if ($attribute === null)
153
+            {
140 154
                 continue;
141 155
             }
142 156
 
143 157
             $type = $this->getPropertyType($property);
144 158
 
145
-            if ($attribute->mode === InputOption::VALUE_NONE || $attribute->mode === InputOption::VALUE_NEGATABLE) {
146
-                if ($type->getName() !== 'bool') {
159
+            if ($attribute->mode === InputOption::VALUE_NONE || $attribute->mode === InputOption::VALUE_NEGATABLE)
160
+            {
161
+                if ($type->getName() !== 'bool')
162
+                {
147 163
                     throw new ConfiguratorException(
148 164
                         'Options properties with mode `VALUE_NONE` or `VALUE_NEGATABLE` must be bool!'
149 165
                     );
@@ -169,7 +185,8 @@  discard block
 block discarded – undo
169 185
     {
170 186
         $type = $property->hasType() ? $property->getType() : null;
171 187
 
172
-        if (!$type instanceof \ReflectionNamedType) {
188
+        if (!$type instanceof \ReflectionNamedType)
189
+        {
173 190
             return $value;
174 191
         }
175 192
 
@@ -185,7 +202,8 @@  discard block
 block discarded – undo
185 202
 
186 203
     private function getPropertyType(\ReflectionProperty $property): \ReflectionNamedType
187 204
     {
188
-        if (!$property->hasType()) {
205
+        if (!$property->hasType())
206
+        {
189 207
             throw new ConfiguratorException(
190 208
                 \sprintf('Please, specify the type for the `%s` property!', $property->getName())
191 209
             );
@@ -193,19 +211,24 @@  discard block
 block discarded – undo
193 211
 
194 212
         $type = $property->getType();
195 213
 
196
-        if ($type instanceof \ReflectionIntersectionType) {
214
+        if ($type instanceof \ReflectionIntersectionType)
215
+        {
197 216
             throw new ConfiguratorException(\sprintf('Invalid type for the `%s` property.', $property->getName()));
198 217
         }
199 218
 
200
-        if ($type instanceof \ReflectionUnionType) {
201
-            foreach ($type->getTypes() as $type) {
202
-                if ($type->isBuiltin()) {
219
+        if ($type instanceof \ReflectionUnionType)
220
+        {
221
+            foreach ($type->getTypes() as $type)
222
+            {
223
+                if ($type->isBuiltin())
224
+                {
203 225
                     return $type;
204 226
                 }
205 227
             }
206 228
         }
207 229
 
208
-        if ($type instanceof \ReflectionNamedType && $type->isBuiltin()) {
230
+        if ($type instanceof \ReflectionNamedType && $type->isBuiltin())
231
+        {
209 232
             return $type;
210 233
         }
211 234
 
Please login to merge, or discard this patch.
src/Console/src/PromptArguments.php 1 patch
Braces   +18 added lines, -9 removed lines patch added patch discarded remove patch
@@ -24,13 +24,16 @@  discard block
 block discarded – undo
24 24
     {
25 25
         $io = new SymfonyStyle($input, $output);
26 26
 
27
-        foreach ($command->getDefinition()->getArguments() as $argument) {
27
+        foreach ($command->getDefinition()->getArguments() as $argument)
28
+        {
28 29
             // Skip default argument "the command to execute"
29
-            if ($argument->getName() === 'command') {
30
+            if ($argument->getName() === 'command')
31
+            {
30 32
                 continue;
31 33
             }
32 34
 
33
-            if ($argument->isRequired() && $input->getArgument($argument->getName()) === null) {
35
+            if ($argument->isRequired() && $input->getArgument($argument->getName()) === null)
36
+            {
34 37
                 $input->setArgument(
35 38
                     $argument->getName(),
36 39
                     $io->ask($this->getQuestion($command, $argument))
@@ -43,25 +46,31 @@  discard block
 block discarded – undo
43 46
     {
44 47
         $reflection = new \ReflectionClass($command);
45 48
 
46
-        foreach ($this->reader->getClassMetadata($reflection, Question::class) as $question) {
47
-            if ($question->argument === null) {
49
+        foreach ($this->reader->getClassMetadata($reflection, Question::class) as $question)
50
+        {
51
+            if ($question->argument === null)
52
+            {
48 53
                 throw new ConsoleException(
49 54
                     'When using a `Question` attribute on a console command class, the argument parameter is required.'
50 55
                 );
51 56
             }
52 57
 
53
-            if ($argument->getName() === $question->argument) {
58
+            if ($argument->getName() === $question->argument)
59
+            {
54 60
                 return $question->question;
55 61
             }
56 62
         }
57 63
 
58
-        foreach ($reflection->getProperties() as $property) {
64
+        foreach ($reflection->getProperties() as $property)
65
+        {
59 66
             $question = $this->reader->firstPropertyMetadata($property, Question::class);
60
-            if ($question === null) {
67
+            if ($question === null)
68
+            {
61 69
                 continue;
62 70
             }
63 71
 
64
-            if ($argument->getName() === ($question->argument ?? $property->getName())) {
72
+            if ($argument->getName() === ($question->argument ?? $property->getName()))
73
+            {
65 74
                 return $question->question;
66 75
             }
67 76
         }
Please login to merge, or discard this patch.
src/Console/src/Configurator/ConstantBasedConfigurator.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,11 +16,13 @@
 block discarded – undo
16 16
         $command->setName($reflection->getConstant('NAME'));
17 17
         $command->setDescription((string) $reflection->getConstant('DESCRIPTION'));
18 18
 
19
-        foreach ($reflection->getMethod('defineOptions')->invoke($command) as $option) {
19
+        foreach ($reflection->getMethod('defineOptions')->invoke($command) as $option)
20
+        {
20 21
             \call_user_func_array([$command, 'addOption'], $option);
21 22
         }
22 23
 
23
-        foreach ($reflection->getMethod('defineArguments')->invoke($command) as $argument) {
24
+        foreach ($reflection->getMethod('defineArguments')->invoke($command) as $argument)
25
+        {
24 26
             \call_user_func_array([$command, 'addArgument'], $argument);
25 27
         }
26 28
     }
Please login to merge, or discard this patch.
src/Console/src/Configurator/SignatureBasedConfigurator.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,11 +28,13 @@
 block discarded – undo
28 28
 
29 29
         $command->setName($result->name);
30 30
 
31
-        foreach ($result->options as $option) {
31
+        foreach ($result->options as $option)
32
+        {
32 33
             $command->getDefinition()->addOption($option);
33 34
         }
34 35
 
35
-        foreach ($result->arguments as $argument) {
36
+        foreach ($result->arguments as $argument)
37
+        {
36 38
             $command->getDefinition()->addArgument($argument);
37 39
         }
38 40
     }
Please login to merge, or discard this patch.