Conditions | 7 |
Paths | 4 |
Total Lines | 23 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
26 | public function enterNode(NodeInterface $node): ?NodeInterface |
||
27 | { |
||
28 | if ($node instanceof ObjectTypeDefinitionNode || $node instanceof InterfaceTypeDefinitionNode || $node instanceof UnionTypeDefinitionNode || $node instanceof InputObjectTypeDefinitionNode) { |
||
29 | // TODO: when validating IDL, re-enable these. Experimental version does not add unreferenced types, resulting in false-positive errors. Squelched errors for now. |
||
30 | return null; |
||
31 | } |
||
32 | |||
33 | if ($node instanceof NamedTypeNode) { |
||
34 | $schema = $this->validationContext->getSchema(); |
||
35 | $typeName = $node->getNameValue(); |
||
36 | $type = $schema->getType($typeName); |
||
37 | |||
38 | if (null === $type) { |
||
39 | $this->validationContext->reportError( |
||
40 | new ValidationException( |
||
41 | unknownTypeMessage($typeName, suggestionList($typeName, array_keys($schema->getTypeMap()))), |
||
42 | [$node] |
||
43 | ) |
||
44 | ); |
||
45 | } |
||
46 | } |
||
47 | |||
48 | return $node; |
||
49 | } |
||
51 |