Automattic\WooCommerce\Vendor\GraphQL\Type\Definition
EnumType::parseLiteral
Method of the class: EnumType{}
No Hooks.
Returns
null. Nothing (null).
Usage
$EnumType = new EnumType(); $EnumType->parseLiteral( $valueNode, ?array $variables );
- $valueNode(Node) (required)
- .
- ?array $variables
- .
Default:null
EnumType::parseLiteral() EnumType::parseLiteral code WC 10.9.4
public function parseLiteral(Node $valueNode, ?array $variables = null)
{
if (! $valueNode instanceof EnumValueNode) {
$valueStr = Printer::doPrint($valueNode);
throw new Error("Enum \"{$this->name}\" cannot represent non-enum value: {$valueStr}.{$this->didYouMean($valueStr)}", $valueNode);
}
$name = $valueNode->value;
if (! isset($this->nameLookup)) {
$this->initializeNameLookup();
}
if (isset($this->nameLookup[$name])) {
return $this->nameLookup[$name]->value;
}
$valueStr = Printer::doPrint($valueNode);
throw new Error("Value \"{$valueStr}\" does not exist in \"{$this->name}\" enum.{$this->didYouMean($valueStr)}", $valueNode);
}