GraphQL\Type\Definition\FloatType::coerceFloat PHP Method

coerceFloat() private method

private coerceFloat ( $value ) : float | null
$value
return float | null
    private function coerceFloat($value)
    {
        if ($value === '') {
            throw new InvariantViolation('Float cannot represent non numeric value: (empty string)');
        }
        if (is_numeric($value) || $value === true || $value === false) {
            return (double) $value;
        }
        throw new InvariantViolation('Float cannot represent non numeric value: ' . Utils::printSafe($value));
    }