Test Failed
Pull Request — master (#872)
by Maxim
08:44
created
src/Console/tests/Configurator/Attribute/FillPropertiesTest.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  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
             #[Argument]
41 41
             public int $intVal;
42 42
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
             ->expects($this->never())
76 76
             ->method('getArgument');
77 77
 
78
-        $command = new #[AsCommand('foo')] class extends Command {
78
+        $command = new #[AsCommand('foo')] class extends Command{
79 79
             #[Argument]
80 80
             public int $arg;
81 81
         };
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
             ->method('getOption')
99 99
             ->willReturnOnConsecutiveCalls(5, 'foo', ['foo', 'bar'], 0.5, true, true);
100 100
 
101
-        $command = new #[AsCommand('foo')] class extends Command {
101
+        $command = new #[AsCommand('foo')] class extends Command{
102 102
             #[Option(mode: InputOption::VALUE_REQUIRED)]
103 103
             public int $intVal;
104 104
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
             ->expects($this->never())
142 142
             ->method('getOption');
143 143
 
144
-        $command = new #[AsCommand('foo')] class extends Command {
144
+        $command = new #[AsCommand('foo')] class extends Command{
145 145
             #[Option(mode: InputOption::VALUE_REQUIRED)]
146 146
             public int $option;
147 147
         };
Please login to merge, or discard this 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 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -234,7 +234,7 @@
 block discarded – undo
234 234
         $result = $this->parser->parse(new \ReflectionClass(
235 235
             new #[AsCommand(name: 'foo')] class {
236 236
                 #[Option(mode: InputOption::VALUE_OPTIONAL)]
237
-                private int|\stdClass $option;
237
+                private int | \stdClass $option;
238 238
             }
239 239
         ));
240 240
 
Please login to merge, or discard this 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 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -182,7 +182,7 @@
 block discarded – undo
182 182
         $result = $this->parser->parse(new \ReflectionClass(
183 183
             new #[AsCommand(name: 'foo')] class {
184 184
                 #[Argument]
185
-                private int|\stdClass $arg;
185
+                private int | \stdClass $arg;
186 186
             }
187 187
         ));
188 188
 
Please login to merge, or discard this 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/Attribute/AsCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,6 +13,6 @@
 block discarded – undo
13 13
         public readonly string $name,
14 14
         public readonly ?string $description = null,
15 15
         public readonly ?string $help = null
16
-    ) {
16
+    ){
17 17
     }
18 18
 }
Please login to merge, or discard this patch.
src/Console/src/Attribute/Option.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,10 +19,10 @@
 block discarded – undo
19 19
      */
20 20
     public function __construct(
21 21
         public readonly ?string $name = null,
22
-        public readonly string|array|null $shortcut = null,
22
+        public readonly string | array | null $shortcut = null,
23 23
         public readonly ?string $description = null,
24 24
         public readonly int $mode = InputOption::VALUE_NONE,
25
-        public readonly \Closure|array $suggestedValues = []
26
-    ) {
25
+        public readonly \Closure | array $suggestedValues = []
26
+    ){
27 27
     }
28 28
 }
Please login to merge, or discard this patch.
src/Console/src/Attribute/Argument.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
     public function __construct(
18 18
         public readonly ?string $name = null,
19 19
         public readonly ?string $description = null,
20
-        public readonly \Closure|array $suggestedValues = [],
21
-    ) {
20
+        public readonly \Closure | array $suggestedValues = [],
21
+    ){
22 22
     }
23 23
 }
Please login to merge, or discard this patch.
src/Console/src/Attribute/Question.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,6 +13,6 @@
 block discarded – undo
13 13
     public function __construct(
14 14
         public readonly string $question,
15 15
         public readonly ?string $argument = null
16
-    ) {
16
+    ){
17 17
     }
18 18
 }
