public function __invoke(ValidationContext $context)
{
return [NodeKind::VARIABLE_DEFINITION => function (VariableDefinitionNode $node) use($context) {
$type = Utils\TypeInfo::typeFromAST($context->getSchema(), $node->type);
// If the variable type is not an input type, return an error.
if ($type && !Type::isInputType($type)) {
$variableName = $node->variable->name->value;
$context->reportError(new Error(self::nonInputTypeOnVarMessage($variableName, Printer::doPrint($node->type)), [$node->type]));
}
}];
}