Passed
Pull Request — master (#825)
by Maxim
16:52 queued 10s
created
src/Core/src/Internal/Resolver.php 2 patches
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     ): array {
50 50
         $state = new ResolvingState($reflection, $parameters);
51 51
 
52
-        foreach ($reflection->getParameters() as $parameter) {
52
+        foreach ($reflection->getParameters() as $parameter){
53 53
             $this->resolveParameter($parameter, $state, $validate)
54 54
             or
55 55
             throw new ArgumentResolvingException($reflection, $parameter->getName());
@@ -63,46 +63,46 @@  discard block
 block discarded – undo
63 63
         $positional = true;
64 64
         $variadic = false;
65 65
         $parameters = $reflection->getParameters();
66
-        if (\count($parameters) === 0) {
66
+        if (\count($parameters) === 0){
67 67
             return;
68 68
         }
69 69
 
70 70
         $parameter = null;
71
-        while (\count($parameters) > 0 || \count($arguments) > 0) {
71
+        while (\count($parameters) > 0 || \count($arguments) > 0){
72 72
             // get related argument value
73 73
             $key = \key($arguments);
74 74
 
75 75
             // For a variadic parameter it's no sense - named or positional argument will be sent
76 76
             // But you can't send positional argument after named in any case
77
-            if (\is_int($key) && !$positional) {
77
+            if (\is_int($key) && !$positional){
78 78
                 throw new PositionalArgumentException($reflection, $key);
79 79
             }
80 80
 
81 81
             $positional = $positional && \is_int($key);
82 82
 
83
-            if (!$variadic) {
83
+            if (!$variadic){
84 84
                 $parameter = \array_shift($parameters);
85 85
                 $variadic = $parameter?->isVariadic() ?? false;
86 86
             }
87 87
 
88
-            if ($parameter === null) {
88
+            if ($parameter === null){
89 89
                 throw new UnknownParameterException($reflection, $key);
90 90
             }
91 91
             $name = $parameter->getName();
92 92
 
93
-            if (($positional || $variadic) && $key !== null) {
93
+            if (($positional || $variadic) && $key !== null){
94 94
                 $value = \array_shift($arguments);
95
-            } elseif ($key === null || !\array_key_exists($name, $arguments)) {
96
-                if ($parameter->isOptional()) {
95
+            } elseif ($key === null || !\array_key_exists($name, $arguments)){
96
+                if ($parameter->isOptional()){
97 97
                     continue;
98 98
                 }
99 99
                 throw new MissingRequiredArgumentException($reflection, $name);
100
-            } else {
100
+            }else{
101 101
                 $value = &$arguments[$name];
102 102
                 unset($arguments[$name]);
103 103
             }
104 104
 
105
-            if (!$this->validateValueToParameter($parameter, $value)) {
105
+            if (!$this->validateValueToParameter($parameter, $value)){
106 106
                 throw new InvalidArgumentException($reflection, $name);
107 107
             }
108 108
         }
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 
111 111
     private function validateValueToParameter(ReflectionParameter $parameter, mixed $value): bool
112 112
     {
113
-        if (!$parameter->hasType() || ($parameter->allowsNull() && $value === null)) {
113
+        if (!$parameter->hasType() || ($parameter->allowsNull() && $value === null)){
114 114
             return true;
115 115
         }
116 116
         $type = $parameter->getType();
@@ -121,17 +121,17 @@  discard block
 block discarded – undo
121 121
             $type instanceof ReflectionIntersectionType => [false, $type->getTypes()],
122 122
         };
123 123
 
124
-        foreach ($types as $t) {
124
+        foreach ($types as $t){
125 125
             \assert($t instanceof ReflectionNamedType);
126
-            if (!$this->validateValueNamedType($t, $value)) {
126
+            if (!$this->validateValueNamedType($t, $value)){
127 127
                 // If it is TypeIntersection
128
-                if ($or) {
128
+                if ($or){
129 129
                     continue;
130 130
                 }
131 131
                 return false;
132 132
             }
133 133
             // If it is not type intersection then we can skip that value after first successful check
134
-            if ($or) {
134
+            if ($or){
135 135
                 return true;
136 136
             }
137 137
         }
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
     {
147 147
         $name = $type->getName();
148 148
 
149
-        if ($type->isBuiltin()) {
149
+        if ($type->isBuiltin()){
150 150
             return match ($name) {
151 151
                 'mixed' => true,
152 152
                 'string' => \is_string($value),
@@ -179,13 +179,13 @@  discard block
 block discarded – undo
179 179
 
180 180
         // Try to resolve parameter by name
181 181
         $res = $state->resolveParameterByNameOrPosition($parameter, $isVariadic);
182
-        if ($res !== [] || $isVariadic) {
182
+        if ($res !== [] || $isVariadic){
183 183
             // validate
184
-            if ($isVariadic) {
185
-                foreach ($res as $k => &$v) {
186
-                    $this->processArgument($state, $v, validateWith: $validate ? $parameter : null, key: $k);
184
+            if ($isVariadic){
185
+                foreach ($res as $k => &$v){
186
+                    $this->processArgument($state, $v, validateWith: $validate ? $parameter : null, key : $k);
187 187
                 }
188
-            } else {
188
+            }else{
189 189
                 $this->processArgument($state, $res[0], validateWith: $validate ? $parameter : null);
190 190
             }
191 191
 
@@ -193,39 +193,39 @@  discard block
 block discarded – undo
193 193
         }
194 194
 
195 195
         $error = null;
196
-        if ($hasType) {
196
+        if ($hasType){
197 197
             /** @var ReflectionIntersectionType|ReflectionUnionType|ReflectionNamedType $reflectionType */
198 198
             $reflectionType = $parameter->getType();
199 199
 
200
-            if ($reflectionType instanceof ReflectionIntersectionType) {
200
+            if ($reflectionType instanceof ReflectionIntersectionType){
201 201
                 throw new UnsupportedTypeException($parameter->getDeclaringFunction(), $parameter->getName());
202 202
             }
203 203
 
204 204
             $types = $reflectionType instanceof ReflectionNamedType ? [$reflectionType] : $reflectionType->getTypes();
205
-            foreach ($types as $namedType) {
206
-                try {
207
-                    if ($this->resolveNamedType($state, $parameter, $namedType, $validate)) {
205
+            foreach ($types as $namedType){
206
+                try{
207
+                    if ($this->resolveNamedType($state, $parameter, $namedType, $validate)){
208 208
                         return true;
209 209
                     }
210
-                } catch (Throwable $e) {
210
+                }catch (Throwable $e){
211 211
                     $error = $e;
212 212
                 }
213 213
             }
214 214
         }
215 215
 
216
-        if ($parameter->isDefaultValueAvailable()) {
216
+        if ($parameter->isDefaultValueAvailable()){
217 217
             $argument = $parameter->getDefaultValue();
218 218
             $this->processArgument($state, $argument);
219 219
             return true;
220 220
         }
221 221
 
222
-        if ($hasType && $parameter->allowsNull()) {
222
+        if ($hasType && $parameter->allowsNull()){
223 223
             $argument = null;
224 224
             $this->processArgument($state, $argument);
225 225
             return true;
226 226
         }
227 227
 
228
-        if ($error === null) {
228
+        if ($error === null){
229 229
             return false;
230 230
         }
231 231
 
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
         ReflectionParameter $parameter,
247 247
         ReflectionNamedType $typeRef,
248 248
         bool $validate
249
-    ) {
249
+    ){
250 250
         return !$typeRef->isBuiltin() && $this->resolveObjectParameter(
251 251
             $state,
252 252
             $typeRef->getName(),
@@ -289,15 +289,15 @@  discard block
 block discarded – undo
289 289
         ResolvingState $state,
290 290
         mixed &$value,
291 291
         ReflectionParameter $validateWith = null,
292
-        int|string $key = null
292
+        int | string $key = null
293 293
     ): void {
294 294
         // Resolve Autowire objects
295
-        if ($value instanceof Autowire) {
295
+        if ($value instanceof Autowire){
296 296
             $value = $value->resolve($this->factory);
297 297
         }
298 298
 
299 299
         // Validation
300
-        if ($validateWith !== null && !$this->validateValueToParameter($validateWith, $value)) {
300
+        if ($validateWith !== null && !$this->validateValueToParameter($validateWith, $value)){
301 301
             throw new InvalidArgumentException(
302 302
                 $validateWith->getDeclaringFunction(),
303 303
                 $validateWith->getName()
Please login to merge, or discard this patch.
Braces   +68 added lines, -32 removed lines patch added patch discarded remove patch
@@ -49,7 +49,8 @@  discard block
 block discarded – undo
49 49
     ): array {
50 50
         $state = new ResolvingState($reflection, $parameters);
51 51
 
52
-        foreach ($reflection->getParameters() as $parameter) {
52
+        foreach ($reflection->getParameters() as $parameter)
53
+        {
53 54
             $this->resolveParameter($parameter, $state, $validate)
54 55
             or
55 56
             throw new ArgumentResolvingException($reflection, $parameter->getName());
@@ -63,46 +64,58 @@  discard block
 block discarded – undo
63 64
         $positional = true;
64 65
         $variadic = false;
65 66
         $parameters = $reflection->getParameters();
66
-        if (\count($parameters) === 0) {
67
+        if (\count($parameters) === 0)
68
+        {
67 69
             return;
68 70
         }
69 71
 
70 72
         $parameter = null;
71
-        while (\count($parameters) > 0 || \count($arguments) > 0) {
73
+        while (\count($parameters) > 0 || \count($arguments) > 0)
74
+        {
72 75
             // get related argument value
73 76
             $key = \key($arguments);
74 77
 
75 78
             // For a variadic parameter it's no sense - named or positional argument will be sent
76 79
             // But you can't send positional argument after named in any case
77
-            if (\is_int($key) && !$positional) {
80
+            if (\is_int($key) && !$positional)
81
+            {
78 82
                 throw new PositionalArgumentException($reflection, $key);
79 83
             }
80 84
 
81 85
             $positional = $positional && \is_int($key);
82 86
 
83
-            if (!$variadic) {
87
+            if (!$variadic)
88
+            {
84 89
                 $parameter = \array_shift($parameters);
85 90
                 $variadic = $parameter?->isVariadic() ?? false;
86 91
             }
87 92
 
88
-            if ($parameter === null) {
93
+            if ($parameter === null)
94
+            {
89 95
                 throw new UnknownParameterException($reflection, $key);
90 96
             }
91 97
             $name = $parameter->getName();
92 98
 
93
-            if (($positional || $variadic) && $key !== null) {
99
+            if (($positional || $variadic) && $key !== null)
100
+            {
94 101
                 $value = \array_shift($arguments);
95
-            } elseif ($key === null || !\array_key_exists($name, $arguments)) {
96
-                if ($parameter->isOptional()) {
102
+            }
103
+            elseif ($key === null || !\array_key_exists($name, $arguments))
104
+            {
105
+                if ($parameter->isOptional())
106
+                {
97 107
                     continue;
98 108
                 }
99 109
                 throw new MissingRequiredArgumentException($reflection, $name);
100
-            } else {
110
+            }
111
+            else
112
+            {
101 113
                 $value = &$arguments[$name];
102 114
                 unset($arguments[$name]);
103 115
             }
104 116
 
105
-            if (!$this->validateValueToParameter($parameter, $value)) {
117
+            if (!$this->validateValueToParameter($parameter, $value))
118
+            {
106 119
                 throw new InvalidArgumentException($reflection, $name);
107 120
             }
108 121
         }
@@ -110,7 +123,8 @@  discard block
 block discarded – undo
110 123
 
111 124
     private function validateValueToParameter(ReflectionParameter $parameter, mixed $value): bool
112 125
     {
113
-        if (!$parameter->hasType() || ($parameter->allowsNull() && $value === null)) {
126
+        if (!$parameter->hasType() || ($parameter->allowsNull() && $value === null))
127
+        {
114 128
             return true;
115 129
         }
116 130
         $type = $parameter->getType();
@@ -121,17 +135,21 @@  discard block
 block discarded – undo
121 135
             $type instanceof ReflectionIntersectionType => [false, $type->getTypes()],
122 136
         };
123 137
 
124
-        foreach ($types as $t) {
138
+        foreach ($types as $t)
139
+        {
125 140
             \assert($t instanceof ReflectionNamedType);
126
-            if (!$this->validateValueNamedType($t, $value)) {
141
+            if (!$this->validateValueNamedType($t, $value))
142
+            {
127 143
                 // If it is TypeIntersection
128
-                if ($or) {
144
+                if ($or)
145
+                {
129 146
                     continue;
130 147
                 }
131 148
                 return false;
132 149
             }
133 150
             // If it is not type intersection then we can skip that value after first successful check
134
-            if ($or) {
151
+            if ($or)
152
+            {
135 153
                 return true;
136 154
             }
137 155
         }
@@ -146,7 +164,8 @@  discard block
 block discarded – undo
146 164
     {
147 165
         $name = $type->getName();
148 166
 
149
-        if ($type->isBuiltin()) {
167
+        if ($type->isBuiltin())
168
+        {
150 169
             return match ($name) {
151 170
                 'mixed' => true,
152 171
                 'string' => \is_string($value),
@@ -179,13 +198,18 @@  discard block
 block discarded – undo
179 198
 
180 199
         // Try to resolve parameter by name
181 200
         $res = $state->resolveParameterByNameOrPosition($parameter, $isVariadic);
182
-        if ($res !== [] || $isVariadic) {
201
+        if ($res !== [] || $isVariadic)
202
+        {
183 203
             // validate
184
-            if ($isVariadic) {
185
-                foreach ($res as $k => &$v) {
204
+            if ($isVariadic)
205
+            {
206
+                foreach ($res as $k => &$v)
207
+                {
186 208
                     $this->processArgument($state, $v, validateWith: $validate ? $parameter : null, key: $k);
187 209
                 }
188
-            } else {
210
+            }
211
+            else
212
+            {
189 213
                 $this->processArgument($state, $res[0], validateWith: $validate ? $parameter : null);
190 214
             }
191 215
 
@@ -193,39 +217,49 @@  discard block
 block discarded – undo
193 217
         }
194 218
 
195 219
         $error = null;
196
-        if ($hasType) {
220
+        if ($hasType)
221
+        {
197 222
             /** @var ReflectionIntersectionType|ReflectionUnionType|ReflectionNamedType $reflectionType */
198 223
             $reflectionType = $parameter->getType();
199 224
 
200
-            if ($reflectionType instanceof ReflectionIntersectionType) {
225
+            if ($reflectionType instanceof ReflectionIntersectionType)
226
+            {
201 227
                 throw new UnsupportedTypeException($parameter->getDeclaringFunction(), $parameter->getName());
202 228
             }
203 229
 
204 230
             $types = $reflectionType instanceof ReflectionNamedType ? [$reflectionType] : $reflectionType->getTypes();
205
-            foreach ($types as $namedType) {
206
-                try {
207
-                    if ($this->resolveNamedType($state, $parameter, $namedType, $validate)) {
231
+            foreach ($types as $namedType)
232
+            {
233
+                try
234
+                {
235
+                    if ($this->resolveNamedType($state, $parameter, $namedType, $validate))
236
+                    {
208 237
                         return true;
209 238
                     }
210
-                } catch (Throwable $e) {
239
+                }
240
+                catch (Throwable $e)
241
+                {
211 242
                     $error = $e;
212 243
                 }
213 244
             }
214 245
         }
215 246
 
216
-        if ($parameter->isDefaultValueAvailable()) {
247
+        if ($parameter->isDefaultValueAvailable())
248
+        {
217 249
             $argument = $parameter->getDefaultValue();
218 250
             $this->processArgument($state, $argument);
219 251
             return true;
220 252
         }
221 253
 
222
-        if ($hasType && $parameter->allowsNull()) {
254
+        if ($hasType && $parameter->allowsNull())
255
+        {
223 256
             $argument = null;
224 257
             $this->processArgument($state, $argument);
225 258
             return true;
226 259
         }
227 260
 
228
-        if ($error === null) {
261
+        if ($error === null)
262
+        {
229 263
             return false;
230 264
         }
231 265
 
@@ -292,12 +326,14 @@  discard block
 block discarded – undo
292 326
         int|string $key = null
293 327
     ): void {
294 328
         // Resolve Autowire objects
295
-        if ($value instanceof Autowire) {
329
+        if ($value instanceof Autowire)
330
+        {
296 331
             $value = $value->resolve($this->factory);
297 332
         }
298 333
 
299 334
         // Validation
300
-        if ($validateWith !== null && !$this->validateValueToParameter($validateWith, $value)) {
335
+        if ($validateWith !== null && !$this->validateValueToParameter($validateWith, $value))
336
+        {
301 337
             throw new InvalidArgumentException(
302 338
                 $validateWith->getDeclaringFunction(),
303 339
                 $validateWith->getName()
Please login to merge, or discard this patch.
src/Core/src/Container/Autowire.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
     public function __construct(
27 27
         private readonly string $alias,
28 28
         private readonly array $parameters = []
29
-    ) {
29
+    ){
30 30
     }
31 31
 
32 32
     public static function __set_state(array $anArray): static
@@ -41,22 +41,22 @@  discard block
 block discarded – undo
41 41
      */
42 42
     public static function wire(mixed $definition): Autowire
43 43
     {
44
-        if ($definition instanceof self) {
44
+        if ($definition instanceof self){
45 45
             return $definition;
46 46
         }
47 47
 
48
-        if (\is_string($definition)) {
48
+        if (\is_string($definition)){
49 49
             return new self($definition);
50 50
         }
51 51
 
52
-        if (\is_array($definition) && isset($definition['class'])) {
52
+        if (\is_array($definition) && isset($definition['class'])){
53 53
             return new self(
54 54
                 $definition['class'],
55 55
                 $definition['options'] ?? $definition['params'] ?? []
56 56
             );
57 57
         }
58 58
 
59
-        if (\is_object($definition)) {
59
+        if (\is_object($definition)){
60 60
             $autowire = new self($definition::class, []);
61 61
             $autowire->target = $definition;
62 62
             return $autowire;
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -41,22 +41,26 @@
 block discarded – undo
41 41
      */
42 42
     public static function wire(mixed $definition): Autowire
43 43
     {
44
-        if ($definition instanceof self) {
44
+        if ($definition instanceof self)
45
+        {
45 46
             return $definition;
46 47
         }
47 48
 
48
-        if (\is_string($definition)) {
49
+        if (\is_string($definition))
50
+        {
49 51
             return new self($definition);
50 52
         }
51 53
 
52
-        if (\is_array($definition) && isset($definition['class'])) {
54
+        if (\is_array($definition) && isset($definition['class']))
55
+        {
53 56
             return new self(
54 57
                 $definition['class'],
55 58
                 $definition['options'] ?? $definition['params'] ?? []
56 59
             );
57 60
         }
58 61
 
59
-        if (\is_object($definition)) {
62
+        if (\is_object($definition))
63
+        {
60 64
             $autowire = new self($definition::class, []);
61 65
             $autowire->target = $definition;
62 66
             return $autowire;
Please login to merge, or discard this patch.
src/Core/src/Exception/Container/ArgumentException.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,10 +16,10 @@
 block discarded – undo
16 16
     public function __construct(
17 17
         protected \ReflectionParameter $parameter,
18 18
         protected \ReflectionFunctionAbstract $context
19
-    ) {
19
+    ){
20 20
         $name = $context->getName();
21
-        if ($context instanceof \ReflectionMethod) {
22
-            $name = $context->class . '::' . $name;
21
+        if ($context instanceof \ReflectionMethod){
22
+            $name = $context->class.'::'.$name;
23 23
         }
24 24
 
25 25
         parent::__construct(\sprintf("Unable to resolve '%s' argument in '%s'", $parameter->name, $name));
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,8 @@
 block discarded – undo
18 18
         protected \ReflectionFunctionAbstract $context
19 19
     ) {
20 20
         $name = $context->getName();
21
-        if ($context instanceof \ReflectionMethod) {
21
+        if ($context instanceof \ReflectionMethod)
22
+        {
22 23
             $name = $context->class . '::' . $name;
23 24
         }
24 25
 
Please login to merge, or discard this patch.
src/Core/src/Exception/Resolver/UnknownParameterException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
     public function __construct(
14 14
         \ReflectionFunctionAbstract $reflection,
15 15
         private readonly string $parameter
16
-    ) {
16
+    ){
17 17
         $pattern = "Unknown named parameter `{$parameter}` `%s` %s.";
18 18
         parent::__construct($this->renderFunctionAndParameter($reflection, $pattern));
19 19
     }
Please login to merge, or discard this patch.
src/Core/src/Exception/Resolver/ArgumentResolvingException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
     public function __construct(
14 14
         \ReflectionFunctionAbstract $reflection,
15 15
         private readonly string $parameter
16
-    ) {
16
+    ){
17 17
         $pattern = "Unable to resolve required argument `{$parameter}` when resolving `%s` %s.";
18 18
         parent::__construct($this->renderFunctionAndParameter($reflection, $pattern));
19 19
     }
Please login to merge, or discard this patch.
src/Core/src/Exception/Resolver/PositionalArgumentException.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,13 +13,13 @@
 block discarded – undo
13 13
     public function __construct(
14 14
         \ReflectionFunctionAbstract $reflection,
15 15
         private readonly int $position
16
-    ) {
16
+    ){
17 17
         $pattern = 'Cannot use positional argument after named argument `%s` %s.';
18 18
         parent::__construct($this->renderFunctionAndParameter($reflection, $pattern));
19 19
     }
20 20
 
21 21
     public function getParameter(): string
22 22
     {
23
-        return '#' . $this->position;
23
+        return '#'.$this->position;
24 24
     }
25 25
 }
Please login to merge, or discard this patch.
src/Core/src/Exception/Resolver/WrongTypeException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
     {
13 13
         $message = 'An argument resolved with wrong type: ';
14 14
         parent::__construct(
15
-            $message . $error->getMessage(),
15
+            $message.$error->getMessage(),
16 16
             $error->getCode(),
17 17
             $error
18 18
         );
Please login to merge, or discard this patch.
src/Core/src/Exception/Resolver/MissingRequiredArgumentException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
     public function __construct(
14 14
         \ReflectionFunctionAbstract $reflection,
15 15
         private readonly string $parameter
16
-    ) {
16
+    ){
17 17
         $pattern = "Missing required argument for the `{$parameter}` parameter for `%s` %s.";
18 18
         parent::__construct($this->renderFunctionAndParameter($reflection, $pattern));
19 19
     }
Please login to merge, or discard this patch.
src/Core/src/Exception/Traits/ClosureRendererTrait.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
         $line = $reflection->getStartLine();
32 32
 
33 33
         $fileAndLine = '';
34
-        if (!empty($fileName)) {
34
+        if (!empty($fileName)){
35 35
             $fileAndLine = "in \"$fileName\" at line $line";
36 36
         }
37 37
 
@@ -42,23 +42,23 @@  discard block
 block discarded – undo
42 42
     {
43 43
         $closureParameters = [];
44 44
 
45
-        foreach ($reflection->getParameters() as $parameter) {
45
+        foreach ($reflection->getParameters() as $parameter){
46 46
             /** @var ReflectionNamedType|ReflectionUnionType|null $type */
47 47
             $type = $parameter->getType();
48 48
             $parameterString = \sprintf(
49 49
                 '%s %s%s$%s',
50 50
                 // type
51
-                (string) $type,
51
+                (string)$type,
52 52
                 // reference
53 53
                 $parameter->isPassedByReference() ? '&' : '',
54 54
                 // variadic
55 55
                 $parameter->isVariadic() ? '...' : '',
56 56
                 $parameter->getName(),
57 57
             );
58
-            if ($parameter->isDefaultValueAvailable()) {
58
+            if ($parameter->isDefaultValueAvailable()){
59 59
                 $default = $parameter->getDefaultValue();
60
-                $parameterString .= ' = ' . match (true) {
61
-                    \is_object($default) => 'new ' . $default::class . '(...)',
60
+                $parameterString .= ' = '.match (true) {
61
+                    \is_object($default) => 'new '.$default::class.'(...)',
62 62
                     $parameter->isDefaultValueConstant() => $parameter->getDefaultValueConstantName(),
63 63
                     default => \var_export($default, true),
64 64
                 };
@@ -66,6 +66,6 @@  discard block
 block discarded – undo
66 66
             $closureParameters[] = \ltrim($parameterString);
67 67
         }
68 68
         $static = $reflection->isStatic() ? 'static ' : '';
69
-        return "{$static}function (" . \implode(', ', $closureParameters) . ')';
69
+        return "{$static}function (".\implode(', ', $closureParameters).')';
70 70
     }
71 71
 }
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -31,7 +31,8 @@  discard block
 block discarded – undo
31 31
         $line = $reflection->getStartLine();
32 32
 
33 33
         $fileAndLine = '';
34
-        if (!empty($fileName)) {
34
+        if (!empty($fileName))
35
+        {
35 36
             $fileAndLine = "in \"$fileName\" at line $line";
36 37
         }
37 38
 
@@ -42,7 +43,8 @@  discard block
 block discarded – undo
42 43
     {
43 44
         $closureParameters = [];
44 45
 
45
-        foreach ($reflection->getParameters() as $parameter) {
46
+        foreach ($reflection->getParameters() as $parameter)
47
+        {
46 48
             /** @var ReflectionNamedType|ReflectionUnionType|null $type */
47 49
             $type = $parameter->getType();
48 50
             $parameterString = \sprintf(
@@ -55,7 +57,8 @@  discard block
 block discarded – undo
55 57
                 $parameter->isVariadic() ? '...' : '',
56 58
                 $parameter->getName(),
57 59
             );
58
-            if ($parameter->isDefaultValueAvailable()) {
60
+            if ($parameter->isDefaultValueAvailable())
61
+            {
59 62
                 $default = $parameter->getDefaultValue();
60 63
                 $parameterString .= ' = ' . match (true) {
61 64
                     \is_object($default) => 'new ' . $default::class . '(...)',
Please login to merge, or discard this patch.