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
$name
protected
string
$name
$varDefMap
A map from variable names to their definition nodes.
protected
array<string|int, mixed>
$varDefMap
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 —getName()
public
getName() : string
Return values
string —getSDLVisitor()
Returns structure suitable for @see \Automattic\WooCommerce\Vendor\GraphQL\Language\Visitor.
public
getSDLVisitor(SDLValidationContext $context) : array<string|int, mixed>
Parameters
- $context : SDLValidationContext
Tags
Return values
array<string|int, mixed> —getVisitor()
Returns structure suitable for @see \Automattic\WooCommerce\Vendor\GraphQL\Language\Visitor.
public
getVisitor(QueryValidationContext $context) : array<string|int, mixed>
Parameters
- $context : QueryValidationContext
Return values
array<string|int, mixed> —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
