public function __invoke(ValidationContext $context) { return [Node::NAME => function (Name $node, $key) use($context) { if ($key === 'type' || $key === 'typeCondition') { $typeName = $node->value; $type = $context->getSchema()->getType($typeName); if (!$type) { return new Error(Messages::unknownTypeMessage($typeName), [$node]); } } }]; }
private function unknownType($typeName, $line, $column) { return new FormattedError(Messages::unknownTypeMessage($typeName), [new SourceLocation($line, $column)]); }