Passed
Pull Request — master (#190)
by Sebastian
03:03
created
src/Validation/Rule/ProvidedNonNullArgumentsRule.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
 
37 37
         $argumentNodes = $node->getArguments();
38 38
         $argumentNodeMap = keyMap($argumentNodes,
39
-          function (ArgumentNode $argument) {
40
-              return $argument->getNameValue();
41
-          });
39
+            function (ArgumentNode $argument) {
40
+                return $argument->getNameValue();
41
+            });
42 42
 
43 43
         foreach ($fieldDefinition->getArguments() as $argumentDefinition) {
44 44
             $argumentNode = $argumentNodeMap[$argumentDefinition->getName()] ?? null;
@@ -46,14 +46,14 @@  discard block
 block discarded – undo
46 46
 
47 47
             if (null === $argumentNode && $argumentType instanceof NonNullType) {
48 48
                 $this->context->reportError(
49
-                  new ValidationException(
49
+                    new ValidationException(
50 50
                     missingFieldArgumentMessage(
51
-                      (string)$node,
52
-                      (string)$argumentDefinition,
53
-                      (string)$argumentType
51
+                        (string)$node,
52
+                        (string)$argumentDefinition,
53
+                        (string)$argumentType
54 54
                     ),
55 55
                     [$node]
56
-                  )
56
+                    )
57 57
                 );
58 58
             }
59 59
         }
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
 
75 75
         $argumentNodes = $node->getArguments();
76 76
         $argumentNodeMap = keyMap($argumentNodes,
77
-          function (ArgumentNode $argument) {
78
-              return $argument->getNameValue();
79
-          });
77
+            function (ArgumentNode $argument) {
78
+                return $argument->getNameValue();
79
+            });
80 80
 
81 81
         foreach ($directiveDefinition->getArguments() as $argumentDefinition) {
82 82
             $argumentNode = $argumentNodeMap[$argumentDefinition->getName()] ?? null;
@@ -84,14 +84,14 @@  discard block
 block discarded – undo
84 84
 
85 85
             if (null === $argumentNode && $argumentType instanceof NonNullType) {
86 86
                 $this->context->reportError(
87
-                  new ValidationException(
87
+                    new ValidationException(
88 88
                     missingDirectiveArgumentMessage(
89
-                      (string)$node,
90
-                      (string)$argumentDefinition,
91
-                      (string)$argumentType
89
+                        (string)$node,
90
+                        (string)$argumentDefinition,
91
+                        (string)$argumentType
92 92
                     ),
93 93
                     [$node]
94
-                  )
94
+                    )
95 95
                 );
96 96
             }
97 97
         }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
         $argumentNodes = $node->getArguments();
38 38
         $argumentNodeMap = keyMap($argumentNodes,
39
-          function (ArgumentNode $argument) {
39
+          function(ArgumentNode $argument) {
40 40
               return $argument->getNameValue();
41 41
           });
42 42
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 
75 75
         $argumentNodes = $node->getArguments();
76 76
         $argumentNodeMap = keyMap($argumentNodes,
77
-          function (ArgumentNode $argument) {
77
+          function(ArgumentNode $argument) {
78 78
               return $argument->getNameValue();
79 79
           });
80 80
 
Please login to merge, or discard this patch.
src/Validation/Rule/PossibleFragmentSpreadsRule.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -38,11 +38,11 @@  discard block
 block discarded – undo
38 38
           !doTypesOverlap($this->context->getSchema(),
39 39
             $fragmentType, $parentType)) {
40 40
             $this->context->reportError(
41
-              new ValidationException(
41
+                new ValidationException(
42 42
                 typeIncompatibleAnonymousSpreadMessage($parentType,
43
-                  $fragmentType),
43
+                    $fragmentType),
44 44
                 [$node]
45
-              )
45
+                )
46 46
             );
47 47
         }
48 48
 
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
           !doTypesOverlap($this->context->getSchema(),
65 65
             $fragmentType, $parentType)) {
66 66
             $this->context->reportError(
67
-              new ValidationException(
67
+                new ValidationException(
68 68
                 typeIncompatibleSpreadMessage($fragmentName, $parentType,
69
-                  $fragmentType),
69
+                    $fragmentType),
70 70
                 [$node]
71
-              )
71
+                )
72 72
             );
73 73
         }
74 74
 
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
         }
91 91
 
92 92
         $type = typeFromAST($this->context->getSchema(),
93
-          $fragment->getTypeCondition());
93
+            $fragment->getTypeCondition());
94 94
 
95 95
         return $type instanceof CompositeTypeInterface ? $type : null;
96 96
     }
Please login to merge, or discard this patch.
src/Validation/Rule/KnownDirectivesRule.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -49,15 +49,15 @@  discard block
 block discarded – undo
