Automattic\WooCommerce\Vendor\GraphQL\Validator
QueryValidationContext::getVariableUsages
Method of the class: QueryValidationContext{}
No Hooks.
Returns
null. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->getVariableUsages( $node ): array;
- $node(HasSelectionSet&Node) (required)
- .
QueryValidationContext::getVariableUsages() QueryValidationContext::getVariableUsages code WC 10.9.1
private function getVariableUsages(HasSelectionSet $node): array
{
if (! isset($this->variableUsages[$node])) {
$usages = [];
$typeInfo = new TypeInfo($this->schema);
Visitor::visit(
$node,
Visitor::visitWithTypeInfo(
$typeInfo,
[
NodeKind::VARIABLE_DEFINITION => static fn () => Visitor::skipNode(),
NodeKind::VARIABLE => static function (VariableNode $variable) use (&$usages, $typeInfo): void {
$usages[] = [
'node' => $variable,
'type' => $typeInfo->getInputType(),
'defaultValue' => $typeInfo->getDefaultValue(),
];
},
]
)
);
return $this->variableUsages[$node] = $usages;
}
return $this->variableUsages[$node];
}