Automattic\WooCommerce\Vendor\GraphQL\Type\Definition

FloatType::parseLiteralpublicWC 1.0

Method of the class: FloatType{}

No Hooks.

Returns

null. Nothing (null).

Usage

$FloatType = new FloatType();
$FloatType->parseLiteral( $valueNode, ?array $variables );
$valueNode(Node) (required)
.
?array $variables
.
Default: null

FloatType::parseLiteral() code WC 10.9.1

public function parseLiteral(Node $valueNode, ?array $variables = null)
{
    if ($valueNode instanceof FloatValueNode || $valueNode instanceof IntValueNode) {
        return (float) $valueNode->value;
    }

    $notFloat = Printer::doPrint($valueNode);
    throw new Error("Float cannot represent non numeric value: {$notFloat}", $valueNode);
}