Please login to merge, or discard this patch.
src/Console/src/Configurator/Attribute/Parser.php 2 patches
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 {
24 24
     public function __construct(
25 25
         private readonly ReaderInterface $reader = new AttributeReader()
26
-    ) {
26
+    ){
27 27
     }
28 28
 
29 29
     public function hasCommandAttribute(\ReflectionClass $reflection): bool
@@ -49,13 +49,13 @@  discard block
 block discarded – undo
49 49
     {
50 50
         $reflection = new \ReflectionClass($command);
51 51
 
52
-        foreach ($reflection->getProperties() as $property) {
52
+        foreach ($reflection->getProperties() as $property){
53 53
             $attribute = $this->reader->firstPropertyMetadata($property, Argument::class);
54
-            if ($attribute === null) {
54
+            if ($attribute === null){
55 55
                 continue;
56 56
             }
57 57
 
58
-            if ($input->hasArgument($attribute->name ?? $property->getName())) {
58
+            if ($input->hasArgument($attribute->name ?? $property->getName())){
59 59
                 $property->setValue(
60 60
                     $command,
61 61
                     $this->typecast($input->getArgument($attribute->name ?? $property->getName()), $property)
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
             }
64 64
         }
65 65
 
66
-        foreach ($reflection->getProperties() as $property) {
66
+        foreach ($reflection->getProperties() as $property){
67 67
             $attribute = $this->reader->firstPropertyMetadata($property, Option::class);
68
-            if ($attribute === null) {
68
+            if ($attribute === null){
69 69
                 continue;
70 70
             }
71 71
 
72
-            if ($input->hasOption($attribute->name ?? $property->getName())) {
72
+            if ($input->hasOption($attribute->name ?? $property->getName())){
73 73
                 $property->setValue(
74 74
                     $command,
75 75
                     $this->typecast($input->getOption($attribute->name ?? $property->getName()), $property)
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
     {
83 83
         $result = [];
84 84
         $arrayArgument = null;
85
-        foreach ($reflection->getProperties() as $property) {
85
+        foreach ($reflection->getProperties() as $property){
86 86
             $attribute = $this->reader->firstPropertyMetadata($property, Argument::class);
87
-            if ($attribute === null) {
87
+            if ($attribute === null){
88 88
                 continue;
89 89
             }
90 90
 
@@ -102,24 +102,24 @@  discard block
 block discarded – undo
102 102
             $argument = new InputArgument(
103 103
                 name: $attribute->name ?? $property->getName(),
104 104
                 mode: $mode,
105
-                description: (string) $attribute->description,
105
+                description: (string)$attribute->description,
106 106
                 default: $property->hasDefaultValue() ? $property->getDefaultValue() : null,
107
-                suggestedValues: $attribute->suggestedValues
107
+                suggestedValues : $attribute->suggestedValues
108 108
             );
109 109
 
110
-            if ($arrayArgument !== null && $isArray) {
110
+            if ($arrayArgument !== null && $isArray){
111 111
                 throw new ConfiguratorException('There must be only one array argument!');
112 112
             }
113 113
 
114 114
             // It must be used at the end of the argument list.
115
-            if ($isArray) {
115
+            if ($isArray){
116 116
                 $arrayArgument = $argument;
117 117
                 continue;
118 118
             }
119 119
             $result[] = $argument;
120 120
         }
121 121
 
122
-        if ($arrayArgument !== null) {
122
+        if ($arrayArgument !== null){
123 123
             $result[] = $arrayArgument;
124 124
         }
125 125
 
@@ -129,16 +129,16 @@  discard block
 block discarded – undo
129 129
     private function parseOptions(\ReflectionClass $reflection): array
130 130
     {
131 131
         $result = [];
132
-        foreach ($reflection->getProperties() as $property) {
132
+        foreach ($reflection->getProperties() as $property){
133 133
             $attribute = $this->reader->firstPropertyMetadata($property, Option::class);
134
-            if ($attribute === null) {
134
+            if ($attribute === null){
135 135
                 continue;
136 136
             }
137 137
 
138 138
             $type = $this->getPropertyType($property);
139 139
 
140
-            if ($attribute->mode === InputOption::VALUE_NONE || $attribute->mode === InputOption::VALUE_NEGATABLE) {
141
-                if ($type->getName() !== 'bool') {
140
+            if ($attribute->mode === InputOption::VALUE_NONE || $attribute->mode === InputOption::VALUE_NEGATABLE){
141
+                if ($type->getName() !== 'bool'){
142 142
                     throw new ConfiguratorException(
143 143
                         'Options properties with mode `VALUE_NONE` or `VALUE_NEGATABLE` must be bool!'
144 144
                     );
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
                 name: $attribute->name ?? $property->getName(),
152 152
                 shortcut: $attribute->shortcut,
153 153
                 mode: $attribute->mode,
154
-                description: (string) $attribute->description,
154
+                description: (string)$attribute->description,
155 155
                 default: $hasDefaultValue ? $property->getDefaultValue() : null,
156
-                suggestedValues: $attribute->suggestedValues
156
+                suggestedValues : $attribute->suggestedValues
157 157
             );
158 158
         }
159 159
 
@@ -164,23 +164,23 @@  discard block
 block discarded – undo
164 164
     {
165 165
         $type = $property->hasType() ? $property->getType() : null;
166 166
 
167
-        if (!$type instanceof \ReflectionNamedType) {
167
+        if (!$type instanceof \ReflectionNamedType){
168 168
             return $value;
169 169
         }
170 170
 
171 171
         return match ($type->getName()) {
172
-            'int' => (int) $value,
173
-            'string' => (string) $value,
174
-            'bool' => (bool) $value,
175
-            'float' => (float) $value,
176
-            'array' => (array) $value,
172
+            'int' => (int)$value,
173
+            'string' => (string)$value,
174
+            'bool' => (bool)$value,
175
+            'float' => (float)$value,
176
+            'array' => (array)$value,
177 177
             default => $value
178 178
         };
179 179
     }
180 180
 
181 181
     private function getPropertyType(\ReflectionProperty $property): \ReflectionNamedType
182 182
     {
183
-        if (!$property->hasType()) {
183
+        if (!$property->hasType()){
184 184
             throw new ConfiguratorException(
185 185
                 \sprintf('Please, specify the type for the `%s` property!', $property->getName())
186 186
             );
@@ -188,19 +188,19 @@  discard block
 block discarded – undo
188 188
 
189 189
         $type = $property->getType();
190 190
 
191
-        if ($type instanceof \ReflectionIntersectionType) {
191
+        if ($type instanceof \ReflectionIntersectionType){
192 192
             throw new ConfiguratorException(\sprintf('Invalid type for the `%s` property.', $property->getName()));
193 193
         }
194 194
 
195
-        if ($type instanceof \ReflectionUnionType) {
196
-            foreach ($type->getTypes() as $type) {
197
-                if ($type->isBuiltin()) {
195
+        if ($type instanceof \ReflectionUnionType){
196
+            foreach ($type->getTypes() as $type){
197
+                if ($type->isBuiltin()){
198 198
                     return $type;
199 199
                 }
200 200
             }
201 201
         }
202 202
 
203
-        if ($type instanceof \ReflectionNamedType && $type->isBuiltin()) {
203
+        if ($type instanceof \ReflectionNamedType && $type->isBuiltin()){
204 204
             return $type;
205 205
         }
206 206
 
Please login to merge, or discard this patch.
Braces   +44 added lines, -22 removed lines patch added patch discarded remove patch
@@ -49,13 +49,16 @@  discard block
 block discarded – undo
49 49
     {
50 50
         $reflection = new \ReflectionClass($command);
51 51
 
52
-        foreach ($reflection->getProperties() as $property) {
52
+        foreach ($reflection->getProperties() as $property)
53
+        {
53 54
             $attribute = $this->reader->firstPropertyMetadata($property, Argument::class);
54
-            if ($attribute === null) {
55
+            if ($attribute === null)
56
+            {
55 57
                 continue;
56 58
             }
57 59
 
58
-            if ($input->hasArgument($attribute->name ?? $property->getName())) {
60
+            if ($input->hasArgument($attribute->name ?? $property->getName()))
61
+            {
59 62
                 $property->setValue(
60 63
                     $command,
61 64
                     $this->typecast($input->getArgument($attribute->name ?? $property->getName()), $property)
@@ -63,13 +66,16 @@  discard block
 block discarded – undo
63 66
             }
64 67
         }
65 68
 
66
-        foreach ($reflection->getProperties() as $property) {
69
+        foreach ($reflection->getProperties() as $property)
70
+        {
67 71
             $attribute = $this->reader->firstPropertyMetadata($property, Option::class);
68
-            if ($attribute === null) {
72
+            if ($attribute === null)
73
+            {
69 74
                 continue;
70 75
             }
71 76
 
72
-            if ($input->hasOption($attribute->name ?? $property->getName())) {
77
+            if ($input->hasOption($attribute->name ?? $property->getName()))
78
+            {
73 79
                 $property->setValue(
74 80
                     $command,
75 81
                     $this->typecast($input->getOption($attribute->name ?? $property->getName()), $property)
@@ -82,9 +88,11 @@  discard block
 block discarded – undo
82 88
     {
83 89
         $result = [];
84 90
         $arrayArgument = null;
85
-        foreach ($reflection->getProperties() as $property) {
91
+        foreach ($reflection->getProperties() as $property)
92
+        {
86 93
             $attribute = $this->reader->firstPropertyMetadata($property, Argument::class);
87
-            if ($attribute === null) {
94
+            if ($attribute === null)
95
+            {
88 96
                 continue;
89 97
             }
90 98
 
@@ -107,19 +115,22 @@  discard block
 block discarded – undo
107 115
                 suggestedValues: $attribute->suggestedValues
108 116
             );
109 117
 
110
-            if ($arrayArgument !== null && $isArray) {
118
+            if ($arrayArgument !== null && $isArray)
119
+            {
111 120
                 throw new ConfiguratorException('There must be only one array argument!');
112 121
             }
113 122
 
114 123
             // It must be used at the end of the argument list.
115
-            if ($isArray) {
124
+            if ($isArray)
125
+            {
116 126
                 $arrayArgument = $argument;
117 127
                 continue;
118 128
             }
119 129
             $result[] = $argument;
120 130
         }
121 131
 
122
-        if ($arrayArgument !== null) {
132
+        if ($arrayArgument !== null)
133
+        {
123 134
             $result[] = $arrayArgument;
124 135
         }
125 136
 
@@ -129,16 +140,20 @@  discard block
 block discarded – undo
129 140
     private function parseOptions(\ReflectionClass $reflection): array
130 141
     {
131 142
         $result = [];
132
-        foreach ($reflection->getProperties() as $property) {
143
+        foreach ($reflection->getProperties() as $property)
144
+        {
133 145
             $attribute = $this->reader->firstPropertyMetadata($property, Option::class);
134
-            if ($attribute === null) {
146
+            if ($attribute === null)
147
+            {
135 148
                 continue;
136 149
             }
137 150
 
138 151
             $type = $this->getPropertyType($property);
139 152
 
140
-            if ($attribute->mode === InputOption::VALUE_NONE || $attribute->mode === InputOption::VALUE_NEGATABLE) {
141
-                if ($type->getName() !== 'bool') {
153
+            if ($attribute->mode === InputOption::VALUE_NONE || $attribute->mode === InputOption::VALUE_NEGATABLE)
154
+            {
155
+                if ($type->getName() !== 'bool')
156
+                {
142 157
                     throw new ConfiguratorException(
143 158
                         'Options properties with mode `VALUE_NONE` or `VALUE_NEGATABLE` must be bool!'
144 159
                     );
@@ -164,7 +179,8 @@  discard block
 block discarded – undo
164 179
     {
165 180
         $type = $property->hasType() ? $property->getType() : null;
166 181
 
167
-        if (!$type instanceof \ReflectionNamedType) {
182
+        if (!$type instanceof \ReflectionNamedType)
183
+        {
168 184
             return $value;
169 185
         }
170 186
 
@@ -180,7 +196,8 @@  discard block
 block discarded – undo
180 196
 
181 197
     private function getPropertyType(\ReflectionProperty $property): \ReflectionNamedType
182 198
     {
183
-        if (!$property->hasType()) {
199
+        if (!$property->hasType())
200
+        {
184 201
             throw new ConfiguratorException(
185 202
                 \sprintf('Please, specify the type for the `%s` property!', $property->getName())
186 203
             );
@@ -188,19 +205,24 @@  discard block
 block discarded – undo
188 205
 
189 206
         $type = $property->getType();
190 207
 
191
-        if ($type instanceof \ReflectionIntersectionType) {
208
+        if ($type instanceof \ReflectionIntersectionType)
209
+        {
192 210
             throw new ConfiguratorException(\sprintf('Invalid type for the `%s` property.', $property->getName()));
193 211
         }
194 212
 
195
-        if ($type instanceof \ReflectionUnionType) {
196
-            foreach ($type->getTypes() as $type) {
197
-                if ($type->isBuiltin()) {
213
+        if ($type instanceof \ReflectionUnionType)
214
+        {
215
+            foreach ($type->getTypes() as $type)
216
+            {
217
+                if ($type->isBuiltin())
218
+                {
198 219
                     return $type;
199 220
                 }
200 221
             }
201 222
         }
202 223
 
203
-        if ($type instanceof \ReflectionNamedType && $type->isBuiltin()) {
224
+        if ($type instanceof \ReflectionNamedType && $type->isBuiltin())
225
+        {
204 226
             return $type;
205 227
         }
206 228
 
Please login to merge, or discard this patch.
src/Console/src/Configurator/DefaultConfigurator.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@
 block discarded – undo
14 14
     public function configure(Command $command, \ReflectionClass $reflection): void
15 15
     {
16 16
         $command->setName($reflection->getConstant('NAME'));
17
-        $command->setDescription((string) $reflection->getConstant('DESCRIPTION'));
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
             \call_user_func_array([$command, 'addOption'], $option);
21 21
         }
22 22
 
23
-        foreach ($reflection->getMethod('defineArguments')->invoke($command) as $argument) {
23
+        foreach ($reflection->getMethod('defineArguments')->invoke($command) as $argument){
24 24
             \call_user_func_array([$command, 'addArgument'], $argument);
25 25
         }
26 26
     }
Please login to merge, or discard this 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.