public function __invoke(ValidationContext $context) { return [Node::ARGUMENT => function (Argument $argAST) use($context) { $argDef = $context->getArgument(); if ($argDef && !DocumentValidator::isValidLiteralValue($argAST->value, $argDef->getType())) { return new Error(self::badValueMessage($argAST->name->value, $argDef->getType(), Printer::doPrint($argAST->value)), [$argAST->value]); } }]; }
public function __invoke(ValidationContext $context) { return [Node::ARGUMENT => function (Argument $argAST) use($context) { $argDef = $context->getArgument(); if ($argDef) { $errors = DocumentValidator::isValidLiteralValue($argDef->getType(), $argAST->value); if (!empty($errors)) { $context->reportError(new Error(self::badValueMessage($argAST->name->value, $argDef->getType(), Printer::doPrint($argAST->value), $errors), [$argAST->value])); } } return Visitor::skipNode(); }]; }