Passed
Push — master ( c81bf2...c3afe7 )
by Aleksei
09:08 queued 01:17
created
src/Pagination/tests/LimitsTraitTest.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,8 @@
 block discarded – undo
21 21
 
22 22
     protected function setUp(): void
23 23
     {
24
-        $this->trait = new class {
24
+        $this->trait = new class
25
+        {
25 26
             use LimitsTrait;
26 27
         };
27 28
     }
Please login to merge, or discard this patch.
src/Scaffolder/tests/BaseTestCase.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
     protected function setUp(): void
22 22
     {
23 23
         $this->app = TestApp::create([
24
-            'root' => __DIR__ . '/App',
24
+            'root' => __DIR__.'/App',
25 25
         ], false)->run();
26 26
     }
27 27
 }
Please login to merge, or discard this patch.
src/Security/tests/Traits/GuardedTraitTest.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,8 @@
 block discarded – undo
28 28
 
29 29
     protected function setUp(): void
30 30
     {
31
-        $this->trait = new class {
31
+        $this->trait = new class
32
+        {
32 33
             use GuardedTrait;
33 34
         };
34 35
         $this->guard = $this->createMock(GuardInterface::class);
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@
 block discarded – undo
76 76
         self::assertSame(static::OPERATION, $guarded->resolvePermission(static::OPERATION));
77 77
 
78 78
         $guarded = new GuardedWithNamespace();
79
-        $resolvedPermission = GuardedWithNamespace::GUARD_NAMESPACE . '.' . static::OPERATION;
79
+        $resolvedPermission = GuardedWithNamespace::GUARD_NAMESPACE.'.'.static::OPERATION;
80 80
         self::assertSame($resolvedPermission, $guarded->resolvePermission(static::OPERATION));
81 81
     }
82 82
 
Please login to merge, or discard this patch.
src/Prototype/tests/Commands/AbstractCommandsTestCase.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 
30 30
     protected function setUp(): void
31 31
     {
32
-        if (!\class_exists(Kernel::class)) {
32
+        if (!\class_exists(Kernel::class)){
33 33
             $this->markTestSkipped('A "spiral/framework" dependency is required to run these tests');
34 34
         }
35 35
 
@@ -40,16 +40,16 @@  discard block
 block discarded – undo
40 40
             'cache'  => sys_get_temp_dir()
41 41
         ], false)->run();
42 42
 
43
-        $this->storage = new Storage($this->dir() . '/Fixtures/');
43
+        $this->storage = new Storage($this->dir().'/Fixtures/');
44 44
 
45
-        foreach (static::STORE as $name) {
45
+        foreach (static::STORE as $name){
46 46
             $this->storage->store($name);
47 47
         }
48 48
     }
49 49
 
50 50
     protected function tearDown(): void
51 51
     {
52
-        foreach (static::STORE as $name) {
52
+        foreach (static::STORE as $name){
53 53
             $this->storage->restore($name);
54 54
         }
55 55
     }
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,7 +29,8 @@  discard block
 block discarded – undo
29 29
 
30 30
     protected function setUp(): void
31 31
     {
32
-        if (!\class_exists(Kernel::class)) {
32
+        if (!\class_exists(Kernel::class))
33
+        {
33 34
             $this->markTestSkipped('A "spiral/framework" dependency is required to run these tests');
34 35
         }
35 36
 
@@ -42,14 +43,16 @@  discard block
 block discarded – undo
42 43
 
43 44
         $this->storage = new Storage($this->dir() . '/Fixtures/');
44 45
 
45
-        foreach (static::STORE as $name) {
46
+        foreach (static::STORE as $name)
47
+        {
46 48
             $this->storage->store($name);
47 49
         }
48 50
     }
49 51
 
50 52
     protected function tearDown(): void
51 53
     {
52
-        foreach (static::STORE as $name) {
54
+        foreach (static::STORE as $name)
55
+        {
53 56
             $this->storage->restore($name);
54 57
         }
55 58
     }
Please login to merge, or discard this patch.
src/Prototype/tests/InjectorTest.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,8 @@
 block discarded – undo
19 19
 {
20 20
     protected function setUp(): void
21 21
     {
22
-        if ((string)ini_get('zend.assertions') === 1) {
22
+        if ((string)ini_get('zend.assertions') === 1)
23
+        {
23 24
             ini_set('zend.assertions', 0);
24 25
         }
25 26
     }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 {
20 20
     protected function setUp(): void
21 21
     {
22
-        if ((string)ini_get('zend.assertions') === 1) {
22
+        if ((string)ini_get('zend.assertions') === 1){
23 23
             ini_set('zend.assertions', 0);
24 24
         }
25 25
     }
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     {
33 33
         $i = new Injector();
34 34
 
35
-        $filename = __DIR__ . '/Fixtures/TestClass.php';
35
+        $filename = __DIR__.'/Fixtures/TestClass.php';
36 36
         $printed = $i->injectDependencies(
37 37
             \file_get_contents($filename),
38 38
             $this->getDefinition($filename, ['testClass' => TestClass::class])
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     {
46 46
         $i = new Injector();
47 47
 
48
-        $filename = __DIR__ . '/Fixtures/WithPromotedProperty.php';
48
+        $filename = __DIR__.'/Fixtures/WithPromotedProperty.php';
49 49
         $printed = $i->injectDependencies(
50 50
             \file_get_contents($filename),
51 51
             $this->getDefinition($filename, ['two' => InjectionTwo::class])
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     {
63 63
         $i = new Injector();
64 64
 
65
-        $filename = __DIR__ . '/Fixtures/TestEmptyClass.php';
65
+        $filename = __DIR__.'/Fixtures/TestEmptyClass.php';
66 66
         $content = file_get_contents($filename);
67 67
         $printed = $i->injectDependencies(
68 68
             file_get_contents($filename),
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     {
81 81
         $i = new Injector();
82 82
 
83
-        $filename = __DIR__ . '/Fixtures/TestClass.php';
83
+        $filename = __DIR__.'/Fixtures/TestClass.php';
84 84
         $r = $i->injectDependencies(
85 85
             file_get_contents($filename),
86 86
             $this->getDefinition($filename, ['testClass' => TestClass::class])
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     {
106 106
         $i = new Injector();
107 107
 
108
-        $filename = __DIR__ . '/Fixtures/ChildClass.php';
108
+        $filename = __DIR__.'/Fixtures/ChildClass.php';
109 109
         $r = $i->injectDependencies(
110 110
             file_get_contents($filename),
111 111
             $this->getDefinition($filename, ['testClass' => TestClass::class])
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
     {
124 124
         $i = new Injector();
125 125
 
126
-        $filename = __DIR__ . '/Fixtures/ChildWithConstructorClass.php';
126
+        $filename = __DIR__.'/Fixtures/ChildWithConstructorClass.php';
127 127
         $r = $i->injectDependencies(
128 128
             file_get_contents($filename),
129 129
             $this->getDefinition($filename, ['testClass' => TestClass::class])
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
      */
140 140
     public function testModifyConstructor(): void
141 141
     {
142
-        $filename = __DIR__ . '/Fixtures/WithConstructor.php';
142
+        $filename = __DIR__.'/Fixtures/WithConstructor.php';
143 143
         $extractor = new Traverse\Extractor();
144 144
 
145 145
         $parameters = $extractor->extractFromFilename($filename);
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
      */
166 166
     public function testPriorOptionalConstructorParameters(): void
167 167
     {
168
-        $filename = __DIR__ . '/Fixtures/OptionalConstructorArgsClass.php';
168
+        $filename = __DIR__.'/Fixtures/OptionalConstructorArgsClass.php';
169 169
         $extractor = new Traverse\Extractor();
170 170
 
171 171
         $parameters = $extractor->extractFromFilename($filename);
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
     {
197 197
         $i = new Injector();
198 198
 
199
-        $filename = __DIR__ . '/ClassNode/ConflictResolver/Fixtures/ChildClass.php';
199
+        $filename = __DIR__.'/ClassNode/ConflictResolver/Fixtures/ChildClass.php';
200 200
         $printed = $i->injectDependencies(
201 201
             file_get_contents($filename),
202 202
             $this->getDefinition(
Please login to merge, or discard this patch.
src/Router/src/UriHandler.php 2 patches
Braces   +57 added lines, -27 removed lines patch added patch discarded remove patch
@@ -131,7 +131,8 @@  discard block
 block discarded – undo
131 131
      */
132 132
     public function withBasePath(string $basePath): self
133 133
     {
134
-        if (!\str_ends_with($basePath, '/')) {
134
+        if (!\str_ends_with($basePath, '/'))
135
+        {
135 136
             $basePath .= '/';
136 137
         }
137 138
 
@@ -181,12 +182,14 @@  discard block
 block discarded – undo
181 182
      */
182 183
     public function match(UriInterface $uri, array $defaults): ?array
183 184
     {
184
-        if (!$this->isCompiled()) {
185
+        if (!$this->isCompiled())
186
+        {
185 187
             $this->compile();
186 188
         }
187 189
 
188 190
         $matches = [];
189
-        if (!\preg_match($this->compiled, $this->fetchTarget($uri), $matches)) {
191
+        if (!\preg_match($this->compiled, $this->fetchTarget($uri), $matches))
192
+        {
190 193
             return null;
191 194
         }
192 195
 
@@ -203,7 +206,8 @@  discard block
 block discarded – undo
203 206
      */
204 207
     public function uri(iterable $parameters = [], array $defaults = []): UriInterface
205 208
     {
206
-        if (!$this->isCompiled()) {
209
+        if (!$this->isCompiled())
210
+        {
207 211
             $this->compile();
208 212
         }
209 213
 
@@ -214,19 +218,23 @@  discard block
 block discarded – undo
214 218
         );
215 219
 
216 220
         $required = \array_keys($this->constrains);
217
-        if ($this->strict) {
221
+        if ($this->strict)
222
+        {
218 223
             $required = \array_unique([...$this->requiredOptions, ...$required]);
219 224
         }
220 225
 
221 226
         $missingParameters = [];
222 227
 
223
-        foreach ($required as $key) {
224
-            if (empty($parameters[$key])) {
228
+        foreach ($required as $key)
229
+        {
230
+            if (empty($parameters[$key]))
231
+            {
225 232
                 $missingParameters[] = $key;
226 233
             }
227 234
         }
228 235
 
229
-        if ($missingParameters !== []) {
236
+        if ($missingParameters !== [])
237
+        {
230 238
             throw new UriHandlerException(
231 239
                 \sprintf(
232 240
                     \count($missingParameters) === 1
@@ -256,18 +264,23 @@  discard block
 block discarded – undo
256 264
         $allowed = \array_keys($this->options);
257 265
 
258 266
         $result = [];
259
-        foreach ($parameters as $key => $parameter) {
260
-            if (\is_int($key) && isset($allowed[$key])) {
267
+        foreach ($parameters as $key => $parameter)
268
+        {
269
+            if (\is_int($key) && isset($allowed[$key]))
270
+            {
261 271
                 // this segment fetched keys from given parameters either by name or by position
262 272
                 $key = $allowed[$key];
263
-            } elseif (!\array_key_exists($key, $this->options) && \is_array($parameters)) {
273
+            }
274
+            elseif (!\array_key_exists($key, $this->options) && \is_array($parameters))
275
+            {
264 276
                 // all additional parameters given in array form can be glued to query string
265 277
                 $query[$key] = $parameter;
266 278
                 continue;
267 279
             }
268 280
 
269 281
             // String must be normalized here
270
-            if (\is_string($parameter) && !\preg_match('/^[a-z\-_0-9]+$/i', $parameter)) {
282
+            if (\is_string($parameter) && !\preg_match('/^[a-z\-_0-9]+$/i', $parameter))
283
+            {
271 284
                 $result[$key] = ($this->pathSegmentEncoder)($parameter);
272 285
                 continue;
273 286
             }
@@ -285,7 +298,8 @@  discard block
 block discarded – undo
285 298
     {
286 299
         $path = $uri->getPath();
287 300
 
288
-        if (empty($path) || $path[0] !== '/') {
301
+        if (empty($path) || $path[0] !== '/')
302
+        {
289 303
             $path = '/' . $path;
290 304
         }
291 305
 
@@ -304,7 +318,8 @@  discard block
 block discarded – undo
304 318
      */
305 319
     private function compile(): void
306 320
     {
307
-        if ($this->pattern === null) {
321
+        if ($this->pattern === null)
322
+        {
308 323
             throw new UriHandlerException('Unable to compile UriHandler, pattern is not set');
309 324
         }
310 325
 
@@ -318,15 +333,18 @@  discard block
 block discarded – undo
318 333
         $pattern = \rtrim(\ltrim($pattern, ':/'), '/');
319 334
 
320 335
         // correct [/ first occurrence]
321
-        if (\str_starts_with($pattern, '[/')) {
336
+        if (\str_starts_with($pattern, '[/'))
337
+        {
322 338
             $pattern = '[' . \substr($pattern, 2);
323 339
         }
324 340
 
325 341
         // 2) Extract variables from the pattern
326
-        if (\preg_match_all('/<(\w+):?(.*?)?>/', $pattern, $matches)) {
342
+        if (\preg_match_all('/<(\w+):?(.*?)?>/', $pattern, $matches))
343
+        {
327 344
             $variables = \array_combine($matches[1], $matches[2]);
328 345
 
329
-            foreach ($variables as $key => $segment) {
346
+            foreach ($variables as $key => $segment)
347
+            {
330 348
                 $segment = $this->prepareSegment($key, $segment);
331 349
                 $replaces[\sprintf('<%s>', $key)] = \sprintf('(?P<%s>%s)', $key, $segment);
332 350
                 $options[] = $key;
@@ -338,14 +356,17 @@  discard block
 block discarded – undo
338 356
         $options = \array_fill_keys($options, null);
339 357
 
340 358
         // 3) Validate constraints
341
-        foreach ($this->constrains as $key => $value) {
342
-            if ($value instanceof Autofill) {
359
+        foreach ($this->constrains as $key => $value)
360
+        {
361
+            if ($value instanceof Autofill)
362
+            {
343 363
                 // only forces value replacement, not required to be presented as parameter
344 364
                 continue;
345 365
             }
346 366
 
347 367
             // If a constraint references a param that doesn't appear in the pattern or defaults
348
-            if (!\array_key_exists($key, $options) && !isset($this->defaults[$key])) {
368
+            if (!\array_key_exists($key, $options) && !isset($this->defaults[$key]))
369
+            {
349 370
                 throw new ConstrainException(
350 371
                     \sprintf(
351 372
                         'Route `%s` does not define routing parameter `<%s>`.',
@@ -362,7 +383,8 @@  discard block
 block discarded – undo
362 383
         $this->options = $options;
363 384
 
364 385
         // 5) Mark which parameters are required vs. optional
365
-        if ($this->strict) {
386
+        if ($this->strict)
387
+        {
366 388
             $this->requiredOptions = $this->findRequiredOptions($pattern, \array_keys($options));
367 389
         }
368 390
     }
@@ -384,21 +406,28 @@  discard block
 block discarded – undo
384 406
         $pos = 0;
385 407
         $length = \strlen($pattern);
386 408
 
387
-        while ($pos < $length) {
409
+        while ($pos < $length)
410
+        {
388 411
             $char = $pattern[$pos];
389 412
 
390
-            if ($char === '[') {
413
+            if ($char === '[')
414
+            {
391 415
                 // We enter an optional segment
392 416
                 ++$optLevel;
393
-            } elseif ($char === ']') {
417
+            }
418
+            elseif ($char === ']')
419
+            {
394 420
                 // We exit an optional segment
395 421
                 $optLevel = \max(0, $optLevel - 1);
396
-            } elseif ($char === '<') {
422
+            }
423
+            elseif ($char === '<')
424
+            {
397 425
                 // We see a parameter like <id> or <action:\d+>
398 426
 
399 427
                 // Find the closing '>'
400 428
                 $endPos = \strpos($pattern, '>', $pos);
401
-                if ($endPos === false) {
429
+                if ($endPos === false)
430
+                {
402 431
                     break;
403 432
                 }
404 433
 
@@ -432,7 +461,8 @@  discard block
 block discarded – undo
432 461
     private function interpolate(string $string, array $values): string
433 462
     {
434 463
         $replaces = [];
435
-        foreach ($values as $key => $value) {
464
+        foreach ($values as $key => $value)
465
+        {
436 466
             $replaces[\sprintf('<%s>', $key)] = match (true) {
437 467
                 $value instanceof \Stringable || \is_scalar($value) => (string) $value,
438 468
                 default => '',
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         private readonly UriFactoryInterface $uriFactory,
62 62
         ?SlugifyInterface $slugify = null,
63 63
         ?RoutePatternRegistryInterface $patternRegistry = null,
64
-    ) {
64
+    ){
65 65
         $this->patternRegistry = $patternRegistry ?? new DefaultPatternRegistry();
66 66
 
67 67
         $slugify ??= new Slugify();
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
      */
132 132
     public function withBasePath(string $basePath): self
133 133
     {
134
-        if (!\str_ends_with($basePath, '/')) {
134
+        if (!\str_ends_with($basePath, '/')){
135 135
             $basePath .= '/';
136 136
         }
137 137
 
@@ -181,12 +181,12 @@  discard block
 block discarded – undo
181 181
      */
182 182
     public function match(UriInterface $uri, array $defaults): ?array
183 183
     {
184
-        if (!$this->isCompiled()) {
184
+        if (!$this->isCompiled()){
185 185
             $this->compile();
186 186
         }
187 187
 
188 188
         $matches = [];
189
-        if (!\preg_match($this->compiled, $this->fetchTarget($uri), $matches)) {
189
+        if (!\preg_match($this->compiled, $this->fetchTarget($uri), $matches)){
190 190
             return null;
191 191
         }
192 192
 
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
      */
204 204
     public function uri(iterable $parameters = [], array $defaults = []): UriInterface
205 205
     {
206
-        if (!$this->isCompiled()) {
206
+        if (!$this->isCompiled()){
207 207
             $this->compile();
208 208
         }
209 209
 
@@ -214,19 +214,19 @@  discard block
 block discarded – undo
214 214
         );
215 215
 
216 216
         $required = \array_keys($this->constrains);
217
-        if ($this->strict) {
217
+        if ($this->strict){
218 218
             $required = \array_unique([...$this->requiredOptions, ...$required]);
219 219
         }
220 220
 
221 221
         $missingParameters = [];
222 222
 
223
-        foreach ($required as $key) {
224
-            if (empty($parameters[$key])) {
223
+        foreach ($required as $key){
224
+            if (empty($parameters[$key])){
225 225
                 $missingParameters[] = $key;
226 226
             }
227 227
         }
228 228
 
229
-        if ($missingParameters !== []) {
229
+        if ($missingParameters !== []){
230 230
             throw new UriHandlerException(
231 231
                 \sprintf(
232 232
                     \count($missingParameters) === 1
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
         $path = $this->interpolate($this->template, $parameters);
242 242
 
243 243
         //Uri with added base path and prefix
244
-        $uri = $this->uriFactory->createUri(($this->matchHost ? '' : $this->basePath) . \trim($path, '/'));
244
+        $uri = $this->uriFactory->createUri(($this->matchHost ? '' : $this->basePath).\trim($path, '/'));
245 245
 
246 246
         return empty($query) ? $uri : $uri->withQuery(\http_build_query($query));
247 247
     }
@@ -256,23 +256,23 @@  discard block
 block discarded – undo
256 256
         $allowed = \array_keys($this->options);
257 257
 
258 258
         $result = [];
259
-        foreach ($parameters as $key => $parameter) {
260
-            if (\is_int($key) && isset($allowed[$key])) {
259
+        foreach ($parameters as $key => $parameter){
260
+            if (\is_int($key) && isset($allowed[$key])){
261 261
                 // this segment fetched keys from given parameters either by name or by position
262 262
                 $key = $allowed[$key];
263
-            } elseif (!\array_key_exists($key, $this->options) && \is_array($parameters)) {
263
+            } elseif (!\array_key_exists($key, $this->options) && \is_array($parameters)){
264 264
                 // all additional parameters given in array form can be glued to query string
265 265
                 $query[$key] = $parameter;
266 266
                 continue;
267 267
             }
268 268
 
269 269
             // String must be normalized here
270
-            if (\is_string($parameter) && !\preg_match('/^[a-z\-_0-9]+$/i', $parameter)) {
270
+            if (\is_string($parameter) && !\preg_match('/^[a-z\-_0-9]+$/i', $parameter)){
271 271
                 $result[$key] = ($this->pathSegmentEncoder)($parameter);
272 272
                 continue;
273 273
             }
274 274
 
275
-            $result[$key] = (string) $parameter;
275
+            $result[$key] = (string)$parameter;
276 276
         }
277 277
 
278 278
         return $result;
@@ -285,12 +285,12 @@  discard block
 block discarded – undo
285 285
     {
286 286
         $path = $uri->getPath();
287 287
 
288
-        if (empty($path) || $path[0] !== '/') {
289
-            $path = '/' . $path;
288
+        if (empty($path) || $path[0] !== '/'){
289
+            $path = '/'.$path;
290 290
         }
291 291
 
292 292
         $uriString = $this->matchHost
293
-            ? $uri->getHost() . $path
293
+            ? $uri->getHost().$path
294 294
             : \substr($path, \strlen($this->basePath));
295 295
 
296 296
         return \trim($uriString, '/');
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
      */
305 305
     private function compile(): void
306 306
     {
307
-        if ($this->pattern === null) {
307
+        if ($this->pattern === null){
308 308
             throw new UriHandlerException('Unable to compile UriHandler, pattern is not set');
309 309
         }
310 310
 
@@ -314,19 +314,19 @@  discard block
 block discarded – undo
314 314
         // 1) Build full pattern
315 315
         $prefix = \rtrim($this->getPrefix(), '/ ');
316 316
         $pattern = \ltrim($this->pattern, '/ ');
317
-        $pattern = $prefix . '/' . $pattern;
317
+        $pattern = $prefix.'/'.$pattern;
318 318
         $pattern = \rtrim(\ltrim($pattern, ':/'), '/');
319 319
 
320 320
         // correct [/ first occurrence]
321
-        if (\str_starts_with($pattern, '[/')) {
322
-            $pattern = '[' . \substr($pattern, 2);
321
+        if (\str_starts_with($pattern, '[/')){
322
+            $pattern = '['.\substr($pattern, 2);
323 323
         }
324 324
 
325 325
         // 2) Extract variables from the pattern
326
-        if (\preg_match_all('/<(\w+):?(.*?)?>/', $pattern, $matches)) {
326
+        if (\preg_match_all('/<(\w+):?(.*?)?>/', $pattern, $matches)){
327 327
             $variables = \array_combine($matches[1], $matches[2]);
328 328
 
329
-            foreach ($variables as $key => $segment) {
329
+            foreach ($variables as $key => $segment){
330 330
                 $segment = $this->prepareSegment($key, $segment);
331 331
                 $replaces[\sprintf('<%s>', $key)] = \sprintf('(?P<%s>%s)', $key, $segment);
332 332
                 $options[] = $key;
@@ -338,14 +338,14 @@  discard block
 block discarded – undo
338 338
         $options = \array_fill_keys($options, null);
339 339
 
340 340
         // 3) Validate constraints
341
-        foreach ($this->constrains as $key => $value) {
342
-            if ($value instanceof Autofill) {
341
+        foreach ($this->constrains as $key => $value){
342
+            if ($value instanceof Autofill){
343 343
                 // only forces value replacement, not required to be presented as parameter
344 344
                 continue;
345 345
             }
346 346
 
347 347
             // If a constraint references a param that doesn't appear in the pattern or defaults
348
-            if (!\array_key_exists($key, $options) && !isset($this->defaults[$key])) {
348
+            if (!\array_key_exists($key, $options) && !isset($this->defaults[$key])){
349 349
                 throw new ConstrainException(
350 350
                     \sprintf(
351 351
                         'Route `%s` does not define routing parameter `<%s>`.',
@@ -357,12 +357,12 @@  discard block
 block discarded – undo
357 357
         }
358 358
 
359 359
         // 4) Compile your final regex pattern
360
-        $this->compiled = '/^' . \strtr($template, $replaces + self::PATTERN_REPLACES) . '$/iu';
360
+        $this->compiled = '/^'.\strtr($template, $replaces + self::PATTERN_REPLACES).'$/iu';
361 361
         $this->template = \stripslashes(\str_replace('?', '', $template));
362 362
         $this->options = $options;
363 363
 
364 364
         // 5) Mark which parameters are required vs. optional
365
-        if ($this->strict) {
365
+        if ($this->strict){
366 366
             $this->requiredOptions = $this->findRequiredOptions($pattern, \array_keys($options));
367 367
         }
368 368
     }
@@ -384,21 +384,21 @@  discard block
 block discarded – undo
384 384
         $pos = 0;
385 385
         $length = \strlen($pattern);
386 386
 
387
-        while ($pos < $length) {
387
+        while ($pos < $length){
388 388
             $char = $pattern[$pos];
389 389
 
390
-            if ($char === '[') {
390
+            if ($char === '['){
391 391
                 // We enter an optional segment
392 392
                 ++$optLevel;
393
-            } elseif ($char === ']') {
393
+            } elseif ($char === ']'){
394 394
                 // We exit an optional segment
395 395
                 $optLevel = \max(0, $optLevel - 1);
396
-            } elseif ($char === '<') {
396
+            } elseif ($char === '<'){
397 397
                 // We see a parameter like <id> or <action:\d+>
398 398
 
399 399
                 // Find the closing '>'
400 400
                 $endPos = \strpos($pattern, '>', $pos);
401
-                if ($endPos === false) {
401
+                if ($endPos === false){
402 402
                     break;
403 403
                 }
404 404
 
@@ -432,9 +432,9 @@  discard block
 block discarded – undo
432 432
     private function interpolate(string $string, array $values): string
433 433
     {
434 434
         $replaces = [];
435
-        foreach ($values as $key => $value) {
435
+        foreach ($values as $key => $value){
436 436
             $replaces[\sprintf('<%s>', $key)] = match (true) {
437
-                $value instanceof \Stringable || \is_scalar($value) => (string) $value,
437
+                $value instanceof \Stringable || \is_scalar($value) => (string)$value,
438 438
                 default => '',
439 439
             };
440 440
         }
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
                 '|',
459 459
                 \array_map(fn(string $segment): string => $this->filterSegment($segment), $this->constrains[$name]),
460 460
             ),
461
-            default => $this->filterSegment((string) $this->constrains[$name]),
461
+            default => $this->filterSegment((string)$this->constrains[$name]),
462 462
         };
463 463
     }
464 464
 
Please login to merge, or discard this patch.
src/Stempler/src/Lexer/Grammar/HTMLGrammar.php 2 patches
Braces   +79 added lines, -39 removed lines patch added patch discarded remove patch
@@ -47,15 +47,18 @@  discard block
 block discarded – undo
47 47
 
48 48
     public function parse(Buffer $src): \Generator
49 49
     {
50
-        while ($n = $src->next()) {
51
-            if (!$n instanceof Byte || $n->char !== '<') {
50
+        while ($n = $src->next())
51
+        {
52
+            if (!$n instanceof Byte || $n->char !== '<')
53
+            {
52 54
                 yield $n;
53 55
                 continue;
54 56
             }
55 57
 
56 58
             // work with isolated token stream!
57 59
             $tag = (clone $this)->parseGrammar($src);
58
-            if ($tag === null) {
60
+            if ($tag === null)
61
+            {
59 62
                 yield $n;
60 63
                 $src->replay($n->offset);
61 64
                 continue;
@@ -64,7 +67,8 @@  discard block
 block discarded – undo
64 67
             $tagName = $this->tagName($tag);
65 68
 
66 69
             // todo: add support for custom tag list
67
-            if (\in_array($tagName, self::VERBATIM_TAGS)) {
70
+            if (\in_array($tagName, self::VERBATIM_TAGS))
71
+            {
68 72
                 yield from $tag;
69 73
                 yield from $this->parseVerbatim($src, $tagName);
70 74
                 continue;
@@ -98,26 +102,32 @@  discard block
 block discarded – undo
98 102
     {
99 103
         $chunks = [];
100 104
 
101
-        while ($n = $src->next()) {
102
-            if ($n instanceof Token) {
105
+        while ($n = $src->next())
106
+        {
107
+            if ($n instanceof Token)
108
+            {
103 109
                 $chunks[] = $n;
104 110
                 continue;
105 111
             }
106 112
 
107
-            switch ($n->char) {
113
+            switch ($n->char)
114
+            {
108 115
                 case '"':
109 116
                 case "'":
110 117
                 case '`':
111 118
                     $chunks[] = $n;
112 119
 
113 120
                     // language inclusions allow nested strings
114
-                    while ($nc = $src->next()) {
121
+                    while ($nc = $src->next())
122
+                    {
115 123
                         $chunks[] = $nc;
116
-                        if ($nc instanceof Token) {
124
+                        if ($nc instanceof Token)
125
+                        {
117 126
                             continue;
118 127
                         }
119 128
 
120
-                        if ($nc->char === $n->char) {
129
+                        if ($nc->char === $n->char)
130
+                        {
121 131
                             break;
122 132
                         }
123 133
                     }
@@ -128,22 +138,28 @@  discard block
 block discarded – undo
128 138
                     $chunks[] = $n;
129 139
 
130 140
                     $multiline = false;
131
-                    if ($src->lookaheadByte(1) === '/' || $src->lookaheadByte(1) === '*') {
132
-                        if ($src->lookaheadByte(1) === '*') {
141
+                    if ($src->lookaheadByte(1) === '/' || $src->lookaheadByte(1) === '*')
142
+                    {
143
+                        if ($src->lookaheadByte(1) === '*')
144
+                        {
133 145
                             $multiline = true;
134 146
                         }
135 147
 
136 148
                         $chunks[] = $src->next();
137 149
 
138 150
                         // language inclusions allow nested strings
139
-                        while ($nc = $src->next()) {
140
-                            if ($nc instanceof Token) {
151
+                        while ($nc = $src->next())
152
+                        {
153
+                            if ($nc instanceof Token)
154
+                            {
141 155
                                 continue;
142 156
                             }
143 157
 
144
-                            if ($nc->char === '<') {
158
+                            if ($nc->char === '<')
159
+                            {
145 160
                                 $tag = (clone $this)->parseGrammar($src);
146
-                                if ($tag === null || $this->tagName($tag) !== $verbatim) {
161
+                                if ($tag === null || $this->tagName($tag) !== $verbatim)
162
+                                {
147 163
                                     $src->replay($n->offset);
148 164
                                     break;
149 165
                                 }
@@ -154,12 +170,16 @@  discard block
 block discarded – undo
154 170
 
155 171
                             $chunks[] = $nc;
156 172
 
157
-                            if ($multiline) {
158
-                                if ($nc->char === '*' && $src->lookaheadByte(1) === '/') {
173
+                            if ($multiline)
174
+                            {
175
+                                if ($nc->char === '*' && $src->lookaheadByte(1) === '/')
176
+                                {
159 177
                                     $chunks[] = $src->next();
160 178
                                     break;
161 179
                                 }
162
-                            } elseif ($nc->char === "\n") {
180
+                            }
181
+                            elseif ($nc->char === "\n")
182
+                            {
163 183
                                 break;
164 184
                             }
165 185
                         }
@@ -170,7 +190,8 @@  discard block
 block discarded – undo
170 190
                 case '<':
171 191
                     // tag beginning?
172 192
                     $tag = (clone $this)->parseGrammar($src);
173
-                    if ($tag === null || $this->tagName($tag) !== $verbatim) {
193
+                    if ($tag === null || $this->tagName($tag) !== $verbatim)
194
+                    {
174 195
                         $chunks[] = $n;
175 196
                         $src->replay($n->offset);
176 197
                         break;
@@ -190,8 +211,10 @@  discard block
 block discarded – undo
190 211
 
191 212
     private function tagName(array $tag): string
192 213
     {
193
-        foreach ($tag as $token) {
194
-            if ($token->type === self::TYPE_KEYWORD) {
214
+        foreach ($tag as $token)
215
+        {
216
+            if ($token->type === self::TYPE_KEYWORD)
217
+            {
195 218
                 return \strtolower((string) $token->content);
196 219
             }
197 220
         }
@@ -210,28 +233,34 @@  discard block
 block discarded – undo
210 233
             new Token(self::TYPE_OPEN, $src->getOffset(), '<'),
211 234
         ];
212 235
 
213
-        if ($src->lookaheadByte() === '/') {
236
+        if ($src->lookaheadByte() === '/')
237
+        {
214 238
             $this->tokens[0]->type = self::TYPE_OPEN_SHORT;
215 239
             $this->tokens[0]->content .= $src->next()->char;
216 240
         }
217 241
 
218
-        while ($n = $src->next()) {
219
-            if ($this->attribute !== []) {
242
+        while ($n = $src->next())
243
+        {
244
+            if ($this->attribute !== [])
245
+            {
220 246
                 $this->attribute[] = $n;
221 247
 
222
-                if ($n instanceof Byte && $n->char === $this->attribute[0]->char) {
248
+                if ($n instanceof Byte && $n->char === $this->attribute[0]->char)
249
+                {
223 250
                     $this->flushAttribute();
224 251
                 }
225 252
 
226 253
                 continue;
227 254
             }
228 255
 
229
-            if ($n instanceof Token) {
256
+            if ($n instanceof Token)
257
+            {
230 258
                 $this->keyword[] = $n;
231 259
                 continue;
232 260
             }
233 261
 
234
-            switch ($n->char) {
262
+            switch ($n->char)
263
+            {
235 264
                 case '"':
236 265
                 case "'":
237 266
                 case '`':
@@ -249,7 +278,8 @@  discard block
 block discarded – undo
249 278
                     break;
250 279
 
251 280
                 case '/':
252
-                    if ($src->lookaheadByte() === '>') {
281
+                    if ($src->lookaheadByte() === '>')
282
+                    {
253 283
                         $this->flush();
254 284
                         $this->tokens[] = new Token(
255 285
                             self::TYPE_CLOSE_SHORT,
@@ -273,7 +303,8 @@  discard block
 block discarded – undo
273 303
                     break 2;
274 304
 
275 305
                 default:
276
-                    if (\preg_match(self::REGEXP_WHITESPACE, $n->char)) {
306
+                    if (\preg_match(self::REGEXP_WHITESPACE, $n->char))
307
+                    {
277 308
                         $this->flushKeyword();
278 309
                         $this->whitespace[] = $n;
279 310
                         break;
@@ -281,7 +312,8 @@  discard block
 block discarded – undo
281 312
                     $this->flushWhitespace();
282 313
 
283 314
 
284
-                    if (!\preg_match(self::REGEXP_KEYWORD, $n->char)) {
315
+                    if (!\preg_match(self::REGEXP_KEYWORD, $n->char))
316
+                    {
285 317
                         // unexpected char
286 318
                         return null;
287 319
                     }
@@ -290,7 +322,8 @@  discard block
 block discarded – undo
290 322
             }
291 323
         }
292 324
 
293
-        if (!$this->isValid()) {
325
+        if (!$this->isValid())
326
+        {
294 327
             return null;
295 328
         }
296 329
 
@@ -300,17 +333,21 @@  discard block
 block discarded – undo
300 333
     private function isValid(): bool
301 334
     {
302 335
         // tag is too short or does not have name keyword
303
-        if (\count($this->tokens) < 3) {
336
+        if (\count($this->tokens) < 3)
337
+        {
304 338
             return false;
305 339
         }
306 340
 
307 341
         $last = $this->tokens[\count($this->tokens) - 1];
308
-        if ($last->type !== self::TYPE_CLOSE && $last->type !== self::TYPE_CLOSE_SHORT) {
342
+        if ($last->type !== self::TYPE_CLOSE && $last->type !== self::TYPE_CLOSE_SHORT)
343
+        {
309 344
             return false;
310 345
         }
311 346
 
312
-        foreach ($this->tokens as $token) {
313
-            switch ($token->type) {
347
+        foreach ($this->tokens as $token)
348
+        {
349
+            switch ($token->type)
350
+            {
314 351
                 case self::TYPE_WHITESPACE:
315 352
                     // ignore
316 353
                     continue 2;
@@ -341,7 +378,8 @@  discard block
 block discarded – undo
341 378
      */
342 379
     private function flushWhitespace(): void
343 380
     {
344
-        if ($this->whitespace === []) {
381
+        if ($this->whitespace === [])
382
+        {
345 383
             return;
346 384
         }
347 385
 
@@ -354,7 +392,8 @@  discard block
 block discarded – undo
354 392
      */
355 393
     private function flushKeyword(): void
356 394
     {
357
-        if ($this->keyword === []) {
395
+        if ($this->keyword === [])
396
+        {
358 397
             return;
359 398
         }
360 399
 
@@ -367,7 +406,8 @@  discard block
 block discarded – undo
367 406
      */
368 407
     private function flushAttribute(): void
369 408
     {
370
-        if ($this->attribute === []) {
409
+        if ($this->attribute === [])
410
+        {
371 411
             return;
372 412
         }
373 413
 
Please login to merge, or discard this patch.
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -69,15 +69,15 @@  discard block
 block discarded – undo
69 69
 
70 70
     public function parse(Buffer $src): \Generator
71 71
     {
72
-        while ($n = $src->next()) {
73
-            if (!$n instanceof Byte || $n->char !== '<') {
72
+        while ($n = $src->next()){
73
+            if (!$n instanceof Byte || $n->char !== '<'){
74 74
                 yield $n;
75 75
                 continue;
76 76
             }
77 77
 
78 78
             // work with isolated token stream!
79 79
             $tag = (clone $this)->parseGrammar($src);
80
-            if ($tag === null) {
80
+            if ($tag === null){
81 81
                 yield $n;
82 82
                 $src->replay($n->offset);
83 83
                 continue;
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
             $tagName = $this->tagName($tag);
87 87
 
88 88
             // todo: add support for custom tag list
89
-            if (\in_array($tagName, self::VERBATIM_TAGS)) {
89
+            if (\in_array($tagName, self::VERBATIM_TAGS)){
90 90
                 yield from $tag;
91 91
                 yield from $this->parseVerbatim($src, $tagName);
92 92
                 continue;
@@ -100,26 +100,26 @@  discard block
 block discarded – undo
100 100
     {
101 101
         $chunks = [];
102 102
 
103
-        while ($n = $src->next()) {
104
-            if ($n instanceof Token) {
103
+        while ($n = $src->next()){
104
+            if ($n instanceof Token){
105 105
                 $chunks[] = $n;
106 106
                 continue;
107 107
             }
108 108
 
109
-            switch ($n->char) {
109
+            switch ($n->char){
110 110
                 case '"':
111 111
                 case "'":
112 112
                 case '`':
113 113
                     $chunks[] = $n;
114 114
 
115 115
                     // language inclusions allow nested strings
116
-                    while ($nc = $src->next()) {
116
+                    while ($nc = $src->next()){
117 117
                         $chunks[] = $nc;
118
-                        if ($nc instanceof Token) {
118
+                        if ($nc instanceof Token){
119 119
                             continue;
120 120
                         }
121 121
 
122
-                        if ($nc->char === $n->char) {
122
+                        if ($nc->char === $n->char){
123 123
                             break;
124 124
                         }
125 125
                     }
@@ -130,22 +130,22 @@  discard block
 block discarded – undo
130 130
                     $chunks[] = $n;
131 131
 
132 132
                     $multiline = false;
133
-                    if ($src->lookaheadByte(1) === '/' || $src->lookaheadByte(1) === '*') {
134
-                        if ($src->lookaheadByte(1) === '*') {
133
+                    if ($src->lookaheadByte(1) === '/' || $src->lookaheadByte(1) === '*'){
134
+                        if ($src->lookaheadByte(1) === '*'){
135 135
                             $multiline = true;
136 136
                         }
137 137
 
138 138
                         $chunks[] = $src->next();
139 139
 
140 140
                         // language inclusions allow nested strings
141
-                        while ($nc = $src->next()) {
142
-                            if ($nc instanceof Token) {
141
+                        while ($nc = $src->next()){
142
+                            if ($nc instanceof Token){
143 143
                                 continue;
144 144
                             }
145 145
 
146
-                            if ($nc->char === '<') {
146
+                            if ($nc->char === '<'){
147 147
                                 $tag = (clone $this)->parseGrammar($src);
148
-                                if ($tag === null || $this->tagName($tag) !== $verbatim) {
148
+                                if ($tag === null || $this->tagName($tag) !== $verbatim){
149 149
                                     $src->replay($n->offset);
150 150
                                     break;
151 151
                                 }
@@ -156,12 +156,12 @@  discard block
 block discarded – undo
156 156
 
157 157
                             $chunks[] = $nc;
158 158
 
159
-                            if ($multiline) {
160
-                                if ($nc->char === '*' && $src->lookaheadByte(1) === '/') {
159
+                            if ($multiline){
160
+                                if ($nc->char === '*' && $src->lookaheadByte(1) === '/'){
161 161
                                     $chunks[] = $src->next();
162 162
                                     break;
163 163
                                 }
164
-                            } elseif ($nc->char === "\n") {
164
+                            } elseif ($nc->char === "\n"){
165 165
                                 break;
166 166
                             }
167 167
                         }
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
                 case '<':
173 173
                     // tag beginning?
174 174
                     $tag = (clone $this)->parseGrammar($src);
175
-                    if ($tag === null || $this->tagName($tag) !== $verbatim) {
175
+                    if ($tag === null || $this->tagName($tag) !== $verbatim){
176 176
                         $chunks[] = $n;
177 177
                         $src->replay($n->offset);
178 178
                         break;
@@ -192,9 +192,9 @@  discard block
 block discarded – undo
192 192
 
193 193
     private function tagName(array $tag): string
194 194
     {
195
-        foreach ($tag as $token) {
196
-            if ($token->type === self::TYPE_KEYWORD) {
197
-                return \strtolower((string) $token->content);
195
+        foreach ($tag as $token){
196
+            if ($token->type === self::TYPE_KEYWORD){
197
+                return \strtolower((string)$token->content);
198 198
             }
199 199
         }
200 200
 
@@ -212,28 +212,28 @@  discard block
 block discarded – undo
212 212
             new Token(self::TYPE_OPEN, $src->getOffset(), '<'),
213 213
         ];
214 214
 
215
-        if ($src->lookaheadByte() === '/') {
215
+        if ($src->lookaheadByte() === '/'){
216 216
             $this->tokens[0]->type = self::TYPE_OPEN_SHORT;
217 217
             $this->tokens[0]->content .= $src->next()->char;
218 218
         }
219 219
 
220
-        while ($n = $src->next()) {
221
-            if ($this->attribute !== []) {
220
+        while ($n = $src->next()){
221
+            if ($this->attribute !== []){
222 222
                 $this->attribute[] = $n;
223 223
 
224
-                if ($n instanceof Byte && $n->char === $this->attribute[0]->char) {
224
+                if ($n instanceof Byte && $n->char === $this->attribute[0]->char){
225 225
                     $this->flushAttribute();
226 226
                 }
227 227
 
228 228
                 continue;
229 229
             }
230 230
 
231
-            if ($n instanceof Token) {
231
+            if ($n instanceof Token){
232 232
                 $this->keyword[] = $n;
233 233
                 continue;
234 234
             }
235 235
 
236
-            switch ($n->char) {
236
+            switch ($n->char){
237 237
                 case '"':
238 238
                 case "'":
239 239
                 case '`':
@@ -251,12 +251,12 @@  discard block
 block discarded – undo
251 251
                     break;
252 252
 
253 253
                 case '/':
254
-                    if ($src->lookaheadByte() === '>') {
254
+                    if ($src->lookaheadByte() === '>'){
255 255
                         $this->flush();
256 256
                         $this->tokens[] = new Token(
257 257
                             self::TYPE_CLOSE_SHORT,
258 258
                             $n->offset,
259
-                            $n->char . $src->next()->char,
259
+                            $n->char.$src->next()->char,
260 260
                         );
261 261
 
262 262
                         break 2;
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
                     break 2;
276 276
 
277 277
                 default:
278
-                    if (\preg_match(self::REGEXP_WHITESPACE, $n->char)) {
278
+                    if (\preg_match(self::REGEXP_WHITESPACE, $n->char)){
279 279
                         $this->flushKeyword();
280 280
                         $this->whitespace[] = $n;
281 281
                         break;
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
                     $this->flushWhitespace();
284 284
 
285 285
 
286
-                    if (!\preg_match(self::REGEXP_KEYWORD, $n->char)) {
286
+                    if (!\preg_match(self::REGEXP_KEYWORD, $n->char)){
287 287
                         // unexpected char
288 288
                         return null;
289 289
                     }
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
             }
293 293
         }
294 294
 
295
-        if (!$this->isValid()) {
295
+        if (!$this->isValid()){
296 296
             return null;
297 297
         }
298 298
 
@@ -302,17 +302,17 @@  discard block
 block discarded – undo
302 302
     private function isValid(): bool
303 303
     {
304 304
         // tag is too short or does not have name keyword
305
-        if (\count($this->tokens) < 3) {
305
+        if (\count($this->tokens) < 3){
306 306
             return false;
307 307
         }
308 308
 
309 309
         $last = $this->tokens[\count($this->tokens) - 1];
310
-        if ($last->type !== self::TYPE_CLOSE && $last->type !== self::TYPE_CLOSE_SHORT) {
310
+        if ($last->type !== self::TYPE_CLOSE && $last->type !== self::TYPE_CLOSE_SHORT){
311 311
             return false;
312 312
         }
313 313
 
314
-        foreach ($this->tokens as $token) {
315
-            switch ($token->type) {
314
+        foreach ($this->tokens as $token){
315
+            switch ($token->type){
316 316
                 case self::TYPE_WHITESPACE:
317 317
                     // ignore
318 318
                     continue 2;
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
      */
344 344
     private function flushWhitespace(): void
345 345
     {
346
-        if ($this->whitespace === []) {
346
+        if ($this->whitespace === []){
347 347
             return;
348 348
         }
349 349
 
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
      */
357 357
     private function flushKeyword(): void
358 358
     {
359
-        if ($this->keyword === []) {
359
+        if ($this->keyword === []){
360 360
             return;
361 361
         }
362 362
 
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
      */
370 370
     private function flushAttribute(): void
371 371
     {
372
-        if ($this->attribute === []) {
372
+        if ($this->attribute === []){
373 373
             return;
374 374
         }
375 375
 
Please login to merge, or discard this patch.
builder/ValidateVersionReleaseWorker.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@  discard block
 block discarded – undo
13 13
     public function __construct(
14 14
         private readonly TagParserInterface $parser,
15 15
         private ?string $gitDirectory = null,
16
-    ) {
17
-        if ($gitDirectory === null) {
16
+    ){
17
+        if ($gitDirectory === null){
18 18
             $this->gitDirectory = \dirname(__DIR__);
19 19
         }
20 20
     }
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
32 32
         $mostRecentVersion = $this->findMostRecentVersion($version);
33 33
 
34 34
         // no tag yet
35
-        if ($mostRecentVersion === null) {
35
+        if ($mostRecentVersion === null){
36 36
             return;
37 37
         }
38 38
 
39 39
         // validation
40 40
         $mostRecentVersion = new Version(\strtolower($mostRecentVersion));
41
-        if ($version->isGreaterThan($mostRecentVersion)) {
41
+        if ($version->isGreaterThan($mostRecentVersion)){
42 42
             return;
43 43
         }
44 44
 
@@ -52,23 +52,23 @@  discard block
 block discarded – undo
52 52
     private function findMostRecentVersion(Version $version): ?string
53 53
     {
54 54
         $tags = [];
55
-        foreach ($this->parser->parse($this->gitDirectory) as $tag) {
55
+        foreach ($this->parser->parse($this->gitDirectory) as $tag){
56 56
             $tag = new Version(\strtolower($tag));
57 57
 
58 58
             // all previous major versions
59
-            if ($version->getMajor()->getValue() > $tag->getMajor()->getValue()) {
59
+            if ($version->getMajor()->getValue() > $tag->getMajor()->getValue()){
60 60
                 $tags[] = $tag;
61 61
             }
62 62
 
63 63
             // all minor versions up to the requested in the requested major version
64
-            if ($version->getMajor()->getValue() === $tag->getMajor()->getValue()) {
65
-                if ($version->getMinor()->getValue() >= $tag->getMinor()->getValue()) {
64
+            if ($version->getMajor()->getValue() === $tag->getMajor()->getValue()){
65
+                if ($version->getMinor()->getValue() >= $tag->getMinor()->getValue()){
66 66
                     $tags[] = $tag;
67 67
                 }
68 68
             }
69 69
         }
70 70
 
71
-        if ($tags === []) {
71
+        if ($tags === []){
72 72
             return null;
73 73
         }
74 74
 
Please login to merge, or discard this patch.
Braces   +16 added lines, -8 removed lines patch added patch discarded remove patch
@@ -14,7 +14,8 @@  discard block
 block discarded – undo
14 14
         private readonly TagParserInterface $parser,
15 15
         private ?string $gitDirectory = null,
16 16
     ) {
17
-        if ($gitDirectory === null) {
17
+        if ($gitDirectory === null)
18
+        {
18 19
             $this->gitDirectory = \dirname(__DIR__);
19 20
         }
20 21
     }
@@ -32,13 +33,15 @@  discard block
 block discarded – undo
32 33
         $mostRecentVersion = $this->findMostRecentVersion($version);
33 34
 
34 35
         // no tag yet
35
-        if ($mostRecentVersion === null) {
36
+        if ($mostRecentVersion === null)
37
+        {
36 38
             return;
37 39
         }
38 40
 
39 41
         // validation
40 42
         $mostRecentVersion = new Version(\strtolower($mostRecentVersion));
41
-        if ($version->isGreaterThan($mostRecentVersion)) {
43
+        if ($version->isGreaterThan($mostRecentVersion))
44
+        {
42 45
             return;
43 46
         }
44 47
 
@@ -52,23 +55,28 @@  discard block
 block discarded – undo
52 55
     private function findMostRecentVersion(Version $version): ?string
53 56
     {
54 57
         $tags = [];
55
-        foreach ($this->parser->parse($this->gitDirectory) as $tag) {
58
+        foreach ($this->parser->parse($this->gitDirectory) as $tag)
59
+        {
56 60
             $tag = new Version(\strtolower($tag));
57 61
 
58 62
             // all previous major versions
59
-            if ($version->getMajor()->getValue() > $tag->getMajor()->getValue()) {
63
+            if ($version->getMajor()->getValue() > $tag->getMajor()->getValue())
64
+            {
60 65
                 $tags[] = $tag;
61 66
             }
62 67
 
63 68
             // all minor versions up to the requested in the requested major version
64
-            if ($version->getMajor()->getValue() === $tag->getMajor()->getValue()) {
65
-                if ($version->getMinor()->getValue() >= $tag->getMinor()->getValue()) {
69
+            if ($version->getMajor()->getValue() === $tag->getMajor()->getValue())
70
+            {
71
+                if ($version->getMinor()->getValue() >= $tag->getMinor()->getValue())
72
+                {
66 73
                     $tags[] = $tag;
67 74
                 }
68 75
             }
69 76
         }
70 77
 
71
-        if ($tags === []) {
78
+        if ($tags === [])
79
+        {
72 80
             return null;
73 81
         }
74 82
 
Please login to merge, or discard this patch.
builder/ProcessParser.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
 
13 13
     public function __construct(
14 14
         private readonly ProcessRunner $processRunner,
15
-    ) {}
15
+    ){}
16 16
 
17 17
     /**
18 18
      * Returns null, when there are no local tags yet
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,8 @@
 block discarded – undo
12 12
 
13 13
     public function __construct(
14 14
         private readonly ProcessRunner $processRunner,
15
-    ) {}
15
+    ) {
16
+}
16 17
 
17 18
     /**
18 19
      * Returns null, when there are no local tags yet
Please login to merge, or discard this patch.