GraphQL\Validator\ValidationContext::getType PHP Method

getType() public method

Returns OutputType
public getType ( ) : Type
return GraphQL\Type\Definition\Type
    function getType()
    {
        return $this->typeInfo->getType();
    }

Usage Example

Exemplo n.º 1
0
 public function __invoke(ValidationContext $context)
 {
     return [Node::INLINE_FRAGMENT => function (InlineFragment $node) use($context) {
         $type = $context->getType();
         if ($node->typeCondition && $type && !Type::isCompositeType($type)) {
             $context->reportError(new Error(static::inlineFragmentOnNonCompositeErrorMessage($type), [$node->typeCondition]));
         }
     }, Node::FRAGMENT_DEFINITION => function (FragmentDefinition $node) use($context) {
         $type = $context->getType();
         if ($type && !Type::isCompositeType($type)) {
             $context->reportError(new Error(static::fragmentOnNonCompositeErrorMessage($node->name->value, Printer::doPrint($node->typeCondition)), [$node->typeCondition]));
         }
     }];
 }
All Usage Examples Of GraphQL\Validator\ValidationContext::getType