WooCommerce Code Reference

VariablesInAllowedPosition extends ValidationRule
in package

Table of Contents

$name  : string
$varDefMap  : array<string|int, mixed>
A map from variable names to their definition nodes.
badVarPosMessage()  : string
A var type is allowed if it is the same or more strict than the expected type. It can be more strict if the variable type is non-null when the expected type is nullable. If both are list types, the variable item type can be more strict than the expected item type.
getName()  : string
getSDLVisitor()  : array<string|int, mixed>
Returns structure suitable for @see \Automattic\WooCommerce\Vendor\GraphQL\Language\Visitor.
getVisitor()  : array<string|int, mixed>
Returns structure suitable for @see \Automattic\WooCommerce\Vendor\GraphQL\Language\Visitor.
allowedVariableUsage()  : bool
Returns true if the variable is allowed in the location it was found, which includes considering if default values exist for either the variable or the location at which it is located.

Properties

Methods

badVarPosMessage()

A var type is allowed if it is the same or more strict than the expected type. It can be more strict if the variable type is non-null when the expected type is nullable. If both are list types, the variable item type can be more strict than the expected item type.

public static badVarPosMessage(string $varName, string $varType, string $expectedType) : string
Parameters
$varName : string
$varType : string
$expectedType : string
Return values
string

allowedVariableUsage()

Returns true if the variable is allowed in the location it was found, which includes considering if default values exist for either the variable or the location at which it is located.

protected allowedVariableUsage(Schema $schema, Type $varType, ValueNode|null $varDefaultValue, Type $locationType, mixed $locationDefaultValue) : bool
Parameters
$schema : Schema
$varType : Type
$varDefaultValue : ValueNode|null
$locationType : Type
$locationDefaultValue : mixed
Tags
throws
InvariantViolation
Return values
bool