Automattic\WooCommerce\Vendor\GraphQL\Type\Definition

IDType::parseLiteralpublicWC 1.0

Method of the class: IDType{}

No Hooks.

Returns

null. Nothing (null).

Usage

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

IDType::parseLiteral() code WC 10.9.1

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

    $notID = Printer::doPrint($valueNode);
    throw new Error("ID cannot represent a non-string and non-integer value: {$notID}", $valueNode);
}