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