Documentation

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

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(mixed $varName, mixed $varType, mixed $expectedType) : mixed
Parameters
$varName : mixed
$varType : mixed
$expectedType : mixed
Return values
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
Return values
bool

Search results