Automattic\WooCommerce\Vendor\GraphQL\Type\Definition

FloatType::parseValuepublicWC 1.0

Method of the class: FloatType{}

No Hooks.

Returns

null. Nothing (null).

Usage

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

FloatType::parseValue() code WC 10.9.1

public function parseValue($value): float
{
    $float = is_float($value) || is_int($value)
        ? (float) $value
        : null;

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

    return $float;
}