@@ -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 FragmentDefinitionNode|OperationDefinitionNode|TypeSystemDefinitionNode $definition */ |
| 30 | 30 | foreach ($node->definitions as $definition) { |
| 31 | 31 | if ($definition instanceof OperationDefinitionNode || |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | protected function invokeIfNeeded(ValidationContext $context, array $validators) |
| 64 | 64 | { |
| 65 | 65 | // is disabled? |
| 66 | - if (! $this->isEnabled()) { |
|
| 66 | + if (!$this->isEnabled()) { |
|
| 67 | 67 | return []; |
| 68 | 68 | } |
| 69 | 69 | |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | // Importantly this does not include inline fragments. |
| 81 | 81 | $definitions = $context->getDocument()->definitions; |
| 82 | 82 | foreach ($definitions as $node) { |
| 83 | - if (! ($node instanceof FragmentDefinitionNode)) { |
|
| 83 | + if (!($node instanceof FragmentDefinitionNode)) { |
|
| 84 | 84 | continue; |
| 85 | 85 | } |
| 86 | 86 | |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | } |
| 135 | 135 | } |
| 136 | 136 | $responseName = $this->getFieldName($selection); |
| 137 | - if (! isset($_astAndDefs[$responseName])) { |
|
| 137 | + if (!isset($_astAndDefs[$responseName])) { |
|
| 138 | 138 | $_astAndDefs[$responseName] = new ArrayObject(); |
| 139 | 139 | } |
| 140 | 140 | // create field context |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | public function getVisitor(ValidationContext $context) |
| 29 | 29 | { |
| 30 | 30 | return [ |
| 31 | - NodeKind::ARGUMENT => static function (ArgumentNode $node, $key, $parent, $path, $ancestors) use ($context) { |
|
| 31 | + NodeKind::ARGUMENT => static function(ArgumentNode $node, $key, $parent, $path, $ancestors) use ($context) { |
|
| 32 | 32 | $argDef = $context->getArgument(); |
| 33 | 33 | if ($argDef !== null) { |
| 34 | 34 | return null; |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | Utils::suggestionList( |
| 49 | 49 | $node->name->value, |
| 50 | 50 | array_map( |
| 51 | - static function ($arg) { |
|
| 51 | + static function($arg) { |
|
| 52 | 52 | return $arg->name; |
| 53 | 53 | }, |
| 54 | 54 | $fieldDef->args |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | Utils::suggestionList( |
| 69 | 69 | $node->name->value, |
| 70 | 70 | array_map( |
| 71 | - static function ($arg) { |
|
| 71 | + static function($arg) { |
|
| 72 | 72 | return $arg->name; |
| 73 | 73 | }, |
| 74 | 74 | $directive->args |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | public static function unknownArgMessage($argName, $fieldName, $typeName, array $suggestedArgs) |
| 90 | 90 | { |
| 91 | 91 | $message = sprintf('Unknown argument "%s" on field "%s" of type "%s".', $argName, $fieldName, $typeName); |
| 92 | - if (! empty($suggestedArgs)) { |
|
| 92 | + if (!empty($suggestedArgs)) { |
|
| 93 | 93 | $message .= sprintf(' Did you mean %s?', Utils::quotedOrList($suggestedArgs)); |
| 94 | 94 | } |
| 95 | 95 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | public static function unknownDirectiveArgMessage($argName, $directiveName, array $suggestedArgs) |
| 103 | 103 | { |
| 104 | 104 | $message = sprintf('Unknown argument "%s" on directive "@%s".', $argName, $directiveName); |
| 105 | - if (! empty($suggestedArgs)) { |
|
| 105 | + if (!empty($suggestedArgs)) { |
|
| 106 | 106 | $message .= sprintf(' Did you mean %s?', Utils::quotedOrList($suggestedArgs)); |
| 107 | 107 | } |
| 108 | 108 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | $this->cachedFieldsAndFragmentNames = new SplObjectStorage(); |
| 60 | 60 | |
| 61 | 61 | return [ |
| 62 | - NodeKind::SELECTION_SET => function (SelectionSetNode $selectionSet) use ($context) { |
|
| 62 | + NodeKind::SELECTION_SET => function(SelectionSetNode $selectionSet) use ($context) { |
|
| 63 | 63 | $conflicts = $this->findConflictsWithinSelectionSet( |
| 64 | 64 | $context, |
| 65 | 65 | $context->getParentType(), |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | } |
| 259 | 259 | $responseName = $selection->alias ? $selection->alias->value : $fieldName; |
| 260 | 260 | |
| 261 | - if (! isset($astAndDefs[$responseName])) { |
|
| 261 | + if (!isset($astAndDefs[$responseName])) { |
|
| 262 | 262 | $astAndDefs[$responseName] = []; |
| 263 | 263 | } |
| 264 | 264 | $astAndDefs[$responseName][] = [$parentType, $selection, $fieldDef]; |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | $fields[$i], |
| 318 | 318 | $fields[$j] |
| 319 | 319 | ); |
| 320 | - if (! $conflict) { |
|
| 320 | + if (!$conflict) { |
|
| 321 | 321 | continue; |
| 322 | 322 | } |
| 323 | 323 | |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | $type1 = $def1 === null ? null : $def1->getType(); |
| 369 | 369 | $type2 = $def2 === null ? null : $def2->getType(); |
| 370 | 370 | |
| 371 | - if (! $areMutuallyExclusive) { |
|
| 371 | + if (!$areMutuallyExclusive) { |
|
| 372 | 372 | // Two aliases must refer to the same field. |
| 373 | 373 | $name1 = $ast1->name->value; |
| 374 | 374 | $name2 = $ast2->name->value; |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | ]; |
| 381 | 381 | } |
| 382 | 382 | |
| 383 | - if (! $this->sameArguments($ast1->arguments ?: [], $ast2->arguments ?: [])) { |
|
| 383 | + if (!$this->sameArguments($ast1->arguments ?: [], $ast2->arguments ?: [])) { |
|
| 384 | 384 | return [ |
| 385 | 385 | [$responseName, 'they have differing arguments'], |
| 386 | 386 | [$ast1], |
@@ -442,11 +442,11 @@ discard block |
||
| 442 | 442 | break; |
| 443 | 443 | } |
| 444 | 444 | } |
| 445 | - if (! $argument2) { |
|
| 445 | + if (!$argument2) { |
|
| 446 | 446 | return false; |
| 447 | 447 | } |
| 448 | 448 | |
| 449 | - if (! $this->sameValue($argument1->value, $argument2->value)) { |
|
| 449 | + if (!$this->sameValue($argument1->value, $argument2->value)) { |
|
| 450 | 450 | return false; |
| 451 | 451 | } |
| 452 | 452 | } |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | */ |
| 460 | 460 | private function sameValue(Node $value1, Node $value2) |
| 461 | 461 | { |
| 462 | - return (! $value1 && ! $value2) || (Printer::doPrint($value1) === Printer::doPrint($value2)); |
|
| 462 | + return (!$value1 && !$value2) || (Printer::doPrint($value1) === Printer::doPrint($value2)); |
|
| 463 | 463 | } |
| 464 | 464 | |
| 465 | 465 | /** |
@@ -614,7 +614,7 @@ discard block |
||
| 614 | 614 | // maps, each field from the first field map must be compared to every field |
| 615 | 615 | // in the second field map to find potential conflicts. |
| 616 | 616 | foreach ($fieldMap1 as $responseName => $fields1) { |
| 617 | - if (! isset($fieldMap2[$responseName])) { |
|
| 617 | + if (!isset($fieldMap2[$responseName])) { |
|
| 618 | 618 | continue; |
| 619 | 619 | } |
| 620 | 620 | |
@@ -630,7 +630,7 @@ discard block |
||
| 630 | 630 | $fields1[$i], |
| 631 | 631 | $fields2[$j] |
| 632 | 632 | ); |
| 633 | - if (! $conflict) { |
|
| 633 | + if (!$conflict) { |
|
| 634 | 634 | continue; |
| 635 | 635 | } |
| 636 | 636 | |
@@ -664,7 +664,7 @@ discard block |
||
| 664 | 664 | $comparedFragments[$fragmentName] = true; |
| 665 | 665 | |
| 666 | 666 | $fragment = $context->getFragment($fragmentName); |
| 667 | - if (! $fragment) { |
|
| 667 | + if (!$fragment) { |
|
| 668 | 668 | return; |
| 669 | 669 | } |
| 670 | 670 | |
@@ -764,7 +764,7 @@ discard block |
||
| 764 | 764 | |
| 765 | 765 | $fragment1 = $context->getFragment($fragmentName1); |
| 766 | 766 | $fragment2 = $context->getFragment($fragmentName2); |
| 767 | - if (! $fragment1 || ! $fragment2) { |
|
| 767 | + if (!$fragment1 || !$fragment2) { |
|
| 768 | 768 | return; |
| 769 | 769 | } |
| 770 | 770 | |
@@ -837,7 +837,7 @@ discard block |
||
| 837 | 837 | [ |
| 838 | 838 | $responseName, |
| 839 | 839 | array_map( |
| 840 | - static function ($conflict) { |
|
| 840 | + static function($conflict) { |
|
| 841 | 841 | return $conflict[0]; |
| 842 | 842 | }, |
| 843 | 843 | $conflicts |
@@ -845,14 +845,14 @@ discard block |
||
| 845 | 845 | ], |
| 846 | 846 | array_reduce( |
| 847 | 847 | $conflicts, |
| 848 | - static function ($allFields, $conflict) { |
|
| 848 | + static function($allFields, $conflict) { |
|
| 849 | 849 | return array_merge($allFields, $conflict[1]); |
| 850 | 850 | }, |
| 851 | 851 | [$ast1] |
| 852 | 852 | ), |
| 853 | 853 | array_reduce( |
| 854 | 854 | $conflicts, |
| 855 | - static function ($allFields, $conflict) { |
|
| 855 | + static function($allFields, $conflict) { |
|
| 856 | 856 | return array_merge($allFields, $conflict[2]); |
| 857 | 857 | }, |
| 858 | 858 | [$ast2] |
@@ -879,7 +879,7 @@ discard block |
||
| 879 | 879 | { |
| 880 | 880 | if (is_array($reason)) { |
| 881 | 881 | $tmp = array_map( |
| 882 | - static function ($tmp) { |
|
| 882 | + static function($tmp) { |
|
| 883 | 883 | [$responseName, $subReason] = $tmp; |
| 884 | 884 | |
| 885 | 885 | $reasonMessage = self::reasonMessage($subReason); |
@@ -19,13 +19,13 @@ discard block |
||
| 19 | 19 | public function getVisitor(ValidationContext $context) |
| 20 | 20 | { |
| 21 | 21 | return [ |
| 22 | - NodeKind::INLINE_FRAGMENT => static function (InlineFragmentNode $node) use ($context) { |
|
| 23 | - if (! $node->typeCondition) { |
|
| 22 | + NodeKind::INLINE_FRAGMENT => static function(InlineFragmentNode $node) use ($context) { |
|
| 23 | + if (!$node->typeCondition) { |
|
| 24 | 24 | return; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | $type = TypeInfo::typeFromAST($context->getSchema(), $node->typeCondition); |
| 28 | - if (! $type || Type::isCompositeType($type)) { |
|
| 28 | + if (!$type || Type::isCompositeType($type)) { |
|
| 29 | 29 | return; |
| 30 | 30 | } |
| 31 | 31 | |
@@ -34,10 +34,10 @@ discard block |
||
| 34 | 34 | [$node->typeCondition] |
| 35 | 35 | )); |
| 36 | 36 | }, |
| 37 | - NodeKind::FRAGMENT_DEFINITION => static function (FragmentDefinitionNode $node) use ($context) { |
|
| 37 | + NodeKind::FRAGMENT_DEFINITION => static function(FragmentDefinitionNode $node) use ($context) { |
|
| 38 | 38 | $type = TypeInfo::typeFromAST($context->getSchema(), $node->typeCondition); |
| 39 | 39 | |
| 40 | - if (! $type || Type::isCompositeType($type)) { |
|
| 40 | + if (!$type || Type::isCompositeType($type)) { |
|
| 41 | 41 | return; |
| 42 | 42 | } |
| 43 | 43 | |
@@ -23,17 +23,17 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | return [ |
| 25 | 25 | NodeKind::OPERATION_DEFINITION => [ |
| 26 | - 'enter' => static function () use (&$variableNameDefined) { |
|
| 26 | + 'enter' => static function() use (&$variableNameDefined) { |
|
| 27 | 27 | $variableNameDefined = []; |
| 28 | 28 | }, |
| 29 | - 'leave' => static function (OperationDefinitionNode $operation) use (&$variableNameDefined, $context) { |
|
| 29 | + 'leave' => static function(OperationDefinitionNode $operation) use (&$variableNameDefined, $context) { |
|
| 30 | 30 | $usages = $context->getRecursiveVariableUsages($operation); |
| 31 | 31 | |
| 32 | 32 | foreach ($usages as $usage) { |
| 33 | 33 | $node = $usage['node']; |
| 34 | 34 | $varName = $node->name->value; |
| 35 | 35 | |
| 36 | - if (! empty($variableNameDefined[$varName])) { |
|
| 36 | + if (!empty($variableNameDefined[$varName])) { |
|
| 37 | 37 | continue; |
| 38 | 38 | } |
| 39 | 39 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | } |
| 48 | 48 | }, |
| 49 | 49 | ], |
| 50 | - NodeKind::VARIABLE_DEFINITION => static function (VariableDefinitionNode $def) use (&$variableNameDefined) { |
|
| 50 | + NodeKind::VARIABLE_DEFINITION => static function(VariableDefinitionNode $def) use (&$variableNameDefined) { |
|
| 51 | 51 | $variableNameDefined[$def->variable->name->value] = true; |
| 52 | 52 | }, |
| 53 | 53 | ]; |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | $schemaDefinitionsCount = 0; |
| 42 | 42 | |
| 43 | 43 | return [ |
| 44 | - NodeKind::SCHEMA_DEFINITION => static function (SchemaDefinitionNode $node) use ($alreadyDefined, $context, &$schemaDefinitionsCount) { |
|
| 44 | + NodeKind::SCHEMA_DEFINITION => static function(SchemaDefinitionNode $node) use ($alreadyDefined, $context, &$schemaDefinitionsCount) { |
|
| 45 | 45 | if ($alreadyDefined !== false) { |
| 46 | 46 | $context->reportError(new Error(self::canNotDefineSchemaWithinExtensionMessage(), $node)); |
| 47 | 47 | |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | { |
| 24 | 24 | public function getVisitor(ValidationContext $context) |
| 25 | 25 | { |
| 26 | - $skip = static function () { |
|
| 26 | + $skip = static function() { |
|
| 27 | 27 | return Visitor::skipNode(); |
| 28 | 28 | }; |
| 29 | 29 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | NodeKind::INTERFACE_TYPE_DEFINITION => $skip, |
| 36 | 36 | NodeKind::UNION_TYPE_DEFINITION => $skip, |
| 37 | 37 | NodeKind::INPUT_OBJECT_TYPE_DEFINITION => $skip, |
| 38 | - NodeKind::NAMED_TYPE => static function (NamedTypeNode $node) use ($context) { |
|
| 38 | + NodeKind::NAMED_TYPE => static function(NamedTypeNode $node) use ($context) { |
|
| 39 | 39 | $schema = $context->getSchema(); |
| 40 | 40 | $typeName = $node->name->value; |
| 41 | 41 | $type = $schema->getType($typeName); |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | public static function unknownTypeMessage($type, array $suggestedTypes) |
| 62 | 62 | { |
| 63 | 63 | $message = sprintf('Unknown type "%s".', $type); |
| 64 | - if (! empty($suggestedTypes)) { |
|
| 64 | + if (!empty($suggestedTypes)) { |
|
| 65 | 65 | $suggestions = Utils::quotedOrList($suggestedTypes); |
| 66 | 66 | |
| 67 | 67 | $message .= sprintf(' Did you mean %s?', $suggestions); |
@@ -22,10 +22,10 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | return [ |
| 24 | 24 | NodeKind::OPERATION_DEFINITION => [ |
| 25 | - 'enter' => function () { |
|
| 25 | + 'enter' => function() { |
|
| 26 | 26 | $this->variableDefs = []; |
| 27 | 27 | }, |
| 28 | - 'leave' => function (OperationDefinitionNode $operation) use ($context) { |
|
| 28 | + 'leave' => function(OperationDefinitionNode $operation) use ($context) { |
|
| 29 | 29 | $variableNameUsed = []; |
| 30 | 30 | $usages = $context->getRecursiveVariableUsages($operation); |
| 31 | 31 | $opName = $operation->name ? $operation->name->value : null; |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | foreach ($this->variableDefs as $variableDef) { |
| 39 | 39 | $variableName = $variableDef->variable->name->value; |
| 40 | 40 | |
| 41 | - if (! empty($variableNameUsed[$variableName])) { |
|
| 41 | + if (!empty($variableNameUsed[$variableName])) { |
|
| 42 | 42 | continue; |
| 43 | 43 | } |
| 44 | 44 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | } |
| 50 | 50 | }, |
| 51 | 51 | ], |
| 52 | - NodeKind::VARIABLE_DEFINITION => function ($def) { |
|
| 52 | + NodeKind::VARIABLE_DEFINITION => function($def) { |
|
| 53 | 53 | $this->variableDefs[] = $def; |
| 54 | 54 | }, |
| 55 | 55 | ]; |