Automattic\WooCommerce\Vendor\GraphQL\Type\Definition

FloatType::serializepublicWC 1.0

Method of the class: FloatType{}

No Hooks.

Returns

null. Nothing (null).

Usage

$FloatType = new FloatType();
$FloatType->serialize( $value ): float;
$value(required)
.

FloatType::serialize() code WC 10.9.1

public function serialize($value): float
{
    $float = is_numeric($value) || is_bool($value)
        ? (float) $value
        : null;

    if ($float === null || ! is_finite($float)) {
        $notFloat = Utils::printSafe($value);
        throw new SerializationError("Float cannot represent non numeric value: {$notFloat}");
    }

    return $float;
}