public function __invoke(ValidationContext $context) { return [Node::FIELD => function (Field $node) use($context) { $type = $context->getParentType(); if ($type) { $fieldDef = $context->getFieldDef(); if (!$fieldDef) { return new Error(Messages::undefinedFieldMessage($node->name->value, $type->name), [$node]); } } }]; }
private function undefinedField($field, $type, $line, $column) { return new FormattedError(Messages::undefinedFieldMessage($field, $type), [new SourceLocation($line, $column)]); }