Automattic\WooCommerce\Vendor\GraphQL\Validator\Rules

PossibleFragmentSpreads::getFragmentTypeprotectedWC 1.0

Method of the class: PossibleFragmentSpreads{}

No Hooks.

Returns

(CompositeType&Type)|null.

Usage

// protected - for code of main (parent) or child class
$result = $this->getFragmentType( $context, $name ): ?Type;
$context(QueryValidationContext) (required)
.
$name(string) (required)
.

PossibleFragmentSpreads::getFragmentType() code WC 10.9.1

protected function getFragmentType(QueryValidationContext $context, string $name): ?Type
{
    $frag = $context->getFragment($name);
    if ($frag === null) {
        return null;
    }

    $type = AST::typeFromAST([$context->getSchema(), 'getType'], $frag->typeCondition);

    return $type instanceof CompositeType
        ? $type
        : null;
}