@@ -15,7 +15,7 @@ |
||
15 | 15 | public function getVisitor(ValidationContext $context) |
16 | 16 | { |
17 | 17 | return [ |
18 | - NodeKind::FRAGMENT_SPREAD => function (FragmentSpreadNode $node) use ($context) { |
|
18 | + NodeKind::FRAGMENT_SPREAD => function(FragmentSpreadNode $node) use ($context) { |
|
19 | 19 | $fragmentName = $node->name->value; |
20 | 20 | $fragment = $context->getFragment($fragmentName); |
21 | 21 | if ($fragment) { |
@@ -31,7 +31,7 @@ |
||
31 | 31 | return $this->invokeIfNeeded( |
32 | 32 | $context, |
33 | 33 | [ |
34 | - NodeKind::FIELD => function (FieldNode $node) use ($context) { |
|
34 | + NodeKind::FIELD => function(FieldNode $node) use ($context) { |
|
35 | 35 | if ($node->name->value !== '__type' && $node->name->value !== '__schema') { |
36 | 36 | return; |
37 | 37 | } |
@@ -22,15 +22,15 @@ |
||
22 | 22 | $this->knownArgNames = []; |
23 | 23 | |
24 | 24 | return [ |
25 | - NodeKind::FIELD => function () { |
|
25 | + NodeKind::FIELD => function() { |
|
26 | 26 | $this->knownArgNames = []; |
27 | 27 | }, |
28 | - NodeKind::DIRECTIVE => function () { |
|
28 | + NodeKind::DIRECTIVE => function() { |
|
29 | 29 | $this->knownArgNames = []; |
30 | 30 | }, |
31 | - NodeKind::ARGUMENT => function (ArgumentNode $node) use ($context) { |
|
31 | + NodeKind::ARGUMENT => function(ArgumentNode $node) use ($context) { |
|
32 | 32 | $argName = $node->name->value; |
33 | - if (! empty($this->knownArgNames[$argName])) { |
|
33 | + if (!empty($this->knownArgNames[$argName])) { |
|
34 | 34 | $context->reportError(new Error( |
35 | 35 | self::duplicateArgMessage($argName), |
36 | 36 | [$this->knownArgNames[$argName], $node->name] |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | { |
24 | 24 | public function getVisitor(ValidationContext $context) |
25 | 25 | { |
26 | - $skip = function () { |
|
26 | + $skip = 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 => function (NamedTypeNode $node) use ($context) { |
|
38 | + NodeKind::NAMED_TYPE => 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); |
@@ -25,7 +25,7 @@ |
||
25 | 25 | public function getVisitor(ValidationContext $context) |
26 | 26 | { |
27 | 27 | return [ |
28 | - NodeKind::DOCUMENT => function (DocumentNode $node) use ($context) { |
|
28 | + NodeKind::DOCUMENT => function(DocumentNode $node) use ($context) { |
|
29 | 29 | /** @var Node $definition */ |
30 | 30 | foreach ($node->definitions as $definition) { |
31 | 31 | if ($definition instanceof OperationDefinitionNode || |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | public function getVisitor(ValidationContext $context) |
20 | 20 | { |
21 | 21 | return [ |
22 | - NodeKind::DIRECTIVE => function (DirectiveNode $node, $key, $parent, $path, $ancestors) use ($context) { |
|
22 | + NodeKind::DIRECTIVE => function(DirectiveNode $node, $key, $parent, $path, $ancestors) use ($context) { |
|
23 | 23 | $directiveDef = null; |
24 | 24 | foreach ($context->getSchema()->getDirectives() as $def) { |
25 | 25 | if ($def->name === $node->name->value) { |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | } |
29 | 29 | } |
30 | 30 | |
31 | - if (! $directiveDef) { |
|
31 | + if (!$directiveDef) { |
|
32 | 32 | $context->reportError(new Error( |
33 | 33 | self::unknownDirectiveMessage($node->name->value), |
34 | 34 | [$node] |
@@ -38,12 +38,12 @@ discard block |
||
38 | 38 | } |
39 | 39 | $candidateLocation = $this->getDirectiveLocationForASTPath($ancestors); |
40 | 40 | |
41 | - if (! $candidateLocation) { |
|
41 | + if (!$candidateLocation) { |
|
42 | 42 | $context->reportError(new Error( |
43 | 43 | self::misplacedDirectiveMessage($node->name->value, $node->type), |
44 | 44 | [$node] |
45 | 45 | )); |
46 | - } elseif (! in_array($candidateLocation, $directiveDef->locations)) { |
|
46 | + } elseif (!in_array($candidateLocation, $directiveDef->locations)) { |
|
47 | 47 | $context->reportError(new Error( |
48 | 48 | self::misplacedDirectiveMessage($node->name->value, $candidateLocation), |
49 | 49 | [$node] |
@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | public function getVisitor(ValidationContext $context) |
24 | 24 | { |
25 | 25 | return [ |
26 | - NodeKind::FIELD => function (FieldNode $node) use ($context) { |
|
26 | + NodeKind::FIELD => function(FieldNode $node) use ($context) { |
|
27 | 27 | $type = $context->getParentType(); |
28 | - if (! $type) { |
|
28 | + if (!$type) { |
|
29 | 29 | return; |
30 | 30 | } |
31 | 31 | |
@@ -84,19 +84,19 @@ discard block |
||
84 | 84 | |
85 | 85 | foreach ($schema->getPossibleTypes($type) as $possibleType) { |
86 | 86 | $fields = $possibleType->getFields(); |
87 | - if (! isset($fields[$fieldName])) { |
|
87 | + if (!isset($fields[$fieldName])) { |
|
88 | 88 | continue; |
89 | 89 | } |
90 | 90 | // This object type defines this field. |
91 | 91 | $suggestedObjectTypes[] = $possibleType->name; |
92 | 92 | foreach ($possibleType->getInterfaces() as $possibleInterface) { |
93 | 93 | $fields = $possibleInterface->getFields(); |
94 | - if (! isset($fields[$fieldName])) { |
|
94 | + if (!isset($fields[$fieldName])) { |
|
95 | 95 | continue; |
96 | 96 | } |
97 | 97 | // This interface type defines this field. |
98 | 98 | $interfaceUsageCount[$possibleInterface->name] = |
99 | - ! isset($interfaceUsageCount[$possibleInterface->name]) |
|
99 | + !isset($interfaceUsageCount[$possibleInterface->name]) |
|
100 | 100 | ? 0 |
101 | 101 | : $interfaceUsageCount[$possibleInterface->name] + 1; |
102 | 102 | } |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | $suggestions = Utils::quotedOrList($suggestedTypeNames); |
154 | 154 | |
155 | 155 | $message .= sprintf(' Did you mean to use an inline fragment on %s?', $suggestions); |
156 | - } elseif (! empty($suggestedFieldNames)) { |
|
156 | + } elseif (!empty($suggestedFieldNames)) { |
|
157 | 157 | $suggestions = Utils::quotedOrList($suggestedFieldNames); |
158 | 158 | |
159 | 159 | $message .= sprintf(' Did you mean %s?', $suggestions); |
@@ -28,7 +28,7 @@ |
||
28 | 28 | $context, |
29 | 29 | [ |
30 | 30 | NodeKind::OPERATION_DEFINITION => [ |
31 | - 'leave' => function (OperationDefinitionNode $operationDefinition) use ($context) { |
|
31 | + 'leave' => function(OperationDefinitionNode $operationDefinition) use ($context) { |
|
32 | 32 | $maxDepth = $this->fieldDepth($operationDefinition); |
33 | 33 | |
34 | 34 | if ($maxDepth <= $this->getMaxQueryDepth()) { |
@@ -43,11 +43,11 @@ discard block |
||
43 | 43 | $this->spreadPathIndexByName = []; |
44 | 44 | |
45 | 45 | return [ |
46 | - NodeKind::OPERATION_DEFINITION => function () { |
|
46 | + NodeKind::OPERATION_DEFINITION => function() { |
|
47 | 47 | return Visitor::skipNode(); |
48 | 48 | }, |
49 | - NodeKind::FRAGMENT_DEFINITION => function (FragmentDefinitionNode $node) use ($context) { |
|
50 | - if (! isset($this->visitedFrags[$node->name->value])) { |
|
49 | + NodeKind::FRAGMENT_DEFINITION => function(FragmentDefinitionNode $node) use ($context) { |
|
50 | + if (!isset($this->visitedFrags[$node->name->value])) { |
|
51 | 51 | $this->detectCycleRecursive($node, $context); |
52 | 52 | } |
53 | 53 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $spreadName, |
99 | 99 | Utils::map( |
100 | 100 | $cyclePath, |
101 | - function ($s) { |
|
101 | + function($s) { |
|
102 | 102 | return $s->name->value; |
103 | 103 | } |
104 | 104 | ) |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | return sprintf( |
120 | 120 | 'Cannot spread fragment "%s" within itself%s.', |
121 | 121 | $fragName, |
122 | - ! empty($spreadNames) ? ' via ' . implode(', ', $spreadNames) : '' |
|
122 | + !empty($spreadNames) ? ' via ' . implode(', ', $spreadNames) : '' |
|
123 | 123 | ); |
124 | 124 | } |
125 | 125 | } |