Ejemplo n.º 1
0
 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]);
             }
         }
     }];
 }
Ejemplo n.º 2
0
 private function undefinedField($field, $type, $line, $column)
 {
     return new FormattedError(Messages::undefinedFieldMessage($field, $type), [new SourceLocation($line, $column)]);
 }