noSubselectionAllowedMessage() статический публичный Метод

static public noSubselectionAllowedMessage ( $field, $type )
Пример #1
0
 public function __invoke(ValidationContext $context)
 {
     return [Node::FIELD => function (Field $node) use($context) {
         $type = $context->getType();
         if ($type) {
             if (Type::isLeafType($type)) {
                 if ($node->selectionSet) {
                     return new Error(Messages::noSubselectionAllowedMessage($node->name->value, $type), [$node->selectionSet]);
                 }
             } else {
                 if (!$node->selectionSet) {
                     return new Error(Messages::requiredSubselectionMessage($node->name->value, $type), [$node]);
                 }
             }
         }
     }];
 }
Пример #2
0
 private function noScalarSubselection($field, $type, $line, $column)
 {
     return new FormattedError(Messages::noSubselectionAllowedMessage($field, $type), [new SourceLocation($line, $column)]);
 }