@@ -25,17 +25,17 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | return [ |
| 27 | 27 | NodeKind::OPERATION_DEFINITION => [ |
| 28 | - 'enter' => static function () use (&$variableNameDefined) { |
|
| 28 | + 'enter' => static function() use (&$variableNameDefined) { |
|
| 29 | 29 | $variableNameDefined = []; |
| 30 | 30 | }, |
| 31 | - 'leave' => static function (OperationDefinitionNode $operation) use (&$variableNameDefined, $context) { |
|
| 31 | + 'leave' => static function(OperationDefinitionNode $operation) use (&$variableNameDefined, $context) { |
|
| 32 | 32 | $usages = $context->getRecursiveVariableUsages($operation); |
| 33 | 33 | |
| 34 | 34 | foreach ($usages as $usage) { |
| 35 | 35 | $node = $usage['node']; |
| 36 | 36 | $varName = $node->name->value; |
| 37 | 37 | |
| 38 | - if (! empty($variableNameDefined[$varName])) { |
|
| 38 | + if (!empty($variableNameDefined[$varName])) { |
|
| 39 | 39 | continue; |
| 40 | 40 | } |
| 41 | 41 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | } |
| 50 | 50 | }, |
| 51 | 51 | ], |
| 52 | - NodeKind::VARIABLE_DEFINITION => static function (VariableDefinitionNode $def) use (&$variableNameDefined) { |
|
| 52 | + NodeKind::VARIABLE_DEFINITION => static function(VariableDefinitionNode $def) use (&$variableNameDefined) { |
|
| 53 | 53 | $variableNameDefined[$def->variable->name->value] = true; |
| 54 | 54 | }, |
| 55 | 55 | ]; |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | $this->cachedFieldsAndFragmentNames = new SplObjectStorage(); |
| 61 | 61 | |
| 62 | 62 | return [ |
| 63 | - NodeKind::SELECTION_SET => function (SelectionSetNode $selectionSet) use ($context) { |
|
| 63 | + NodeKind::SELECTION_SET => function(SelectionSetNode $selectionSet) use ($context) { |
|
| 64 | 64 | $conflicts = $this->findConflictsWithinSelectionSet( |
| 65 | 65 | $context, |
| 66 | 66 | $context->getParentType(), |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | } |
| 260 | 260 | $responseName = $selection->alias ? $selection->alias->value : $fieldName; |
| 261 | 261 | |
| 262 | - if (! isset($astAndDefs[$responseName])) { |
|
| 262 | + if (!isset($astAndDefs[$responseName])) { |
|
| 263 | 263 | $astAndDefs[$responseName] = []; |
| 264 | 264 | } |
| 265 | 265 | $astAndDefs[$responseName][] = [$parentType, $selection, $fieldDef]; |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | $fields[$i], |
| 319 | 319 | $fields[$j] |
| 320 | 320 | ); |
| 321 | - if (! $conflict) { |
|
| 321 | + if (!$conflict) { |
|
| 322 | 322 | continue; |
| 323 | 323 | } |
| 324 | 324 | |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | $type1 = $def1 === null ? null : $def1->getType(); |
| 370 | 370 | $type2 = $def2 === null ? null : $def2->getType(); |
| 371 | 371 | |
| 372 | - if (! $areMutuallyExclusive) { |
|
| 372 | + if (!$areMutuallyExclusive) { |
|
| 373 | 373 | // Two aliases must refer to the same field. |
| 374 | 374 | $name1 = $ast1->name->value; |
| 375 | 375 | $name2 = $ast2->name->value; |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | ]; |
| 382 | 382 | } |
| 383 | 383 | |
| 384 | - if (! $this->sameArguments($ast1->arguments ?: [], $ast2->arguments ?: [])) { |
|
| 384 | + if (!$this->sameArguments($ast1->arguments ?: [], $ast2->arguments ?: [])) { |
|
| 385 | 385 | return [ |
| 386 | 386 | [$responseName, 'they have differing arguments'], |
| 387 | 387 | [$ast1], |
@@ -443,11 +443,11 @@ discard block |
||
| 443 | 443 | break; |
| 444 | 444 | } |
| 445 | 445 | } |
| 446 | - if (! $argument2) { |
|
| 446 | + if (!$argument2) { |
|
| 447 | 447 | return false; |
| 448 | 448 | } |
| 449 | 449 | |
| 450 | - if (! $this->sameValue($argument1->value, $argument2->value)) { |
|
| 450 | + if (!$this->sameValue($argument1->value, $argument2->value)) { |
|
| 451 | 451 | return false; |
| 452 | 452 | } |
| 453 | 453 | } |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | */ |
| 461 | 461 | private function sameValue(Node $value1, Node $value2) |
| 462 | 462 | { |
| 463 | - return (! $value1 && ! $value2) || (Printer::doPrint($value1) === Printer::doPrint($value2)); |
|
| 463 | + return (!$value1 && !$value2) || (Printer::doPrint($value1) === Printer::doPrint($value2)); |
|
| 464 | 464 | } |
| 465 | 465 | |
| 466 | 466 | /** |
@@ -474,23 +474,19 @@ discard block |
||
| 474 | 474 | { |
| 475 | 475 | if ($type1 instanceof ListOfType) { |
| 476 | 476 | return $type2 instanceof ListOfType ? |
| 477 | - $this->doTypesConflict($type1->getWrappedType(), $type2->getWrappedType()) : |
|
| 478 | - true; |
|
| 477 | + $this->doTypesConflict($type1->getWrappedType(), $type2->getWrappedType()) : true; |
|
| 479 | 478 | } |
| 480 | 479 | if ($type2 instanceof ListOfType) { |
| 481 | 480 | return $type1 instanceof ListOfType ? |
| 482 | - $this->doTypesConflict($type1->getWrappedType(), $type2->getWrappedType()) : |
|
| 483 | - true; |
|
| 481 | + $this->doTypesConflict($type1->getWrappedType(), $type2->getWrappedType()) : true; |
|
| 484 | 482 | } |
| 485 | 483 | if ($type1 instanceof NonNull) { |
| 486 | 484 | return $type2 instanceof NonNull ? |
| 487 | - $this->doTypesConflict($type1->getWrappedType(), $type2->getWrappedType()) : |
|
| 488 | - true; |
|
| 485 | + $this->doTypesConflict($type1->getWrappedType(), $type2->getWrappedType()) : true; |
|
| 489 | 486 | } |
| 490 | 487 | if ($type2 instanceof NonNull) { |
| 491 | 488 | return $type1 instanceof NonNull ? |
| 492 | - $this->doTypesConflict($type1->getWrappedType(), $type2->getWrappedType()) : |
|
| 493 | - true; |
|
| 489 | + $this->doTypesConflict($type1->getWrappedType(), $type2->getWrappedType()) : true; |
|
| 494 | 490 | } |
| 495 | 491 | if (Type::isLeafType($type1) || Type::isLeafType($type2)) { |
| 496 | 492 | return $type1 !== $type2; |
@@ -617,7 +613,7 @@ discard block |
||
| 617 | 613 | // maps, each field from the first field map must be compared to every field |
| 618 | 614 | // in the second field map to find potential conflicts. |
| 619 | 615 | foreach ($fieldMap1 as $responseName => $fields1) { |
| 620 | - if (! isset($fieldMap2[$responseName])) { |
|
| 616 | + if (!isset($fieldMap2[$responseName])) { |
|
| 621 | 617 | continue; |
| 622 | 618 | } |
| 623 | 619 | |
@@ -633,7 +629,7 @@ discard block |
||
| 633 | 629 | $fields1[$i], |
| 634 | 630 | $fields2[$j] |
| 635 | 631 | ); |
| 636 | - if (! $conflict) { |
|
| 632 | + if (!$conflict) { |
|
| 637 | 633 | continue; |
| 638 | 634 | } |
| 639 | 635 | |
@@ -667,7 +663,7 @@ discard block |
||
| 667 | 663 | $comparedFragments[$fragmentName] = true; |
| 668 | 664 | |
| 669 | 665 | $fragment = $context->getFragment($fragmentName); |
| 670 | - if (! $fragment) { |
|
| 666 | + if (!$fragment) { |
|
| 671 | 667 | return; |
| 672 | 668 | } |
| 673 | 669 | |
@@ -767,7 +763,7 @@ discard block |
||
| 767 | 763 | |
| 768 | 764 | $fragment1 = $context->getFragment($fragmentName1); |
| 769 | 765 | $fragment2 = $context->getFragment($fragmentName2); |
| 770 | - if (! $fragment1 || ! $fragment2) { |
|
| 766 | + if (!$fragment1 || !$fragment2) { |
|
| 771 | 767 | return; |
| 772 | 768 | } |
| 773 | 769 | |
@@ -840,7 +836,7 @@ discard block |
||
| 840 | 836 | [ |
| 841 | 837 | $responseName, |
| 842 | 838 | array_map( |
| 843 | - static function ($conflict) { |
|
| 839 | + static function($conflict) { |
|
| 844 | 840 | return $conflict[0]; |
| 845 | 841 | }, |
| 846 | 842 | $conflicts |
@@ -848,14 +844,14 @@ discard block |
||
| 848 | 844 | ], |
| 849 | 845 | array_reduce( |
| 850 | 846 | $conflicts, |
| 851 | - static function ($allFields, $conflict) { |
|
| 847 | + static function($allFields, $conflict) { |
|
| 852 | 848 | return array_merge($allFields, $conflict[1]); |
| 853 | 849 | }, |
| 854 | 850 | [$ast1] |
| 855 | 851 | ), |
| 856 | 852 | array_reduce( |
| 857 | 853 | $conflicts, |
| 858 | - static function ($allFields, $conflict) { |
|
| 854 | + static function($allFields, $conflict) { |
|
| 859 | 855 | return array_merge($allFields, $conflict[2]); |
| 860 | 856 | }, |
| 861 | 857 | [$ast2] |
@@ -882,7 +878,7 @@ discard block |
||
| 882 | 878 | { |
| 883 | 879 | if (is_array($reason)) { |
| 884 | 880 | $tmp = array_map( |
| 885 | - static function ($tmp) { |
|
| 881 | + static function($tmp) { |
|
| 886 | 882 | [$responseName, $subReason] = $tmp; |
| 887 | 883 | |
| 888 | 884 | $reasonMessage = self::reasonMessage($subReason); |
@@ -24,10 +24,10 @@ discard block |
||
| 24 | 24 | { |
| 25 | 25 | return [ |
| 26 | 26 | NodeKind::OPERATION_DEFINITION => [ |
| 27 | - 'enter' => function () { |
|
| 27 | + 'enter' => function() { |
|
| 28 | 28 | $this->varDefMap = []; |
| 29 | 29 | }, |
| 30 | - 'leave' => function (OperationDefinitionNode $operation) use ($context) { |
|
| 30 | + 'leave' => function(OperationDefinitionNode $operation) use ($context) { |
|
| 31 | 31 | $usages = $context->getRecursiveVariableUsages($operation); |
| 32 | 32 | |
| 33 | 33 | foreach ($usages as $usage) { |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | $schema = $context->getSchema(); |
| 49 | 49 | $varType = TypeInfo::typeFromAST($schema, $varDef->type); |
| 50 | 50 | |
| 51 | - if (! $varType || TypeComparators::isTypeSubTypeOf( |
|
| 51 | + if (!$varType || TypeComparators::isTypeSubTypeOf( |
|
| 52 | 52 | $schema, |
| 53 | 53 | $this->effectiveType($varType, $varDef), |
| 54 | 54 | $type |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | }, |
| 65 | 65 | ], |
| 66 | - NodeKind::VARIABLE_DEFINITION => function (VariableDefinitionNode $varDefNode) { |
|
| 66 | + NodeKind::VARIABLE_DEFINITION => function(VariableDefinitionNode $varDefNode) { |
|
| 67 | 67 | $this->varDefMap[$varDefNode->variable->name->value] = $varDefNode; |
| 68 | 68 | }, |
| 69 | 69 | ]; |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | private function effectiveType($varType, $varDef) |
| 73 | 73 | { |
| 74 | - return ! $varDef->defaultValue || $varType instanceof NonNull ? $varType : new NonNull($varType); |
|
| 74 | + return !$varDef->defaultValue || $varType instanceof NonNull ? $varType : new NonNull($varType); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
@@ -19,10 +19,10 @@ discard block |
||
| 19 | 19 | { |
| 20 | 20 | return [ |
| 21 | 21 | NodeKind::FIELD => [ |
| 22 | - 'leave' => static function (FieldNode $fieldNode) use ($context) { |
|
| 22 | + 'leave' => static function(FieldNode $fieldNode) use ($context) { |
|
| 23 | 23 | $fieldDef = $context->getFieldDef(); |
| 24 | 24 | |
| 25 | - if (! $fieldDef) { |
|
| 25 | + if (!$fieldDef) { |
|
| 26 | 26 | return Visitor::skipNode(); |
| 27 | 27 | } |
| 28 | 28 | $argNodes = $fieldNode->arguments ?: []; |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | } |
| 34 | 34 | foreach ($fieldDef->args as $argDef) { |
| 35 | 35 | $argNode = $argNodeMap[$argDef->name] ?? null; |
| 36 | - if ($argNode || ! ($argDef->getType() instanceof NonNull)) { |
|
| 36 | + if ($argNode || !($argDef->getType() instanceof NonNull)) { |
|
| 37 | 37 | continue; |
| 38 | 38 | } |
| 39 | 39 | |
@@ -45,9 +45,9 @@ discard block |
||
| 45 | 45 | }, |
| 46 | 46 | ], |
| 47 | 47 | NodeKind::DIRECTIVE => [ |
| 48 | - 'leave' => static function (DirectiveNode $directiveNode) use ($context) { |
|
| 48 | + 'leave' => static function(DirectiveNode $directiveNode) use ($context) { |
|
| 49 | 49 | $directiveDef = $context->getDirective(); |
| 50 | - if (! $directiveDef) { |
|
| 50 | + if (!$directiveDef) { |
|
| 51 | 51 | return Visitor::skipNode(); |
| 52 | 52 | } |
| 53 | 53 | $argNodes = $directiveNode->arguments ?: []; |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | foreach ($directiveDef->args as $argDef) { |
| 60 | 60 | $argNode = $argNodeMap[$argDef->name] ?? null; |
| 61 | - if ($argNode || ! ($argDef->getType() instanceof NonNull)) { |
|
| 61 | + if ($argNode || !($argDef->getType() instanceof NonNull)) { |
|
| 62 | 62 | continue; |
| 63 | 63 | } |
| 64 | 64 | |
@@ -42,10 +42,10 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | foreach ($definedDirectives as $directive) { |
| 44 | 44 | $requiredArgsMap[$directive->name] = Utils::keyMap( |
| 45 | - array_filter($directive->args, static function (FieldArgument $arg) : bool { |
|
| 46 | - return $arg->getType() instanceof NonNull && ! isset($arg->defaultValue); |
|
| 45 | + array_filter($directive->args, static function(FieldArgument $arg) : bool { |
|
| 46 | + return $arg->getType() instanceof NonNull && !isset($arg->defaultValue); |
|
| 47 | 47 | }), |
| 48 | - static function (FieldArgument $arg) : string { |
|
| 48 | + static function(FieldArgument $arg) : string { |
|
| 49 | 49 | return $arg->name; |
| 50 | 50 | } |
| 51 | 51 | ); |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | $astDefinition = $context->getDocument()->definitions; |
| 55 | 55 | foreach ($astDefinition as $def) { |
| 56 | - if (! ($def instanceof DirectiveDefinitionNode)) { |
|
| 56 | + if (!($def instanceof DirectiveDefinitionNode)) { |
|
| 57 | 57 | continue; |
| 58 | 58 | } |
| 59 | 59 | |
@@ -66,31 +66,31 @@ discard block |
||
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | $requiredArgsMap[$def->name->value] = Utils::keyMap( |
| 69 | - $arguments ? array_filter($arguments, static function (Node $argument) : bool { |
|
| 69 | + $arguments ? array_filter($arguments, static function(Node $argument) : bool { |
|
| 70 | 70 | return $argument instanceof NonNullTypeNode && |
| 71 | 71 | ( |
| 72 | - ! isset($argument->defaultValue) || |
|
| 72 | + !isset($argument->defaultValue) || |
|
| 73 | 73 | $argument->defaultValue === null |
| 74 | 74 | ); |
| 75 | 75 | }) : [], |
| 76 | - static function (NamedTypeNode $argument) : string { |
|
| 76 | + static function(NamedTypeNode $argument) : string { |
|
| 77 | 77 | return $argument->name->value; |
| 78 | 78 | } |
| 79 | 79 | ); |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | return [ |
| 83 | - NodeKind::DIRECTIVE => static function (DirectiveNode $directiveNode) use ($requiredArgsMap, $context) { |
|
| 83 | + NodeKind::DIRECTIVE => static function(DirectiveNode $directiveNode) use ($requiredArgsMap, $context) { |
|
| 84 | 84 | $directiveName = $directiveNode->name->value; |
| 85 | 85 | $requiredArgs = $requiredArgsMap[$directiveName] ?? null; |
| 86 | - if (! $requiredArgs) { |
|
| 86 | + if (!$requiredArgs) { |
|
| 87 | 87 | return; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | $argNodes = $directiveNode->arguments ?: []; |
| 91 | 91 | $argNodeMap = Utils::keyMap( |
| 92 | 92 | $argNodes, |
| 93 | - static function (ArgumentNode $arg) : string { |
|
| 93 | + static function(ArgumentNode $arg) : string { |
|
| 94 | 94 | return $arg->name->value; |
| 95 | 95 | } |
| 96 | 96 | ); |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | foreach ($definedDirectives as $directive) { |
| 40 | 40 | $directiveArgs[$directive->name] = array_map( |
| 41 | - static function (FieldArgument $arg) : string { |
|
| 41 | + static function(FieldArgument $arg) : string { |
|
| 42 | 42 | return $arg->name; |
| 43 | 43 | }, |
| 44 | 44 | $directive->args |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | $astDefinitions = $context->getDocument()->definitions; |
| 49 | 49 | foreach ($astDefinitions as $def) { |
| 50 | - if (! ($def instanceof DirectiveDefinitionNode)) { |
|
| 50 | + if (!($def instanceof DirectiveDefinitionNode)) { |
|
| 51 | 51 | continue; |
| 52 | 52 | } |
| 53 | 53 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | $arguments = iterator_to_array($arguments->getIterator()); |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - $directiveArgs[$name] = array_map(static function (InputValueDefinitionNode $arg) : string { |
|
| 62 | + $directiveArgs[$name] = array_map(static function(InputValueDefinitionNode $arg) : string { |
|
| 63 | 63 | return $arg->name->value; |
| 64 | 64 | }, $arguments); |
| 65 | 65 | } else { |
@@ -68,11 +68,11 @@ discard block |
||
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | return [ |
| 71 | - NodeKind::DIRECTIVE => static function (DirectiveNode $directiveNode) use ($directiveArgs, $context) { |
|
| 71 | + NodeKind::DIRECTIVE => static function(DirectiveNode $directiveNode) use ($directiveArgs, $context) { |
|
| 72 | 72 | $directiveName = $directiveNode->name->value; |
| 73 | 73 | $knownArgs = $directiveArgs[$directiveName] ?? null; |
| 74 | 74 | |
| 75 | - if ($directiveNode->arguments === null || ! $knownArgs) { |
|
| 75 | + if ($directiveNode->arguments === null || !$knownArgs) { |
|
| 76 | 76 | return; |
| 77 | 77 | } |
| 78 | 78 | |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | public function getVisitor(ValidationContext $context) |
| 26 | 26 | { |
| 27 | 27 | return [ |
| 28 | - NodeKind::DOCUMENT => static function (DocumentNode $node) use ($context) { |
|
| 28 | + NodeKind::DOCUMENT => static function(DocumentNode $node) use ($context) { |
|
| 29 | 29 | /** @var Node $definition */ |
| 30 | 30 | foreach ($node->definitions as $definition) { |
| 31 | 31 | if ($definition instanceof OperationDefinitionNode || |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | public function getVisitor(ValidationContext $context) |
| 26 | 26 | { |
| 27 | 27 | return [ |
| 28 | - NodeKind::VARIABLE_DEFINITION => static function (VariableDefinitionNode $node) use ($context) { |
|
| 28 | + NodeKind::VARIABLE_DEFINITION => static function(VariableDefinitionNode $node) use ($context) { |
|
| 29 | 29 | $name = $node->variable->name->value; |
| 30 | 30 | $defaultValue = $node->defaultValue; |
| 31 | 31 | $type = $context->getInputType(); |
@@ -44,10 +44,10 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | return Visitor::skipNode(); |
| 46 | 46 | }, |
| 47 | - NodeKind::SELECTION_SET => static function (SelectionSetNode $node) { |
|
| 47 | + NodeKind::SELECTION_SET => static function(SelectionSetNode $node) { |
|
| 48 | 48 | return Visitor::skipNode(); |
| 49 | 49 | }, |
| 50 | - NodeKind::FRAGMENT_DEFINITION => static function (FragmentDefinitionNode $node) { |
|
| 50 | + NodeKind::FRAGMENT_DEFINITION => static function(FragmentDefinitionNode $node) { |
|
| 51 | 51 | return Visitor::skipNode(); |
| 52 | 52 | }, |
| 53 | 53 | ]; |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | public function getVisitor(ValidationContext $context) |
| 16 | 16 | { |
| 17 | 17 | return [ |
| 18 | - NodeKind::FRAGMENT_SPREAD => static function (FragmentSpreadNode $node) use ($context) { |
|
| 18 | + NodeKind::FRAGMENT_SPREAD => static function(FragmentSpreadNode $node) use ($context) { |
|
| 19 | 19 | $fragmentName = $node->name->value; |
| 20 | 20 | $fragment = $context->getFragment($fragmentName); |
| 21 | 21 | if ($fragment) { |