VariablesInAllowedPosition
extends ValidationRule
in package
Table of Contents
- $varDefMap : array<string|int, VariableDefinitionNode>
- A map from variable names to their definition nodes.
- $name : string
- __invoke() : mixed
- badVarPosMessage() : mixed
- 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() : mixed
- getSDLVisitor() : array<string|int, mixed>
- Returns structure suitable for GraphQL\Language\Visitor
- getVisitor() : array<string|int, mixed>
- Returns structure suitable for 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
$varDefMap
A map from variable names to their definition nodes.
public
array<string|int, VariableDefinitionNode>
$varDefMap
$name
protected
string
$name
Methods
__invoke()
public
__invoke(ValidationContext $context) : mixed
Parameters
- $context : ValidationContext
Return values
mixed —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(mixed $varName, mixed $varType, mixed $expectedType) : mixed
Parameters
- $varName : mixed
- $varType : mixed
- $expectedType : mixed
Return values
mixed —getName()
public
getName() : mixed
Return values
mixed —getSDLVisitor()
Returns structure suitable for 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 GraphQL\Language\Visitor
public
getVisitor(ValidationContext $context) : array<string|int, mixed>
Parameters
- $context : ValidationContext
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.
private
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