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

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

Complete a Scalar or Enum by serializing to a valid value, returning null if serialization is not possible.
private static completeLeafValue ( GraphQL\Type\Definition\LeafType $returnType, &$result ) : mixed
$returnType GraphQL\Type\Definition\LeafType
$result
Результат mixed
    private static function completeLeafValue(LeafType $returnType, &$result)
    {
        $serializedResult = $returnType->serialize($result);
        if ($serializedResult === null) {
            throw new InvariantViolation('Expected a value of type "' . Utils::printSafe($returnType) . '" but received: ' . Utils::printSafe($result));
        }
        return $serializedResult;
    }