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

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

public __invoke ( ValidationContext $context )
$context GraphQL\Validator\ValidationContext
    public function __invoke(ValidationContext $context)
    {
        return [NodeKind::FIELD => function (FieldNode $node) use($context) {
            $type = $context->getType();
            if ($type) {
                if (Type::isLeafType($type)) {
                    if ($node->selectionSet) {
                        $context->reportError(new Error(self::noSubselectionAllowedMessage($node->name->value, $type), [$node->selectionSet]));
                    }
                } else {
                    if (!$node->selectionSet) {
                        $context->reportError(new Error(self::requiredSubselectionMessage($node->name->value, $type), [$node]));
                    }
                }
            }
        }];
    }