49 49
     {
50 50
         /** @var Directive $directiveDefinition */
51 51
         $directiveDefinition = find(
52
-          $this->context->getSchema()->getDirectives(),
53
-          function (Directive $definition) use ($node) {
54
-              return $definition->getName() === $node->getNameValue();
55
-          }
52
+            $this->context->getSchema()->getDirectives(),
53
+            function (Directive $definition) use ($node) {
54
+                return $definition->getName() === $node->getNameValue();
55
+            }
56 56
         );
57 57
 
58 58
         if (null == $directiveDefinition) {
59 59
             $this->context->reportError(
60
-              new ValidationException(unknownDirectiveMessage((string)$node),
60
+                new ValidationException(unknownDirectiveMessage((string)$node),
61 61
                 [$node])
62 62
             );
63 63
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         if (null !== $location && !\in_array($location,
70 70
             $directiveDefinition->getLocations())) {
71 71
             $this->context->reportError(
72
-              new ValidationException(misplacedDirectiveMessage((string)$node,
72
+                new ValidationException(misplacedDirectiveMessage((string)$node,
73 73
                 $location), [$node])
74 74
             );
75 75
         }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
         /** @var Directive $directiveDefinition */
51 51
         $directiveDefinition = find(
52 52
           $this->context->getSchema()->getDirectives(),
53
-          function (Directive $definition) use ($node) {
53
+          function(Directive $definition) use ($node) {
54 54
               return $definition->getName() === $node->getNameValue();
55 55
           }
56 56
         );
Please login to merge, or discard this patch.
src/Validation/Rule/SupportedRules.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -11,31 +11,31 @@
 block discarded – undo
11 11
      * @var array
12 12
      */
13 13
     private static $supportedRules = [
14
-      ExecutableDefinitionsRule::class,
15
-      FieldOnCorrectTypeRule::class,
16
-      FragmentsOnCompositeTypesRule::class,
17
-      KnownArgumentNamesRule::class,
18
-      KnownDirectivesRule::class,
19
-      KnownFragmentNamesRule::class,
20
-      KnownTypeNamesRule::class,
21
-      LoneAnonymousOperationRule::class,
22
-      NoFragmentCyclesRule::class,
23
-      NoUndefinedVariablesRule::class,
24
-      NoUnusedFragmentsRule::class,
25
-      NoUnusedVariablesRule::class,
26
-      OverlappingFieldsCanBeMergedRule::class,
27
-      PossibleFragmentSpreadsRule::class,
28
-      ProvidedNonNullArgumentsRule::class,
29
-      ScalarLeafsRule::class,
30
-      SingleFieldSubscriptionsRule::class,
31
-      UniqueArgumentNamesRule::class,
32
-      UniqueDirectivesPerLocationRule::class,
33
-      UniqueFragmentNamesRule::class,
34
-      UniqueVariableNamesRule::class,
35
-      ValuesOfCorrectTypeRule::class,
36
-      VariablesAreInputTypesRule::class,
37
-      VariablesDefaultValueAllowedRule::class,
38
-      VariablesInAllowedPositionRule::class,
14
+        ExecutableDefinitionsRule::class,
15
+        FieldOnCorrectTypeRule::class,
16
+        FragmentsOnCompositeTypesRule::class,
17
+        KnownArgumentNamesRule::class,
18
+        KnownDirectivesRule::class,
19
+        KnownFragmentNamesRule::class,
20
+        KnownTypeNamesRule::class,
21
+        LoneAnonymousOperationRule::class,
22
+        NoFragmentCyclesRule::class,
23
+        NoUndefinedVariablesRule::class,
24
+        NoUnusedFragmentsRule::class,
25
+        NoUnusedVariablesRule::class,
26
+        OverlappingFieldsCanBeMergedRule::class,
27
+        PossibleFragmentSpreadsRule::class,
28
+        ProvidedNonNullArgumentsRule::class,
29
+        ScalarLeafsRule::class,
30
+        SingleFieldSubscriptionsRule::class,
31
+        UniqueArgumentNamesRule::class,
32
+        UniqueDirectivesPerLocationRule::class,
33
+        UniqueFragmentNamesRule::class,
34
+        UniqueVariableNamesRule::class,
35
+        ValuesOfCorrectTypeRule::class,
36
+        VariablesAreInputTypesRule::class,
37
+        VariablesDefaultValueAllowedRule::class,
38
+        VariablesInAllowedPositionRule::class,
39 39
     ];
40 40
 
41 41
     /**
Please login to merge, or discard this patch.
src/Validation/Conflict/FindsConflictsTrait.php 2 patches
Indentation   +126 added lines, -126 removed lines patch added patch discarded remove patch
@@ -109,9 +109,9 @@  discard block
 block discarded – undo
109 109
      * @throws InvariantException
110 110
      */
111 111
     protected function findConflictsWithinSelectionSet(
112
-      Map $cachedFieldsAndFragmentNames,
113
-      PairSet $comparedFragmentPairs,
114
-      SelectionSetNode $selectionSet,
112
+        Map $cachedFieldsAndFragmentNames,
113
+        PairSet $comparedFragmentPairs,
114
+        SelectionSetNode $selectionSet,
115 115
       ?NamedTypeInterface $parentType = null
116 116
     ): array {
117 117
         $this->cachedFieldsAndFragmentNames = $cachedFieldsAndFragmentNames;
@@ -135,11 +135,11 @@  discard block
 block discarded – undo
135 135
             /** @noinspection ForeachInvariantsInspection */
136 136
             for ($i = 0; $i < $fragmentNamesCount; $i++) {
137 137
                 $this->collectConflictsBetweenFieldsAndFragment(
138
-                  $context,
139
-                  $comparedFragments,
140
-                  $fieldMap,
141
-                  $fragmentNames[$i],
142
-                  false/* $areMutuallyExclusive */
138
+                    $context,
139
+                    $comparedFragments,
140
+                    $fieldMap,
141
+                    $fragmentNames[$i],
142
+                    false/* $areMutuallyExclusive */
143 143
                 );
144 144
 
145 145
                 // (C) Then compare this fragment with all other fragments found in this
@@ -148,10 +148,10 @@  discard block
 block discarded – undo
148 148
                 // item in that same list (except for itself).
149 149
                 for ($j = $i + 1; $j < $fragmentNamesCount; $j++) {
150 150
                     $this->collectConflictsBetweenFragments(
151
-                      $context,
152
-                      $fragmentNames[$i],
153
-                      $fragmentNames[$j],
154
-                      false/* $areMutuallyExclusive */
151
+                        $context,
152
+                        $fragmentNames[$i],
153
+                        $fragmentNames[$j],
154
+                        false/* $areMutuallyExclusive */
155 155
                     );
156 156
                 }
157 157
             }
@@ -173,11 +173,11 @@  discard block
 block discarded – undo
173 173
      * @throws InvalidTypeException
174 174
      */
175 175
     protected function collectConflictsBetweenFieldsAndFragment(
176
-      ComparisonContext $context,
177
-      array &$comparedFragments,
178
-      array $fieldMap,
179
-      string $fragmentName,
180
-      bool $areMutuallyExclusive
176
+        ComparisonContext $context,
177
+        array &$comparedFragments,
178
+        array $fieldMap,
179
+        string $fragmentName,
180
+        bool $areMutuallyExclusive
181 181
     ): void {
182 182
         // Memoize so a fragment is not compared for conflicts more than once.
183 183
         if (isset($comparedFragments[$fragmentName])) {
@@ -204,10 +204,10 @@  discard block
 block discarded – undo
204 204
         // (D) First collect any conflicts between the provided collection of fields
205 205
         // and the collection of fields represented by the given fragment.
206 206
         $this->collectConflictsBetween(
207
-          $context,
208
-          $fieldMap,
209
-          $fieldMapB,
210
-          $areMutuallyExclusive
207
+            $context,
208
+            $fieldMap,
209
+            $fieldMapB,
210
+            $areMutuallyExclusive
211 211
         );
212 212
 
213 213
         $fragmentNamesB = $contextB->getFragmentNames();
@@ -220,11 +220,11 @@  discard block
 block discarded – undo
220 220
             /** @noinspection ForeachInvariantsInspection */
221 221
             for ($i = 0; $i < $fragmentNamesBCount; $i++) {
222 222
                 $this->collectConflictsBetweenFieldsAndFragment(
223
-                  $context,
224
-                  $comparedFragments,
225
-                  $fieldMap,
226
-                  $fragmentNamesB[$i],
227
-                  $areMutuallyExclusive
223
+                    $context,
224
+                    $comparedFragments,
225
+                    $fieldMap,
226
+                    $fragmentNamesB[$i],
227
+                    $areMutuallyExclusive
228 228
                 );
229 229
             }
230 230
         }
@@ -242,10 +242,10 @@  discard block
 block discarded – undo
242 242
      * @throws InvalidTypeException
243 243
      */
244 244
     protected function collectConflictsBetweenFragments(
245
-      ComparisonContext $context,
246
-      string $fragmentNameA,
247
-      string $fragmentNameB,
248
-      bool $areMutuallyExclusive
245
+        ComparisonContext $context,
246
+        string $fragmentNameA,
247
+        string $fragmentNameB,
248
+        bool $areMutuallyExclusive
249 249
     ): void {
250 250
         // No need to compare a fragment to itself.
251 251
         if ($fragmentNameA === $fragmentNameB) {
@@ -254,12 +254,12 @@  discard block
 block discarded – undo
254 254
 
255 255
         // Memoize so two fragments are not compared for conflicts more than once.
256 256
         if ($this->comparedFragmentPairs->has($fragmentNameA, $fragmentNameB,
257
-          $areMutuallyExclusive)) {
257
+            $areMutuallyExclusive)) {
258 258
             return;
259 259
         }
260 260
 
261 261
         $this->comparedFragmentPairs->add($fragmentNameA, $fragmentNameB,
262
-          $areMutuallyExclusive);
262
+            $areMutuallyExclusive);
263 263
 
264 264
         $fragmentA = $this->getValidationContext()->getFragment($fragmentNameA);
265 265
         $fragmentB = $this->getValidationContext()->getFragment($fragmentNameB);
@@ -274,10 +274,10 @@  discard block
 block discarded – undo
274 274
         // (F) First, collect all conflicts between these two collections of fields
275 275
         // (not including any nested fragments).
276 276
         $this->collectConflictsBetween(
277
-          $context,
278
-          $contextA->getFieldMap(),
279
-          $contextB->getFieldMap(),
280
-          $areMutuallyExclusive
277
+            $context,
278
+            $contextA->getFieldMap(),
279
+            $contextB->getFieldMap(),
280
+            $areMutuallyExclusive
281 281
         );
282 282
 
283 283
         $fragmentNamesB = $contextB->getFragmentNames();
@@ -290,10 +290,10 @@  discard block
 block discarded – undo
290 290
             /** @noinspection ForeachInvariantsInspection */
291 291
             for ($j = 0; $j < $fragmentNamesBCount; $j++) {
292 292
                 $this->collectConflictsBetweenFragments(
293
-                  $context,
294
-                  $fragmentNameA,
295
-                  $fragmentNamesB[$j],
296
-                  $areMutuallyExclusive
293
+                    $context,
294
+                    $fragmentNameA,
295
+                    $fragmentNamesB[$j],
296
+                    $areMutuallyExclusive
297 297
                 );
298 298
             }
299 299
         }
@@ -308,10 +308,10 @@  discard block
 block discarded – undo
308 308
             /** @noinspection ForeachInvariantsInspection */
309 309
             for ($i = 0; $i < $fragmentNamesACount; $i++) {
310 310
                 $this->collectConflictsBetweenFragments(
311
-                  $context,
312
-                  $fragmentNamesA[$i],
313
-                  $fragmentNameB,
314
-                  $areMutuallyExclusive
311
+                    $context,
312
+                    $fragmentNamesA[$i],
313
+                    $fragmentNameB,
314
+                    $areMutuallyExclusive
315 315
                 );
316 316
             }
317 317
         }
@@ -333,17 +333,17 @@  discard block
 block discarded – undo
333 333
      */
334 334
     protected function findConflictsBetweenSubSelectionSets(
335 335
       ?NamedTypeInterface $parentTypeA,
336
-      SelectionSetNode $selectionSetA,
336
+        SelectionSetNode $selectionSetA,
337 337
       ?NamedTypeInterface $parentTypeB,
338
-      SelectionSetNode $selectionSetB,
339
-      bool $areMutuallyExclusive
338
+        SelectionSetNode $selectionSetB,
339
+        bool $areMutuallyExclusive
340 340
     ): array {
341 341
         $context = new ComparisonContext();
342 342
 
343 343
         $contextA = $this->getFieldsAndFragmentNames($selectionSetA,
344
-          $parentTypeA);
344
+            $parentTypeA);
345 345
         $contextB = $this->getFieldsAndFragmentNames($selectionSetB,
346
-          $parentTypeB);
346
+            $parentTypeB);
347 347
 
348 348
         $fieldMapA = $contextA->getFieldMap();
349 349
         $fieldMapB = $contextB->getFieldMap();
@@ -356,10 +356,10 @@  discard block
 block discarded – undo
356 356
 
357 357
         // (H) First, collect all conflicts between these two collections of field.
358 358
         $this->collectConflictsBetween(
359
-          $context,
360
-          $fieldMapA,
361
-          $fieldMapB,
362
-          $areMutuallyExclusive
359
+            $context,
360
+            $fieldMapA,
361
+            $fieldMapB,
362
+            $areMutuallyExclusive
363 363
         );
364 364
 
365 365
         // (I) Then collect conflicts between the first collection of fields and
@@ -370,11 +370,11 @@  discard block
 block discarded – undo
370 370
             /** @noinspection ForeachInvariantsInspection */
371 371
             for ($j = 0; $j < $fragmentNamesBCount; $j++) {
372 372
                 $this->collectConflictsBetweenFieldsAndFragment(
373
-                  $context,
374
-                  $comparedFragments,
375
-                  $fieldMapA,
376
-                  $fragmentNamesB[$j],
377
-                  $areMutuallyExclusive
373
+                    $context,
374
+                    $comparedFragments,
375
+                    $fieldMapA,
376
+                    $fragmentNamesB[$j],
377
+                    $areMutuallyExclusive
378 378
                 );
379 379
             }
380 380
         }
@@ -387,11 +387,11 @@  discard block
 block discarded – undo
387 387
             /** @noinspection ForeachInvariantsInspection */
388 388
             for ($i = 0; $i < $fragmentNamesACount; $i++) {
389 389
                 $this->collectConflictsBetweenFieldsAndFragment(
390
-                  $context,
391
-                  $comparedFragments,
392
-                  $fieldMapB,
393
-                  $fragmentNamesA[$i],
394
-                  $areMutuallyExclusive
390
+                    $context,
391
+                    $comparedFragments,
392
+                    $fieldMapB,
393
+                    $fragmentNamesA[$i],
394
+                    $areMutuallyExclusive
395 395
                 );
396 396
             }
397 397
         }
@@ -401,10 +401,10 @@  discard block
 block discarded – undo
401 401
             /** @noinspection ForeachInvariantsInspection */
402 402
             for ($j = 0; $j < $fragmentNamesBCount; $j++) {
403 403
                 $this->collectConflictsBetweenFragments(
404
-                  $context,
405
-                  $fragmentNamesA[$i],
406
-                  $fragmentNamesB[$j],
407
-                  $areMutuallyExclusive
404
+                    $context,
405
+                    $fragmentNamesA[$i],
406
+                    $fragmentNamesB[$j],
407
+                    $areMutuallyExclusive
408 408
                 );
409 409
             }
410 410
         }
@@ -436,11 +436,11 @@  discard block
 block discarded – undo
436 436
                 for ($i = 0; $i < $fieldsCount; $i++) {
437 437
                     for ($j = $i + 1; $j < $fieldsCount; $j++) {
438 438
                         $conflict = $this->findConflict(
439
-                          $responseName,
440
-                          $fields[$i],
441
-                          $fields[$j],
442
-                          // within one collection is never mutually exclusive
443
-                          false/* $areMutuallyExclusive */
439
+                            $responseName,
440
+                            $fields[$i],
441
+                            $fields[$j],
442
+                            // within one collection is never mutually exclusive
443
+                            false/* $areMutuallyExclusive */
444 444
                         );
445 445
 
446 446
                         if (null !== $conflict) {
@@ -467,10 +467,10 @@  discard block
 block discarded – undo
467 467
      * @throws InvalidTypeException
468 468
      */
469 469
     protected function collectConflictsBetween(
470
-      ComparisonContext $context,
471
-      array $fieldMapA,
472
-      array $fieldMapB,
473
-      bool $parentFieldsAreMutuallyExclusive
470
+        ComparisonContext $context,
471
+        array $fieldMapA,
472
+        array $fieldMapB,
473
+        bool $parentFieldsAreMutuallyExclusive
474 474
     ): void {
475 475
         // A field map is a keyed collection, where each key represents a response
476 476
         // name and the value at that key is a list of all fields which provide that
@@ -488,10 +488,10 @@  discard block
 block discarded – undo
488 488
                     /** @noinspection ForeachInvariantsInspection */
489 489
                     for ($j = 0; $j < $fieldsBCount; $j++) {
490 490
                         $conflict = $this->findConflict(
491
-                          $responseName,
492
-                          $fieldsA[$i],
493
-                          $fieldsB[$j],
494
-                          $parentFieldsAreMutuallyExclusive
491
+                            $responseName,
492
+                            $fieldsA[$i],
493
+                            $fieldsB[$j],
494
+                            $parentFieldsAreMutuallyExclusive
495 495
                         );
496 496
 
497 497
                         if (null !== $conflict) {
@@ -516,10 +516,10 @@  discard block
 block discarded – undo
516 516
      * @throws InvalidTypeException
517 517
      */
518 518
     protected function findConflict(
519
-      string $responseName,
520
-      FieldContext $fieldA,
521
-      FieldContext $fieldB,
522
-      bool $parentFieldsAreMutuallyExclusive
519
+        string $responseName,
520
+        FieldContext $fieldA,
521
+        FieldContext $fieldB,
522
+        bool $parentFieldsAreMutuallyExclusive
523 523
     ): ?Conflict
524 524
     {
525 525
         $parentTypeA = $fieldA->getParentType();
@@ -551,21 +551,21 @@  discard block
 block discarded – undo
551 551
 
552 552
             if ($nameA !== $nameB) {
553 553
                 return new Conflict(
554
-                  $responseName,
555
-                  sprintf('%s and %s are different fields', $nameA, $nameB),
556
-                  [$nodeA],
557
-                  [$nodeB]
554
+                    $responseName,
555
+                    sprintf('%s and %s are different fields', $nameA, $nameB),
556
+                    [$nodeA],
557
+                    [$nodeB]
558 558
                 );
559 559
             }
560 560
 
561 561
             // Two field calls must have the same arguments.
562 562
             if (!compareArguments($nodeA->getArguments(),
563
-              $nodeB->getArguments())) {
563
+                $nodeB->getArguments())) {
564 564
                 return new Conflict(
565
-                  $responseName,
566
-                  'they have differing arguments',
567
-                  [$nodeA],
568
-                  [$nodeB]
565
+                    $responseName,
566
+                    'they have differing arguments',
567
+                    [$nodeA],
568
+                    [$nodeB]
569 569
                 );
570 570
             }
571 571
         }
@@ -577,11 +577,11 @@  discard block
 block discarded – undo
577 577
         if (null !== $typeA && null !== $typeB && compareTypes($typeA,
578 578
             $typeB)) {
579 579
             return new Conflict(
580
-              $responseName,
581
-              sprintf('they return conflicting types %s and %s', (string)$typeA,
580
+                $responseName,
581
+                sprintf('they return conflicting types %s and %s', (string)$typeA,
582 582
                 (string)$typeB),
583
-              [$nodeA],
584
-              [$nodeB]
583
+                [$nodeA],
584
+                [$nodeB]
585 585
             );
586 586
         }
587 587
 
@@ -593,15 +593,15 @@  discard block
 block discarded – undo
593 593
 
594 594
         if (null !== $selectionSetA && null !== $selectionSetB) {
595 595
             $conflicts = $this->findConflictsBetweenSubSelectionSets(
596
-              getNamedType($typeA),
597
-              $selectionSetA,
598
-              getNamedType($typeB),
599
-              $selectionSetB,
600
-              $areMutuallyExclusive
596
+                getNamedType($typeA),
597
+                $selectionSetA,
598
+                getNamedType($typeB),
599
+                $selectionSetB,
600
+                $areMutuallyExclusive
601 601
             );
602 602
 
603 603
             return $this->subfieldConflicts($conflicts, $responseName, $nodeA,
604
-              $nodeB);
604
+                $nodeB);
605 605
         }
606 606
 
607 607
         return null;
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
      * @throws InvariantException
621 621
      */
622 622
     protected function getFieldsAndFragmentNames(
623
-      SelectionSetNode $selectionSet,
623
+        SelectionSetNode $selectionSet,
624 624
       ?NamedTypeInterface $parentType
625 625
     ): ComparisonContext {
626 626
         $cached = $this->cachedFieldsAndFragmentNames->get($selectionSet);
@@ -629,7 +629,7 @@  discard block
 block discarded – undo
629 629
             $cached = new ComparisonContext();
630 630
 
631 631
             $this->collectFieldsAndFragmentNames($cached, $selectionSet,
632
-              $parentType);
632
+                $parentType);
633 633
 
634 634
             $this->cachedFieldsAndFragmentNames->set($selectionSet, $cached);
635 635
         }
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
      * @throws InvalidTypeException
649 649
      */
650 650
     protected function getReferencedFieldsAndFragmentNames(
651
-      FragmentDefinitionNode $fragment
651
+        FragmentDefinitionNode $fragment
652 652
     ): ComparisonContext {
653 653
         $cached = $this->cachedFieldsAndFragmentNames->get($fragment);
654 654
 
@@ -658,10 +658,10 @@  discard block
 block discarded – undo
658 658
 
659 659
         /** @var NamedTypeInterface $fragmentType */
660 660
         $fragmentType = typeFromAST($this->getValidationContext()->getSchema(),
661
-          $fragment->getTypeCondition());
661
+            $fragment->getTypeCondition());
662 662
 
663 663
         return $this->getFieldsAndFragmentNames($fragment->getSelectionSet(),
664
-          $fragmentType);
664
+            $fragmentType);
665 665
     }
666 666
 
667 667
     /**
@@ -673,8 +673,8 @@  discard block
 block discarded – undo
673 673
      * @throws InvariantException
674 674
      */
675 675
     protected function collectFieldsAndFragmentNames(
676
-      ComparisonContext $context,
677
-      SelectionSetNode $selectionSet,
676
+        ComparisonContext $context,
677
+        SelectionSetNode $selectionSet,
678 678
       ?NamedTypeInterface $parentType
679 679
     ): void {
680 680
         foreach ($selectionSet->getSelections() as $selection) {
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
                   : null;
685 685
 
686 686
                 $context->registerField(new FieldContext($parentType,
687
-                  $selection, $definition));
687
+                    $selection, $definition));
688 688
             } elseif ($selection instanceof FragmentSpreadNode) {
689 689
                 $context->registerFragment($selection);
690 690
             } elseif ($selection instanceof InlineFragmentNode) {
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
                   : $parentType;
697 697
 
698 698
                 $this->collectFieldsAndFragmentNames($context,
699
-                  $selection->getSelectionSet(), $inlineFragmentType);
699
+                    $selection->getSelectionSet(), $inlineFragmentType);
700 700
             }
701 701
         }
702 702
     }
