@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | * @inheritdoc |
35 | 35 | */ |
36 | 36 | public function validate( |
37 | - SchemaInterface $schema, |
|
38 | - DocumentNode $document, |
|
37 | + SchemaInterface $schema, |
|
38 | + DocumentNode $document, |
|
39 | 39 | ?array $rules = null, |
40 | 40 | ?TypeInfo $typeInfo = null |
41 | 41 | ): array { |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | }, $rules); |
54 | 54 | |
55 | 55 | $visitor = new TypeInfoVisitor($typeInfo, |
56 | - new ParallelVisitor($visitors)); |
|
56 | + new ParallelVisitor($visitors)); |
|
57 | 57 | |
58 | 58 | // Visit the whole document with each instance of all provided rules. |
59 | 59 | $document->acceptVisitor($visitor); |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | * @return ValidationContextInterface |
70 | 70 | */ |
71 | 71 | public function createContext( |
72 | - SchemaInterface $schema, |
|
73 | - DocumentNode $document, |
|
74 | - TypeInfo $typeInfo |
|
72 | + SchemaInterface $schema, |
|
73 | + DocumentNode $document, |
|
74 | + TypeInfo $typeInfo |
|
75 | 75 | ): ValidationContextInterface { |
76 | 76 | return new ValidationContext($schema, $document, $typeInfo); |
77 | 77 | } |
@@ -109,9 +109,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -725,13 +725,13 @@ |
||
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 | ); |
@@ -57,9 +57,9 @@ |
||
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 |
@@ -34,10 +34,10 @@ |
||
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; |
@@ -33,7 +33,7 @@ |
||
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; |
@@ -23,18 +23,18 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -257,7 +257,7 @@ |
||
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)); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @param callable|null $getFieldDefinitionFunction |
75 | 75 | */ |
76 | 76 | public function __construct( |
77 | - SchemaInterface $schema, |
|
77 | + SchemaInterface $schema, |
|
78 | 78 | ?callable $getFieldDefinitionFunction = null, |
79 | 79 | ?TypeInterface $initialType = null |
80 | 80 | ) { |
@@ -85,9 +85,9 @@ discard block |
||
85 | 85 | SchemaInterface $schema, |
86 | 86 | TypeInterface $parentType, |
87 | 87 | FieldNode $fieldNode |
88 | - ) { |
|
89 | - return getFieldDefinition($schema, $parentType, $fieldNode); |
|
90 | - }; |
|
88 | + ) { |
|
89 | + return getFieldDefinition($schema, $parentType, $fieldNode); |
|
90 | + }; |
|
91 | 91 | |
92 | 92 | if ($initialType instanceof InputTypeInterface) { |
93 | 93 | $this->inputTypeStack[] = $initialType; |
@@ -106,13 +106,13 @@ discard block |
||
106 | 106 | * @return Field|null |
107 | 107 | */ |
108 | 108 | public function resolveFieldDefinition( |
109 | - SchemaInterface $schema, |
|
110 | - TypeInterface $parentType, |
|
111 | - FieldNode $fieldNode |
|
109 | + SchemaInterface $schema, |
|
110 | + TypeInterface $parentType, |
|
111 | + FieldNode $fieldNode |
|
112 | 112 | ): ?Field |
113 | 113 | { |
114 | 114 | return \call_user_func($this->getFieldDefinitionFunction, $schema, |
115 | - $parentType, $fieldNode); |
|
115 | + $parentType, $fieldNode); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -297,9 +297,9 @@ discard block |
||
297 | 297 | * @throws InvalidTypeException |
298 | 298 | */ |
299 | 299 | function getFieldDefinition( |
300 | - SchemaInterface $schema, |
|
301 | - TypeInterface $parentType, |
|
302 | - FieldNode $fieldNode |
|
300 | + SchemaInterface $schema, |
|
301 | + TypeInterface $parentType, |
|
302 | + FieldNode $fieldNode |
|
303 | 303 | ): ?Field |
304 | 304 | { |
305 | 305 | $name = $fieldNode->getNameValue(); |
@@ -81,7 +81,7 @@ |
||
81 | 81 | $this->schema = $schema; |
82 | 82 | $this->getFieldDefinitionFunction = null !== $getFieldDefinitionFunction |
83 | 83 | ? $getFieldDefinitionFunction |
84 | - : function ( |
|
84 | + : function( |
|
85 | 85 | SchemaInterface $schema, |
86 | 86 | TypeInterface $parentType, |
87 | 87 | FieldNode $fieldNode |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | * @return bool |
30 | 30 | */ |
31 | 31 | public function isEqualType( |
32 | - TypeInterface $typeA, |
|
33 | - TypeInterface $typeB |
|
32 | + TypeInterface $typeA, |
|
33 | + TypeInterface $typeB |
|
34 | 34 | ): bool { |
35 | 35 | // Equivalent types are equal. |
36 | 36 | if ($typeA === $typeB) { |
@@ -62,9 +62,9 @@ discard block |
||
62 | 62 | * @return bool |
63 | 63 | */ |
64 | 64 | public function isTypeSubtypeOf( |
65 | - SchemaInterface $schema, |
|
66 | - TypeInterface $maybeSubtype, |
|
67 | - TypeInterface $superType |
|
65 | + SchemaInterface $schema, |
|
66 | + TypeInterface $maybeSubtype, |
|
67 | + TypeInterface $superType |
|
68 | 68 | ): bool { |
69 | 69 | // Equivalent type is a valid subtype. |
70 | 70 | if ($maybeSubtype === $superType) { |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | if ($superType instanceof NonNullType) { |
76 | 76 | if ($maybeSubtype instanceof NonNullType) { |
77 | 77 | return $this->isTypeSubtypeOf($schema, |
78 | - $maybeSubtype->getOfType(), $superType->getOfType()); |
|
78 | + $maybeSubtype->getOfType(), $superType->getOfType()); |
|
79 | 79 | } |
80 | 80 | return false; |
81 | 81 | } |
@@ -83,14 +83,14 @@ discard block |
||
83 | 83 | if ($maybeSubtype instanceof NonNullType) { |
84 | 84 | // If superType is nullable, maybeSubType may be non-null or nullable. |
85 | 85 | return $this->isTypeSubtypeOf($schema, $maybeSubtype->getOfType(), |
86 | - $superType); |
|
86 | + $superType); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | // If superType type is a list, maybeSubType type must also be a list. |
90 | 90 | if ($superType instanceof ListType) { |
91 | 91 | if ($maybeSubtype instanceof ListType) { |
92 | 92 | return $this->isTypeSubtypeOf($schema, |
93 | - $maybeSubtype->getOfType(), $superType->getOfType()); |
|
93 | + $maybeSubtype->getOfType(), $superType->getOfType()); |
|
94 | 94 | } |
95 | 95 | return false; |
96 | 96 | } |
@@ -127,9 +127,9 @@ discard block |
||
127 | 127 | * @return bool |
128 | 128 | */ |
129 | 129 | public function doTypesOverlap( |
130 | - SchemaInterface $schema, |
|
131 | - TypeInterface $typeA, |
|
132 | - TypeInterface $typeB |
|
130 | + SchemaInterface $schema, |
|
131 | + TypeInterface $typeA, |
|
132 | + TypeInterface $typeB |
|
133 | 133 | ): bool { |
134 | 134 | // Equivalent types overlap |
135 | 135 | if ($typeA === $typeB) { |
@@ -141,9 +141,9 @@ discard block |
||
141 | 141 | // If both types are abstract, then determine if there is any intersection |
142 | 142 | // between possible concrete types of each. |
143 | 143 | return arraySome($schema->getPossibleTypes($typeA), |
144 | - function (TypeInterface $type) use ($schema, $typeB) { |
|
145 | - return $schema->isPossibleType($typeB, $type); |
|
146 | - }); |
|
144 | + function (TypeInterface $type) use ($schema, $typeB) { |
|
145 | + return $schema->isPossibleType($typeB, $type); |
|
146 | + }); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | // Determine if the latter type is a possible concrete type of the former. |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | * @return bool |
174 | 174 | */ |
175 | 175 | public function compareTypes( |
176 | - TypeInterface $typeA, |
|
177 | - TypeInterface $typeB |
|
176 | + TypeInterface $typeA, |
|
177 | + TypeInterface $typeB |
|
178 | 178 | ): bool { |
179 | 179 | if ($typeA instanceof ListType) { |
180 | 180 | return $typeB instanceof ListType |
@@ -212,8 +212,8 @@ discard block |
||
212 | 212 | * @throws InvalidTypeException |
213 | 213 | */ |
214 | 214 | public function fromAST( |
215 | - SchemaInterface $schema, |
|
216 | - TypeNodeInterface $typeNode |
|
215 | + SchemaInterface $schema, |
|
216 | + TypeNodeInterface $typeNode |
|
217 | 217 | ): ?TypeInterface |
218 | 218 | { |
219 | 219 | $innerType = null; |
@@ -233,6 +233,6 @@ discard block |
||
233 | 233 | } |
234 | 234 | |
235 | 235 | throw new InvalidTypeException(sprintf('Unexpected type kind: %s', |
236 | - $typeNode->getKind())); |
|
236 | + $typeNode->getKind())); |
|
237 | 237 | } |
238 | 238 | } |
@@ -141,7 +141,7 @@ |
||
141 | 141 | // If both types are abstract, then determine if there is any intersection |
142 | 142 | // between possible concrete types of each. |
143 | 143 | return arraySome($schema->getPossibleTypes($typeA), |
144 | - function (TypeInterface $type) use ($schema, $typeB) { |
|
144 | + function(TypeInterface $type) use ($schema, $typeB) { |
|
145 | 145 | return $schema->isPossibleType($typeB, $type); |
146 | 146 | }); |
147 | 147 | } |
@@ -39,19 +39,19 @@ discard block |
||
39 | 39 | } |
40 | 40 | |
41 | 41 | return arrayEvery($argumentsA, |
42 | - function (ArgumentNode $argumentA) use ($argumentsB) { |
|
43 | - $argumentB = find($argumentsB, |
|
42 | + function (ArgumentNode $argumentA) use ($argumentsB) { |
|
43 | + $argumentB = find($argumentsB, |
|
44 | 44 | function (ArgumentNode $argument) use ($argumentA) { |
45 | 45 | return $argument->getNameValue() === $argumentA->getNameValue(); |
46 | 46 | }); |
47 | 47 | |
48 | - if (null === $argumentB) { |
|
49 | - return false; |
|
50 | - } |
|
48 | + if (null === $argumentB) { |
|
49 | + return false; |
|
50 | + } |
|
51 | 51 | |
52 | - return $this->compareValues($argumentA->getValue(), |
|
52 | + return $this->compareValues($argumentA->getValue(), |
|
53 | 53 | $argumentB->getValue()); |
54 | - }); |
|
54 | + }); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -95,8 +95,8 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function fromAST( |
97 | 97 | ?NodeInterface $node, |
98 | - TypeInterface $type, |
|
99 | - array $variables = [] |
|
98 | + TypeInterface $type, |
|
99 | + array $variables = [] |
|
100 | 100 | ) { |
101 | 101 | if (null === $node) { |
102 | 102 | throw new ResolutionException('Node is not defined.'); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | |
117 | 117 | if (!isset($variables[$variableName])) { |
118 | 118 | throw new ResolutionException( |
119 | - \sprintf('Cannot resolve value for missing variable "%s".', |
|
119 | + \sprintf('Cannot resolve value for missing variable "%s".', |
|
120 | 120 | $variableName) |
121 | 121 | ); |
122 | 122 | } |
@@ -157,9 +157,9 @@ discard block |
||
157 | 157 | * @throws ResolutionException |
158 | 158 | */ |
159 | 159 | protected function resolveNonNullType( |
160 | - NodeInterface $node, |
|
161 | - NonNullType $type, |
|
162 | - array $variables = [] |
|
160 | + NodeInterface $node, |
|
161 | + NonNullType $type, |
|
162 | + array $variables = [] |
|
163 | 163 | ) { |
164 | 164 | if ($node instanceof NullValueNode) { |
165 | 165 | throw new ResolutionException('Cannot resolve non-null values from null value node.'); |
@@ -178,9 +178,9 @@ discard block |
||
178 | 178 | * @throws ResolutionException |
179 | 179 | */ |
180 | 180 | protected function resolveListType( |
181 | - NodeInterface $node, |
|
182 | - ListType $type, |
|
183 | - array $variables = [] |
|
181 | + NodeInterface $node, |
|
182 | + ListType $type, |
|
183 | + array $variables = [] |
|
184 | 184 | ) { |
185 | 185 | $itemType = $type->getOfType(); |
186 | 186 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | $resolvedValues[] = null; |
199 | 199 | } else { |
200 | 200 | $resolvedValues[] = $this->fromAST($value, $itemType, |
201 | - $variables); |
|
201 | + $variables); |
|
202 | 202 | } |
203 | 203 | } |
204 | 204 | |
@@ -215,8 +215,8 @@ discard block |
||
215 | 215 | * @return bool |
216 | 216 | */ |
217 | 217 | protected function isMissingVariable( |
218 | - ValueNodeInterface $node, |
|
219 | - array $variables |
|
218 | + ValueNodeInterface $node, |
|
219 | + array $variables |
|
220 | 220 | ): bool { |
221 | 221 | return $node instanceof VariableNode && !isset($variables[$node->getNameValue()]); |
222 | 222 | } |
@@ -232,9 +232,9 @@ discard block |
||
232 | 232 | * @throws ResolutionException |
233 | 233 | */ |
234 | 234 | protected function resolveInputObjectType( |
235 | - NodeInterface $node, |
|
236 | - InputObjectType $type, |
|
237 | - array $variables = [] |
|
235 | + NodeInterface $node, |
|
236 | + InputObjectType $type, |
|
237 | + array $variables = [] |
|
238 | 238 | ) { |
239 | 239 | if (!$node instanceof ObjectValueNode) { |
240 | 240 | throw new ResolutionException('Input object values can only be resolved form object value nodes.'); |
@@ -244,9 +244,9 @@ discard block |
||
244 | 244 | |
245 | 245 | /** @var ObjectFieldNode[] $fieldNodes */ |
246 | 246 | $fieldNodes = keyMap($node->getFields(), |
247 | - function (ObjectFieldNode $value) { |
|
248 | - return $value->getNameValue(); |
|
249 | - }); |
|
247 | + function (ObjectFieldNode $value) { |
|
248 | + return $value->getNameValue(); |
|
249 | + }); |
|
250 | 250 | |
251 | 251 | foreach ($type->getFields() as $field) { |
252 | 252 | $name = $field->getName(); |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | } |
264 | 264 | |
265 | 265 | $fieldValue = $this->fromAST($fieldNode->getValue(), |
266 | - $field->getType(), $variables); |
|
266 | + $field->getType(), $variables); |
|
267 | 267 | |
268 | 268 | $resolvedValues[$name] = $fieldValue; |
269 | 269 | } |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | |
292 | 292 | if (null === $enumValue) { |
293 | 293 | throw new ResolutionException(\sprintf('Cannot resolve enum value for missing value "%s".', |
294 | - $name)); |
|
294 | + $name)); |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | return $enumValue->getValue(); |
@@ -306,9 +306,9 @@ discard block |
||
306 | 306 | * @throws ResolutionException |
307 | 307 | */ |
308 | 308 | protected function resolveScalarType( |
309 | - NodeInterface $node, |
|
310 | - ScalarType $type, |
|
311 | - array $variables = [] |
|
309 | + NodeInterface $node, |
|
310 | + ScalarType $type, |
|
311 | + array $variables = [] |
|
312 | 312 | ) { |
313 | 313 | // Scalars fulfill parsing a literal value via parseLiteral(). |
314 | 314 | // Invalid values represent a failure to parse correctly, in which case |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | |
324 | 324 | if (null === $result) { |
325 | 325 | throw new ResolutionException(\sprintf('Failed to parse literal for scalar type "%s".', |
326 | - (string)$type)); |
|
326 | + (string)$type)); |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | return $result; |
@@ -39,9 +39,9 @@ discard block |
||
39 | 39 | } |
40 | 40 | |
41 | 41 | return arrayEvery($argumentsA, |
42 | - function (ArgumentNode $argumentA) use ($argumentsB) { |
|
42 | + function(ArgumentNode $argumentA) use ($argumentsB) { |
|
43 | 43 | $argumentB = find($argumentsB, |
44 | - function (ArgumentNode $argument) use ($argumentA) { |
|
44 | + function(ArgumentNode $argument) use ($argumentA) { |
|
45 | 45 | return $argument->getNameValue() === $argumentA->getNameValue(); |
46 | 46 | }); |
47 | 47 | |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | |
245 | 245 | /** @var ObjectFieldNode[] $fieldNodes */ |
246 | 246 | $fieldNodes = keyMap($node->getFields(), |
247 | - function (ObjectFieldNode $value) { |
|
247 | + function(ObjectFieldNode $value) { |
|
248 | 248 | return $value->getNameValue(); |
249 | 249 | }); |
250 | 250 |