unknownArgMessage() static public method

static public unknownArgMessage ( $argName, $fieldName, $typeName )
Ejemplo n.º 1
0
 public function __invoke(ValidationContext $context)
 {
     return [Node::ARGUMENT => function (Argument $node) use($context) {
         $fieldDef = $context->getFieldDef();
         if ($fieldDef) {
             $argDef = null;
             foreach ($fieldDef->args as $arg) {
                 if ($arg->name === $node->name->value) {
                     $argDef = $arg;
                     break;
                 }
             }
             if (!$argDef) {
                 $parentType = $context->getParentType();
                 Utils::invariant($parentType);
                 return new Error(Messages::unknownArgMessage($node->name->value, $fieldDef->name, $parentType->name), [$node]);
             }
         }
     }];
 }
Ejemplo n.º 2
0
 private function unknownArg($argName, $fieldName, $typeName, $line, $column)
 {
     return new FormattedError(Messages::unknownArgMessage($argName, $fieldName, $typeName), [new SourceLocation($line, $column)]);
 }