@@ -713,10 +713,10 @@  discard block
 block discarded – undo
713 713
      * @return Conflict|null
714 714
      */
715 715
     protected function subfieldConflicts(
716
-      array $conflicts,
717
-      string $responseName,
718
-      FieldNode $nodeA,
719
-      FieldNode $nodeB
716
+        array $conflicts,
717
+        string $responseName,
718
+        FieldNode $nodeA,
719
+        FieldNode $nodeB
720 720
     ): ?Conflict
721 721
     {
722 722
         if (empty($conflicts)) {
@@ -724,16 +724,16 @@  discard block
 block discarded – undo
724 724
         }
725 725
 
726 726
         return new Conflict(
727
-          $responseName,
728
-          array_map(function (Conflict $conflict) {
729
-              return [$conflict->getResponseName(), $conflict->getReason()];
730
-          }, $conflicts),
731
-          array_reduce($conflicts, function ($allFields, Conflict $conflict) {
732
-              return array_merge($allFields, $conflict->getFieldsA());
733
-          }, [$nodeA]),
734
-          array_reduce($conflicts, function ($allFields, Conflict $conflict) {
735
-              return array_merge($allFields, $conflict->getFieldsB());
736
-          }, [$nodeB])
727
+            $responseName,
728
+            array_map(function (Conflict $conflict) {
729
+                return [$conflict->getResponseName(), $conflict->getReason()];
730
+            }, $conflicts),
731
+            array_reduce($conflicts, function ($allFields, Conflict $conflict) {
732
+                return array_merge($allFields, $conflict->getFieldsA());
733
+            }, [$nodeA]),
734
+            array_reduce($conflicts, function ($allFields, Conflict $conflict) {
735
+                return array_merge($allFields, $conflict->getFieldsB());
736
+            }, [$nodeB])
737 737
         );
738 738
     }
