GraphQL\Executor\Executor::completeAbstractValue PHP Метод

completeAbstractValue() приватный статический Метод

Complete a value of an abstract type by determining the runtime object type of that value, then complete the value for that type.
private static completeAbstractValue ( ExecutionContext $exeContext, GraphQL\Type\Definition\AbstractType $returnType, $fieldNodes, ResolveInfo $info, array $path, &$result ) : mixed
$exeContext ExecutionContext
$returnType GraphQL\Type\Definition\AbstractType
$fieldNodes
$info GraphQL\Type\Definition\ResolveInfo
$path array
$result
Результат mixed
    private static function completeAbstractValue(ExecutionContext $exeContext, AbstractType $returnType, $fieldNodes, ResolveInfo $info, $path, &$result)
    {
        $runtimeType = $returnType->resolveType($result, $exeContext->contextValue, $info);
        if (null === $runtimeType) {
            $runtimeType = self::inferTypeOf($result, $exeContext->contextValue, $info, $returnType);
        }
        // If resolveType returns a string, we assume it's a ObjectType name.
        if (is_string($runtimeType)) {
            $runtimeType = $exeContext->schema->getType($runtimeType);
        }
        if (!$runtimeType instanceof ObjectType) {
            throw new Error("Abstract type {$returnType} must resolve to an Object type at runtime " . "for field {$info->parentType}.{$info->fieldName} with value \"" . print_r($result, true) . "\"," . "received \"{$runtimeType}\".", $fieldNodes);
        }
        if (!$exeContext->schema->isPossibleType($returnType, $runtimeType)) {
            throw new Error("Runtime Object type \"{$runtimeType}\" is not a possible type for \"{$returnType}\".", $fieldNodes);
        }
        return self::completeObjectValue($exeContext, $runtimeType, $fieldNodes, $info, $path, $result);
    }