GraphQL\Validator\ValidationContext::getParentType PHP Method

getParentType() public method

public getParentType ( ) : GraphQL\Type\Definition\CompositeType
return GraphQL\Type\Definition\CompositeType
    function getParentType()
    {
        return $this->typeInfo->getParentType();
    }

Usage Example

 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]);
             }
         }
     }];
 }
All Usage Examples Of GraphQL\Validator\ValidationContext::getParentType