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