739 739
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -725,13 +725,13 @@
 block discarded – undo
725 725
 
726 726
         return new Conflict(
727 727
           $responseName,
728
-          array_map(function (Conflict $conflict) {
728
+          array_map(function(Conflict $conflict) {
729 729
               return [$conflict->getResponseName(), $conflict->getReason()];
730 730
           }, $conflicts),
731
-          array_reduce($conflicts, function ($allFields, Conflict $conflict) {
731
+          array_reduce($conflicts, function($allFields, Conflict $conflict) {
732 732
               return array_merge($allFields, $conflict->getFieldsA());
733 733
           }, [$nodeA]),
734
-          array_reduce($conflicts, function ($allFields, Conflict $conflict) {
734
+          array_reduce($conflicts, function($allFields, Conflict $conflict) {
735 735
               return array_merge($allFields, $conflict->getFieldsB());
736 736
           }, [$nodeB])
737 737
         );
Please login to merge, or discard this patch.
src/Validation/Conflict/PairSet.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -57,9 +57,9 @@
 block discarded – undo
57 57
      * @param bool $areMutuallyExclusive
58 58
      */
59 59
     protected function addToData(
60
-      string $a,
61
-      string $b,
62
-      bool $areMutuallyExclusive
60
+        string $a,
61
+        string $b,
62
+        bool $areMutuallyExclusive
63 63
     ): void {
64 64
         $map = $this->data[$a] ?? [];
65 65
 
Please login to merge, or discard this patch.
src/Validation/Conflict/Conflict.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -34,10 +34,10 @@
 block discarded – undo
34 34
      * @param array|null $fieldsB
35 35
      */
36 36
     public function __construct(
37
-      string $responseName,
38
-      $reason,
39
-      array $fieldsA,
40
-      array $fieldsB
37
+        string $responseName,
38
+        $reason,
39
+        array $fieldsA,
40
+        array $fieldsB
41 41
     ) {
42 42
         $this->responseName = $responseName;
43 43
         $this->reason = $reason;
Please login to merge, or discard this patch.
src/Validation/Conflict/FieldContext.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
      */
34 34
     public function __construct(
35 35
       ?CompositeTypeInterface $parentType,
36
-      FieldNode $node,
36
+        FieldNode $node,
37 37
       ?Field $definition = null
38 38
     ) {
39 39
         $this->parentType = $parentType;
Please login to merge, or discard this patch.
src/Validation/messages.php 2 patches
Indentation   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -23,18 +23,18 @@  discard block
 block discarded – undo
23 23
  * @return string
24 24
  */
25 25
 function undefinedFieldMessage(
26
-  string $fieldName,
27
-  string $type,
28
-  array $suggestedTypeNames,
29
-  array $suggestedFieldNames
26
+    string $fieldName,
27
+    string $type,
28
+    array $suggestedTypeNames,
29
+    array $suggestedFieldNames
30 30
 ): string {
31 31
     $message = sprintf('Cannot query field "%s" on type "%s".', $fieldName,
32
-      $type);
32
+        $type);
33 33
     if (!empty($suggestedTypeNames)) {
34 34
         return $message . ' ' . sprintf(
35 35
             'Did you mean to use an inline fragment on %s?',
36 36
             quotedOrList($suggestedTypeNames)
37
-          );
37
+            );
38 38
     }
39 39
     if (!empty($suggestedFieldNames)) {
40 40
         return $message . ' ' . sprintf('Did you mean %s?',
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 function inlineFragmentOnNonCompositeMessage(string $typeName): string
52 52
 {
53 53
     return sprintf('Fragment cannot condition on non composite type "%s".',
54
-      $typeName);
54
+        $typeName);
55 55
 }
56 56
 
57 57
 /**
@@ -61,11 +61,11 @@  discard block
 block discarded – undo
61 61
  * @return string
62 62
  */
63 63
 function fragmentOnNonCompositeMessage(
64
-  string $fragmentName,
65
-  string $typeName
64
+    string $fragmentName,
65
+    string $typeName
66 66
 ): string {
67 67
     return sprintf('Fragment "%s" cannot condition on non composite type "%s".',
68
-      $fragmentName, $typeName);
68
+        $fragmentName, $typeName);
69 69
 }
70 70
 
71 71
 /**
@@ -77,13 +77,13 @@  discard block
 block discarded – undo
77 77
  * @return string
78 78
  */
79 79
 function unknownArgumentMessage(
80
-  string $argumentName,
81
-  string $fieldName,
82
-  string $typeName,
83
-  array $suggestedArguments
80
+    string $argumentName,
81
+    string $fieldName,
82
+    string $typeName,
83
+    array $suggestedArguments
84 84
 ): string {
85 85
     $message = sprintf('Unknown argument "%s" on field "%s" of type "%s".',
86
-      $argumentName, $fieldName, $typeName);
86
+        $argumentName, $fieldName, $typeName);
87 87
     if (!empty($suggestedArguments)) {
88 88
         return $message . ' ' . sprintf('Did you mean %s',
89 89
             quotedOrList($suggestedArguments));
@@ -99,12 +99,12 @@  discard block
 block discarded – undo
99 99
  * @return string
100 100
  */
101 101
 function unknownDirectiveArgumentMessage(
102
-  string $argumentName,
103
-  string $directiveName,
104
-  array $suggestedArguments
102
+    string $argumentName,
103
+    string $directiveName,
104
+    array $suggestedArguments
105 105
 ): string {
106 106
     $message = sprintf('Unknown argument "%s" on directive "@%s".',
107
-      $argumentName, $directiveName);
107
+        $argumentName, $directiveName);
108 108
     if (!empty($suggestedArguments)) {
109 109
         return $message . ' ' . sprintf('Did you mean %s',
110 110
             quotedOrList($suggestedArguments));
@@ -129,11 +129,11 @@  discard block
 block discarded – undo
129 129
  * @return string
130 130
  */
131 131
 function misplacedDirectiveMessage(
132
-  string $directiveName,
133
-  string $location
132
+    string $directiveName,
133
+    string $location
134 134
 ): string {
135 135
     return sprintf('Directive "%s" may not be used on %s.', $directiveName,
136
-      $location);
136
+        $location);
137 137
 }
138 138
 
139 139
 /**
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 {
181 181
     $via = !empty($spreadNames) ? ' via ' . implode(', ', $spreadNames) : '';
182 182
     return sprintf('Cannot spread fragment "%s" within itself%s.',
183
-      $fragmentName, $via);
183
+        $fragmentName, $via);
184 184
 }
185 185
 
186 186
 /**
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
  * @return string
191 191
  */
192 192
 function undefinedVariableMessage(
193
-  string $variableName,
193
+    string $variableName,
194 194
   ?string $operationName = null
195 195
 ): string {
196 196
     /** @noinspection IsEmptyFunctionUsageInspection */
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
  * @return string
218 218
  */
219 219
 function unusedVariableMessage(
220
-  string $variableName,
220
+    string $variableName,
221 221
   ?string $operationName = null
222 222
 ): string {
223 223
     /** @noinspection IsEmptyFunctionUsageInspection */
@@ -236,9 +236,9 @@  discard block
 block discarded – undo
236 236
 function fieldsConflictMessage(string $responseName, $reason): string
237 237
 {
238 238
     return sprintf(
239
-      'Fields "%s" conflict because %s. Use different aliases on the fields to fetch both if this was intentional.',
240
-      $responseName,
241
-      conflictReasonMessage($reason)
239
+        'Fields "%s" conflict because %s. Use different aliases on the fields to fetch both if this was intentional.',
240
+        $responseName,
241
+        conflictReasonMessage($reason)
242 242
     );
243 243
 }
244 244
 
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
     return implode(' and ', array_map(function ($reason) {
261 261
         [$responseName, $subreason] = $reason;
262 262
         return sprintf('subfields "%s" conflict because %s', $responseName,
263
-          conflictReasonMessage($subreason));
263
+            conflictReasonMessage($subreason));
264 264
     }, $reason));
265 265
 }
266 266
 
@@ -272,15 +272,15 @@  discard block
 block discarded – undo
272 272
  * @return string
273 273
  */
274 274
 function typeIncompatibleSpreadMessage(
275
-  string $fragmentName,
276
-  string $parentType,
277
-  string $fragmentType
275
+    string $fragmentName,
276
+    string $parentType,
277
+    string $fragmentType
278 278
 ): string {
279 279
     return sprintf(
280
-      'Fragment "%s" cannot be spread here as objects of type "%s" can never be of type "%s".',
281
-      $fragmentName,
282
-      $parentType,
283
-      $fragmentType
280
+        'Fragment "%s" cannot be spread here as objects of type "%s" can never be of type "%s".',
281
+        $fragmentName,
282
+        $parentType,
283
+        $fragmentType
284 284
     );
285 285
 }
286 286
 
@@ -291,13 +291,13 @@  discard block
 block discarded – undo
291 291
  * @return string
292 292
  */
293 293
 function typeIncompatibleAnonymousSpreadMessage(
294
-  string $parentType,
295
-  string $fragmentType
294
+    string $parentType,
295
+    string $fragmentType
296 296
 ): string {
297 297
     return sprintf(
298
-      'Fragment cannot be spread here as objects of type "%s" can never be of type "%s".',
299
-      $parentType,
300
-      $fragmentType
298
+        'Fragment cannot be spread here as objects of type "%s" can never be of type "%s".',
299
+        $parentType,
300
+        $fragmentType
301 301
     );
302 302
 }
303 303
 
@@ -309,15 +309,15 @@  discard block
 block discarded – undo
309 309
  * @return string
310 310
  */
311 311
 function missingFieldArgumentMessage(
312
-  string $fieldName,
313
-  string $argumentName,
314
-  string $typeName
312
+    string $fieldName,
313
+    string $argumentName,
314
+    string $typeName
315 315
 ): string {
316 316
     return sprintf(
317
-      'Field "%s" argument "%s" of type "%s" is required but not provided.',
318
-      $fieldName,
319
-      $argumentName,
320
-      $typeName
317
+        'Field "%s" argument "%s" of type "%s" is required but not provided.',
318
+        $fieldName,
319
+        $argumentName,
320
+        $typeName
321 321
     );
322 322
 }
323 323
 
@@ -329,15 +329,15 @@  discard block
 block discarded – undo
329 329
  * @return string
330 330
  */
331 331
 function missingDirectiveArgumentMessage(
332
-  string $directiveName,
333
-  string $argumentName,
334
-  string $typeName
332
+    string $directiveName,
333
+    string $argumentName,
334
+    string $typeName
335 335
 ): string {
336 336
     return sprintf(
337
-      'Directive "%s" argument "%s" of type "%s" is required but not provided.',
338
-      $directiveName,
339
-      $argumentName,
340
-      $typeName
337
+        'Directive "%s" argument "%s" of type "%s" is required but not provided.',
338
+        $directiveName,
339
+        $argumentName,
340
+        $typeName
341 341
     );
342 342
 }
343 343
 
@@ -348,11 +348,11 @@  discard block
 block discarded – undo
348 348
  * @return string
349 349
  */
350 350
 function noSubselectionAllowedMessage(
351
-  string $fieldName,
352
-  string $typeName
351
+    string $fieldName,
352
+    string $typeName
353 353
 ): string {
354 354
     return sprintf('Field "%s" must not have a selection since type "%s" has no subfields.',
355
-      $fieldName, $typeName);
355
+        $fieldName, $typeName);
356 356
 }
357 357
 
358 358
 /**
@@ -362,14 +362,14 @@  discard block
 block discarded – undo
362 362
  * @return string
363 363
  */
364 364
 function requiresSubselectionMessage(
365
-  string $fieldName,
366
-  string $typeName
365
+    string $fieldName,
366
+    string $typeName
367 367
 ): string {
368 368
     return sprintf(
369
-      'Field "%s" of type "%s" must have a selection of subfields. Did you mean "%s { ... }"?',
370
-      $fieldName,
371
-      $typeName,
372
-      $fieldName
369
+        'Field "%s" of type "%s" must have a selection of subfields. Did you mean "%s { ... }"?',
370
+        $fieldName,
371
+        $typeName,
372
+        $fieldName
373 373
     );
374 374
 }
375 375
 
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 function duplicateDirectiveMessage(string $directiveName): string
403 403
 {
404 404
     return sprintf('The directive "%s" can only be used once at this location.',
405
-      $directiveName);
405
+        $directiveName);
406 406
 }
407 407
 
408 408
 /**
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 function duplicateOperationMessage(string $operationName): string
434 434
 {
435 435
     return sprintf('There can be only one operation named "%s".',
436
-      $operationName);
436
+        $operationName);
437 437
 }
438 438
 
439 439
 /**
@@ -453,11 +453,11 @@  discard block
 block discarded – undo
453 453
  * @return string
454 454
  */
455 455
 function nonInputTypeOnVariableMessage(
456
-  string $variableName,
457
-  string $typeName
456
+    string $variableName,
457
+    string $typeName
458 458
 ): string {
459 459
     return sprintf('Variable "$%s" cannot be non-input type "%s".',
460
-      $variableName, $typeName);
460
+        $variableName, $typeName);
461 461
 }
462 462
 
463 463
 /**
@@ -468,15 +468,15 @@  discard block
 block discarded – undo
468 468
  * @return string
469 469
  */
470 470
 function variableDefaultValueNotAllowedMessage(
471
-  string $variableName,
472
-  string $typeName,
473
-  string $guessedTypeName
471
+    string $variableName,
472
+    string $typeName,
473
+    string $guessedTypeName
474 474
 ): string {
475 475
     return sprintf(
476
-      'Variable "$%s" of type "%s" is required and will not use the default value. Perhaps you meant to use type "%s".',
477
-      $variableName,
478
-      $typeName,
479
-      $guessedTypeName
476
+        'Variable "$%s" of type "%s" is required and will not use the default value. Perhaps you meant to use type "%s".',
477
+        $variableName,
478
+        $typeName,
479
+        $guessedTypeName
480 480
     );
481 481
 }
482 482
 
@@ -488,15 +488,15 @@  discard block
 block discarded – undo
488 488
  * @return string
489 489
  */
490 490
 function badVariablePositionMessage(
491
-  string $variableName,
492
-  string $typeName,
493
-  string $expectedTypeName
491
+    string $variableName,
492
+    string $typeName,
493
+    string $expectedTypeName
494 494
 ): string {
495 495
     return sprintf(
496
-      'Variable "$%s" of type "%s" used in position expecting type "%s".',
497
-      $variableName,
498
-      $typeName,
499
-      $expectedTypeName
496
+        'Variable "$%s" of type "%s" used in position expecting type "%s".',
497
+        $variableName,
498
+        $typeName,
499
+        $expectedTypeName
500 500
     );
501 501
 }
502 502
 
@@ -508,12 +508,12 @@  discard block
 block discarded – undo
508 508
  * @return string
509 509
  */
510 510
 function badValueMessage(
511
-  string $typeName,
512
-  string $valueName,
511
+    string $typeName,
512
+    string $valueName,
513 513
   ?string $message = null
514 514
 ): string {
515 515
     return sprintf('Expected type %s, found %s%s', $typeName, $valueName,
516
-      null !== $message ? "; $message" : '.');
516
+        null !== $message ? "; $message" : '.');
517 517
 }
518 518
 
519 519
 /**
@@ -524,12 +524,12 @@  discard block
 block discarded – undo
524 524
  * @return string
525 525
  */
526 526
 function requiredFieldMessage(
527
-  string $typeName,
528
-  string $fieldName,
529
-  string $fieldTypeName
527
+    string $typeName,
528
+    string $fieldName,
529
+    string $fieldTypeName
530 530
 ): string {
531 531
     return sprintf('Field %s.%s of required type %s was not provided.',
532
-      $typeName, $fieldName, $fieldTypeName);
532
+        $typeName, $fieldName, $fieldTypeName);
533 533
 }
534 534
 
535 535
 /**
@@ -540,14 +540,14 @@  discard block
 block discarded – undo
540 540
  * @return string
541 541
  */
542 542
 function unknownFieldMessage(
543
-  string $typeName,
544
-  string $fieldName,
543
+    string $typeName,
544
+    string $fieldName,
545 545
   ?string $message = null
546 546
 ): string {
547 547
     return sprintf(
548
-      'Field %s is not defined by type %s%s',
549
-      $fieldName,
550
-      $typeName,
551
-      null !== $message ? "; $message" : '.'
548
+        'Field %s is not defined by type %s%s',
549
+        $fieldName,
550
+        $typeName,
551
+        null !== $message ? "; $message" : '.'
552 552
     );
553 553
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -257,7 +257,7 @@
 block discarded – undo
257 257
         return conflictReasonMessage([$reason]);
258 258
     }
259 259
 
260
-    return implode(' and ', array_map(function ($reason) {
260
+    return implode(' and ', array_map(function($reason) {
261 261
         [$responseName, $subreason] = $reason;
262 262
         return sprintf('subfields "%s" conflict because %s', $responseName,
263 263
           conflictReasonMessage($subreason));
Please login to merge, or discard this patch.