@@ -77,9 +77,9 @@ discard block |
||
77 | 77 | * @param TypeInfo $typeInfo |
78 | 78 | */ |
79 | 79 | public function __construct( |
80 | - SchemaInterface $schema, |
|
81 | - DocumentNode $document, |
|
82 | - TypeInfo $typeInfo |
|
80 | + SchemaInterface $schema, |
|
81 | + DocumentNode $document, |
|
82 | + TypeInfo $typeInfo |
|
83 | 83 | ) { |
84 | 84 | $this->schema = $schema; |
85 | 85 | $this->document = $document; |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @inheritdoc |
171 | 171 | */ |
172 | 172 | public function getRecursiveVariableUsages( |
173 | - OperationDefinitionNode $operation |
|
173 | + OperationDefinitionNode $operation |
|
174 | 174 | ): array { |
175 | 175 | $usages = $this->recursiveVariableUsages[(string)$operation] ?? null; |
176 | 176 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | // TODO: Figure out a more performance way to do this. |
183 | 183 | /** @noinspection SlowArrayOperationsInLoopInspection */ |
184 | 184 | $usages = array_merge($usages, |
185 | - $this->getVariableUsages($fragment)); |
|
185 | + $this->getVariableUsages($fragment)); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | $this->recursiveVariableUsages[(string)$operation] = $usages; |
@@ -204,23 +204,23 @@ discard block |
||
204 | 204 | $usages = []; |
205 | 205 | $typeInfo = new TypeInfo($this->schema); |
206 | 206 | $visitor = new TypeInfoVisitor($typeInfo, new Visitor( |
207 | - function (NodeInterface $node) use ( |
|
207 | + function (NodeInterface $node) use ( |
|
208 | 208 | &$usages, |
209 | 209 | $typeInfo |
210 | - ): ?NodeInterface { |
|
211 | - if ($node instanceof VariableDefinitionNode) { |
|
212 | - return null; |
|
213 | - } |
|
210 | + ): ?NodeInterface { |
|
211 | + if ($node instanceof VariableDefinitionNode) { |
|
212 | + return null; |
|
213 | + } |
|
214 | 214 | |
215 | - if ($node instanceof VariableNode) { |
|
216 | - $usages[] = [ |
|
215 | + if ($node instanceof VariableNode) { |
|
216 | + $usages[] = [ |
|
217 | 217 | 'node' => $node, |
218 | 218 | 'type' => $typeInfo->getInputType(), |
219 | - ]; |
|
220 | - } |
|
219 | + ]; |
|
220 | + } |
|
221 | 221 | |
222 | - return $node; |
|
223 | - } |
|
222 | + return $node; |
|
223 | + } |
|
224 | 224 | )); |
225 | 225 | |
226 | 226 | $node->acceptVisitor($visitor); |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | * @inheritdoc |
236 | 236 | */ |
237 | 237 | public function getRecursivelyReferencedFragments( |
238 | - OperationDefinitionNode $operation |
|
238 | + OperationDefinitionNode $operation |
|
239 | 239 | ): array { |
240 | 240 | $fragments = $this->recursivelyReferencedFragment[(string)$operation] ?? null; |
241 | 241 | |
@@ -308,12 +308,12 @@ discard block |
||
308 | 308 | { |
309 | 309 | if (empty($this->fragments)) { |
310 | 310 | $this->fragments = array_reduce($this->document->getDefinitions(), |
311 | - function ($fragments, $definition) { |
|
312 | - if ($definition instanceof FragmentDefinitionNode) { |
|
313 | - $fragments[$definition->getNameValue()] = $definition; |
|
314 | - } |
|
315 | - return $fragments; |
|
316 | - }, []); |
|
311 | + function ($fragments, $definition) { |
|
312 | + if ($definition instanceof FragmentDefinitionNode) { |
|
313 | + $fragments[$definition->getNameValue()] = $definition; |
|
314 | + } |
|
315 | + return $fragments; |
|
316 | + }, []); |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | return $this->fragments[$name] ?? null; |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | $usages = []; |
205 | 205 | $typeInfo = new TypeInfo($this->schema); |
206 | 206 | $visitor = new TypeInfoVisitor($typeInfo, new Visitor( |
207 | - function (NodeInterface $node) use ( |
|
207 | + function(NodeInterface $node) use ( |
|
208 | 208 | &$usages, |
209 | 209 | $typeInfo |
210 | 210 | ): ?NodeInterface { |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | { |
309 | 309 | if (empty($this->fragments)) { |
310 | 310 | $this->fragments = array_reduce($this->document->getDefinitions(), |
311 | - function ($fragments, $definition) { |
|
311 | + function($fragments, $definition) { |
|
312 | 312 | if ($definition instanceof FragmentDefinitionNode) { |
313 | 313 | $fragments[$definition->getNameValue()] = $definition; |
314 | 314 | } |
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | * @return ValidationException[] |
20 | 20 | */ |
21 | 21 | public function validate( |
22 | - SchemaInterface $schema, |
|
23 | - DocumentNode $document, |
|
22 | + SchemaInterface $schema, |
|
23 | + DocumentNode $document, |
|
24 | 24 | ?array $rules = null, |
25 | 25 | ?TypeInfo $typeInfo = null |
26 | 26 | ): array; |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | * @return ValidationContextInterface |
34 | 34 | */ |
35 | 35 | public function createContext( |
36 | - SchemaInterface $schema, |
|
37 | - DocumentNode $document, |
|
38 | - TypeInfo $typeInfo |
|
36 | + SchemaInterface $schema, |
|
37 | + DocumentNode $document, |
|
38 | + TypeInfo $typeInfo |
|
39 | 39 | ): ValidationContextInterface; |
40 | 40 | } |
@@ -29,10 +29,10 @@ discard block |
||
29 | 29 | ): ?NodeInterface |
30 | 30 | { |
31 | 31 | $this->validateFragementNode($node, |
32 | - function (FragmentDefinitionNode $node) { |
|
33 | - return fragmentOnNonCompositeMessage((string)$node, |
|
32 | + function (FragmentDefinitionNode $node) { |
|
33 | + return fragmentOnNonCompositeMessage((string)$node, |
|
34 | 34 | (string)$node->getTypeCondition()); |
35 | - }); |
|
35 | + }); |
|
36 | 36 | |
37 | 37 | return $node; |
38 | 38 | } |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | ): ?NodeInterface |
45 | 45 | { |
46 | 46 | $this->validateFragementNode($node, |
47 | - function (InlineFragmentNode $node) { |
|
48 | - return inlineFragmentOnNonCompositeMessage((string)$node->getTypeCondition()); |
|
49 | - }); |
|
47 | + function (InlineFragmentNode $node) { |
|
48 | + return inlineFragmentOnNonCompositeMessage((string)$node->getTypeCondition()); |
|
49 | + }); |
|
50 | 50 | |
51 | 51 | return $node; |
52 | 52 | } |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | * @throws \TypeError |
61 | 61 | */ |
62 | 62 | protected function validateFragementNode( |
63 | - NodeInterface $node, |
|
64 | - callable $errorMessageFunction |
|
63 | + NodeInterface $node, |
|
64 | + callable $errorMessageFunction |
|
65 | 65 | ) { |
66 | 66 | $typeCondition = $node->getTypeCondition(); |
67 | 67 | |
@@ -70,9 +70,9 @@ discard block |
||
70 | 70 | |
71 | 71 | if (null !== $type && !($type instanceof CompositeTypeInterface)) { |
72 | 72 | $this->context->reportError( |
73 | - new ValidationException($errorMessageFunction($node), |
|
73 | + new ValidationException($errorMessageFunction($node), |
|
74 | 74 | [$typeCondition] |
75 | - ) |
|
75 | + ) |
|
76 | 76 | ); |
77 | 77 | } |
78 | 78 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | ): ?NodeInterface |
30 | 30 | { |
31 | 31 | $this->validateFragementNode($node, |
32 | - function (FragmentDefinitionNode $node) { |
|
32 | + function(FragmentDefinitionNode $node) { |
|
33 | 33 | return fragmentOnNonCompositeMessage((string)$node, |
34 | 34 | (string)$node->getTypeCondition()); |
35 | 35 | }); |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | ): ?NodeInterface |
45 | 45 | { |
46 | 46 | $this->validateFragementNode($node, |
47 | - function (InlineFragmentNode $node) { |
|
47 | + function(InlineFragmentNode $node) { |
|
48 | 48 | return inlineFragmentOnNonCompositeMessage((string)$node->getTypeCondition()); |
49 | 49 | }); |
50 | 50 |
@@ -68,7 +68,7 @@ |
||
68 | 68 | |
69 | 69 | if (!isset($fragmentNamesUsed[$fragmentName])) { |
70 | 70 | $this->context->reportError( |
71 | - new ValidationException(unusedFragmentMessage($fragmentName), |
|
71 | + new ValidationException(unusedFragmentMessage($fragmentName), |
|
72 | 72 | [$fragmentDefinition]) |
73 | 73 | ); |
74 | 74 | } |
@@ -31,7 +31,7 @@ |
||
31 | 31 | $selections = $selectionSet->getSelections(); |
32 | 32 | if (\count($selections) !== 1) { |
33 | 33 | $this->context->reportError( |
34 | - new ValidationException(singleFieldOnlyMessage((string)$node), |
|
34 | + new ValidationException(singleFieldOnlyMessage((string)$node), |
|
35 | 35 | \array_slice($selections, 1)) |
36 | 36 | ); |
37 | 37 | } |
@@ -50,10 +50,10 @@ discard block |
||
50 | 50 | |
51 | 51 | if ($type instanceof NonNullType) { |
52 | 52 | $this->context->reportError( |
53 | - new ValidationException( |
|
53 | + new ValidationException( |
|
54 | 54 | badValueMessage((string)$type, printNode($node)), |
55 | 55 | [$node] |
56 | - ) |
|
56 | + ) |
|
57 | 57 | ); |
58 | 58 | } |
59 | 59 | |
@@ -99,11 +99,11 @@ discard block |
||
99 | 99 | $didYouMean = $this->getEnumTypeSuggestion($type, $node) ?? null; |
100 | 100 | |
101 | 101 | $this->context->reportError( |
102 | - new ValidationException( |
|
102 | + new ValidationException( |
|
103 | 103 | badValueMessage((string)$locationType, printNode($node), |
104 | - $didYouMean), |
|
104 | + $didYouMean), |
|
105 | 105 | [$node] |
106 | - ) |
|
106 | + ) |
|
107 | 107 | ); |
108 | 108 | |
109 | 109 | return; |
@@ -116,24 +116,24 @@ discard block |
||
116 | 116 | |
117 | 117 | if (null === $result) { |
118 | 118 | $this->context->reportError( |
119 | - new ValidationException( |
|
119 | + new ValidationException( |
|
120 | 120 | badValueMessage((string)$locationType, printNode($node)), |
121 | 121 | [$node] |
122 | - ) |
|
122 | + ) |
|
123 | 123 | ); |
124 | 124 | } |
125 | 125 | } catch (\Exception $ex) { |
126 | 126 | // Ensure a reference to the original error is maintained. |
127 | 127 | $this->context->reportError( |
128 | - new ValidationException( |
|
128 | + new ValidationException( |
|
129 | 129 | badValueMessage((string)$locationType, printNode($node), |
130 | - $ex->getMessage()), |
|
130 | + $ex->getMessage()), |
|
131 | 131 | [$node], |
132 | 132 | null, |
133 | 133 | null, |
134 | 134 | null, |
135 | 135 | $ex |
136 | - ) |
|
136 | + ) |
|
137 | 137 | ); |
138 | 138 | } |
139 | 139 | } |
@@ -146,15 +146,15 @@ discard block |
||
146 | 146 | * @throws InvariantException |
147 | 147 | */ |
148 | 148 | protected function getEnumTypeSuggestion( |
149 | - NamedTypeInterface $type, |
|
150 | - ValueNodeInterface $node |
|
149 | + NamedTypeInterface $type, |
|
150 | + ValueNodeInterface $node |
|
151 | 151 | ): ?string |
152 | 152 | { |
153 | 153 | if ($type instanceof EnumType) { |
154 | 154 | $suggestions = suggestionList(printNode($node), |
155 | - \array_map(function (EnumValue $value) { |
|
156 | - return $value->getName(); |
|
157 | - }, $type->getValues())); |
|
155 | + \array_map(function (EnumValue $value) { |
|
156 | + return $value->getName(); |
|
157 | + }, $type->getValues())); |
|
158 | 158 | |
159 | 159 | return !empty($suggestions) |
160 | 160 | ? \sprintf('Did you mean the enum value %s?', |
@@ -175,16 +175,16 @@ discard block |
||
175 | 175 | |
176 | 176 | if (null === $fieldType && $parentType instanceof InputObjectType) { |
177 | 177 | $suggestions = suggestionList($node->getNameValue(), |
178 | - \array_keys($parentType->getFields())); |
|
178 | + \array_keys($parentType->getFields())); |
|
179 | 179 | $didYouMean = !empty($suggestions) ? \sprintf('Did you mean %s?', |
180 | - orList($suggestions)) : null; |
|
180 | + orList($suggestions)) : null; |
|
181 | 181 | |
182 | 182 | $this->context->reportError( |
183 | - new ValidationException( |
|
183 | + new ValidationException( |
|
184 | 184 | unknownFieldMessage($parentType->getName(), |
185 | - $node->getNameValue(), $didYouMean), |
|
185 | + $node->getNameValue(), $didYouMean), |
|
186 | 186 | [$node] |
187 | - ) |
|
187 | + ) |
|
188 | 188 | ); |
189 | 189 | } |
190 | 190 | |
@@ -206,9 +206,9 @@ discard block |
||
206 | 206 | // Ensure every required field exists. |
207 | 207 | $inputFields = $type->getFields(); |
208 | 208 | $fieldNodeMap = keyMap($node->getFields(), |
209 | - function (ObjectFieldNode $field) { |
|
210 | - return $field->getNameValue(); |
|
211 | - }); |
|
209 | + function (ObjectFieldNode $field) { |
|
210 | + return $field->getNameValue(); |
|
211 | + }); |
|
212 | 212 | |
213 | 213 | foreach ($inputFields as $fieldName => $field) { |
214 | 214 | $fieldType = $field->getType(); |
@@ -216,11 +216,11 @@ discard block |
||
216 | 216 | |
217 | 217 | if (null === $fieldNode && $fieldType instanceof NonNullType) { |
218 | 218 | $this->context->reportError( |
219 | - new ValidationException( |
|
219 | + new ValidationException( |
|
220 | 220 | requiredFieldMessage($type->getName(), $fieldName, |
221 | - (string)$fieldType), |
|
221 | + (string)$fieldType), |
|
222 | 222 | [$node] |
223 | - ) |
|
223 | + ) |
|
224 | 224 | ); |
225 | 225 | } |
226 | 226 | } |
@@ -241,11 +241,11 @@ discard block |
||
241 | 241 | $didYouMean = $this->getEnumTypeSuggestion($type, $node); |
242 | 242 | |
243 | 243 | $this->context->reportError( |
244 | - new ValidationException( |
|
244 | + new ValidationException( |
|
245 | 245 | badValueMessage($type->getName(), printNode($node), |
246 | - $didYouMean), |
|
246 | + $didYouMean), |
|
247 | 247 | [$node] |
248 | - ) |
|
248 | + ) |
|
249 | 249 | ); |
250 | 250 | } |
251 | 251 |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | { |
153 | 153 | if ($type instanceof EnumType) { |
154 | 154 | $suggestions = suggestionList(printNode($node), |
155 | - \array_map(function (EnumValue $value) { |
|
155 | + \array_map(function(EnumValue $value) { |
|
156 | 156 | return $value->getName(); |
157 | 157 | }, $type->getValues())); |
158 | 158 | |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | // Ensure every required field exists. |
207 | 207 | $inputFields = $type->getFields(); |
208 | 208 | $fieldNodeMap = keyMap($node->getFields(), |
209 | - function (ObjectFieldNode $field) { |
|
209 | + function(ObjectFieldNode $field) { |
|
210 | 210 | return $field->getNameValue(); |
211 | 211 | }); |
212 | 212 |
@@ -27,12 +27,12 @@ |
||
27 | 27 | if (!$definition instanceof ExecutableDefinitionNodeInterface) { |
28 | 28 | /** @noinspection PhpUndefinedMethodInspection */ |
29 | 29 | $this->context->reportError( |
30 | - new ValidationException( |
|
30 | + new ValidationException( |
|
31 | 31 | nonExecutableDefinitionMessage( |
32 | - $definition instanceof SchemaDefinitionNode ? 'schema' : $definition->getNameValue() |
|
32 | + $definition instanceof SchemaDefinitionNode ? 'schema' : $definition->getNameValue() |
|
33 | 33 | ), |
34 | 34 | [$definition] |
35 | - ) |
|
35 | + ) |
|
36 | 36 | ); |
37 | 37 | } |
38 | 38 | } |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | |
33 | 33 | if (null === $type) { |
34 | 34 | $this->context->reportError( |
35 | - new ValidationException( |
|
35 | + new ValidationException( |
|
36 | 36 | unknownTypeMessage($typeName, suggestionList($typeName, |
37 | - \array_keys($schema->getTypeMap()))), |
|
37 | + \array_keys($schema->getTypeMap()))), |
|
38 | 38 | [$node] |
39 | - ) |
|
39 | + ) |
|
40 | 40 | ); |
41 | 41 | } |
42 | 42 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * @inheritdoc |
59 | 59 | */ |
60 | 60 | protected function enterInterfaceTypeDefinition( |
61 | - InterfaceTypeDefinitionNode $node |
|
61 | + InterfaceTypeDefinitionNode $node |
|
62 | 62 | ): ?NodeInterface |
63 | 63 | { |
64 | 64 | return null; |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * @inheritdoc |
78 | 78 | */ |
79 | 79 | protected function enterInputObjectTypeDefinition( |
80 | - InputObjectTypeDefinitionNode $node |
|
80 | + InputObjectTypeDefinitionNode $node |
|
81 | 81 | ): ?NodeInterface |
82 | 82 | { |
83 | 83 | return null; |
@@ -49,11 +49,11 @@ |
||
49 | 49 | |
50 | 50 | if (null !== $defaultValue && $type instanceof NonNullType) { |
51 | 51 | $this->context->reportError( |
52 | - new ValidationException( |
|
52 | + new ValidationException( |
|
53 | 53 | variableDefaultValueNotAllowedMessage($variableName, $type, |
54 | - $type->getOfType()), |
|
54 | + $type->getOfType()), |
|
55 | 55 | [$defaultValue] |
56 | - ) |
|
56 | + ) |
|
57 | 57 | ); |
58 | 58 | } |
59 | 59 |