GraphQL\Validator\Rules\VariablesAreInputTypes::__invoke PHP Метод

__invoke() публичный Метод

public __invoke ( ValidationContext $context )
$context GraphQL\Validator\ValidationContext
    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]));
            }
        }];
    }