src/Executor/Executor.php
protected static function doesFragmentConditionMatch(ExecutionContext $context, $fragment, ObjectType $type)
    {
        $typeCondition = $fragment->get('typeCondition');
        if (!$typeCondition) {
            return TRUE;
        }

        $conditionalType = TypeInfo::typeFromAST($context->schema, $typeCondition);
        if ($conditionalType->getName() === $type->getName()) {
            return TRUE;
        }

        if ($conditionalType instanceof InterfaceType || $conditionalType instanceof UnionType) {
            return $conditionalType->isPossibleType($type);
        }

        return FALSE;
    }
protected static function doesFragmentConditionMatch(ExecutionContext $context, $fragment, ObjectType $type)
    {
        $typeCondition = $fragment->get('typeCondition');
        if (!$typeCondition) {
            return TRUE;
        }

        $conditionalType = TypeInfo::typeFromAST($context->schema, $typeCondition);
        if ($conditionalType->getName() === $type->getName()) {
            return TRUE;
        }

        if ($conditionalType instanceof InterfaceType || $conditionalType instanceof UnionType) {
            return $conditionalType->isPossibleType($type);
        }

        return FALSE;
    }
protected static function doesFragmentConditionMatch ( ExecutionContext $ context , $ fragment , ObjectType $ type ) { $ typeCondition = $ fragment -> get ( 'typeCondition' ) ; if ( ! $ typeCondition ) { return TRUE ; } $ conditionalType = TypeInfo :: typeFromAST ( $ context -> schema , $ typeCondition ) ; if ( $ conditionalType -> getName ( ) === $ type -> getName ( ) ) { return TRUE ; } if ( $ conditionalType instanceof InterfaceType || $ conditionalType instanceof UnionType ) { return $ conditionalType -> isPossibleType ( $ type ) ; } return FALSE ; }
Determines if a fragment is applicable to the given type.

@param ExecutionContext $context
@param $fragment
@param ObjectType $type

@return bool
Determines if a fragment is applicable to the given type .