Parser
in package
Parses string containing GraphQL query or [type definition](type-system/type-language.md) to Abstract Syntax Tree.
Those magic functions allow partial parsing:
Table of Contents
- $lexer : Lexer
- __callStatic() : mixed
- Parse partial source by delegating calls to the internal parseX methods.
- __construct() : mixed
- argument() : ArgumentNode
- array() : ListValueNode
- constArgument() : ArgumentNode
- constArray() : ListValueNode
- constDirective() : DirectiveNode
- constObject() : ObjectValueNode
- constObjectField() : ObjectFieldNode
- constValue() : BooleanValueNode|EnumValueNode|FloatValueNode|IntValueNode|StringValueNode
- constValueLiteral() : BooleanValueNode|EnumValueNode|FloatValueNode|IntValueNode|ListValueNode|NullValueNode|ObjectValueNode|StringValueNode
- definition() : ExecutableDefinitionNode|TypeSystemDefinitionNode
- description() : StringValueNode|null
- directive() : DirectiveNode
- directiveDefinition() : DirectiveDefinitionNode
- directiveLocation() : NameNode
- document() : DocumentNode
- enumTypeDefinition() : EnumTypeDefinitionNode
- enumTypeExtension() : EnumTypeExtensionNode
- enumValueDefinition() : EnumValueDefinitionNode
- executableDefinition() : ExecutableDefinitionNode
- field() : FieldNode
- fieldDefinition() : FieldDefinitionNode
- fragment() : FragmentSpreadNode|InlineFragmentNode
- fragmentDefinition() : FragmentDefinitionNode
- fragmentName() : NameNode
- inputObjectTypeDefinition() : InputObjectTypeDefinitionNode
- inputObjectTypeExtension() : InputObjectTypeExtensionNode
- inputValueDefinition() : InputValueDefinitionNode
- interfaceTypeDefinition() : InterfaceTypeDefinitionNode
- interfaceTypeExtension() : InterfaceTypeExtensionNode
- name() : NameNode
- namedType() : NamedTypeNode
- NodeList() : void
- NodeList() : void
- NodeList() : void
- NodeList() : void
- NodeList() : void
- NodeList() : void
- NodeList() : void
- NodeList() : void
- NodeList() : void
- NodeList() : void
- NodeList() : void
- NodeList() : void
- object() : ObjectValueNode
- objectField() : ObjectFieldNode
- objectTypeDefinition() : ObjectTypeDefinitionNode
- objectTypeExtension() : ObjectTypeExtensionNode
- operationDefinition() : OperationDefinitionNode
- operationType() : string
- operationTypeDefinition() : OperationTypeDefinitionNode
- parse() : DocumentNode
- Given a GraphQL source, parses it into a `GraphQL\Language\AST\DocumentNode`.
- parseType() : ListTypeNode|NamedTypeNode|NonNullTypeNode
- Given a string containing a GraphQL Type (ex. `[Int!]`), parse the AST for that type.
- parseValue() : BooleanValueNode|EnumValueNode|FloatValueNode|IntValueNode|ListValueNode|ObjectValueNode|StringValueNode|VariableNode
- Given a string containing a GraphQL value (ex. `[42]`), parse the AST for that value.
- scalarTypeDefinition() : ScalarTypeDefinitionNode
- scalarTypeExtension() : ScalarTypeExtensionNode
- schemaDefinition() : SchemaDefinitionNode
- schemaTypeExtension() : SchemaTypeExtensionNode
- selection() : mixed
- selectionSet() : SelectionSetNode
- stringLiteral() : StringValueNode
- typeExtension() : TypeExtensionNode
- typeReference() : ListTypeNode|NamedTypeNode|NonNullTypeNode
- typeSystemDefinition() : TypeSystemDefinitionNode
- unionTypeDefinition() : UnionTypeDefinitionNode
- unionTypeExtension() : UnionTypeExtensionNode
- valueLiteral() : BooleanValueNode|EnumValueNode|FloatValueNode|IntValueNode|ListValueNode|NullValueNode|ObjectValueNode|StringValueNode|VariableNode
- variable() : VariableNode
- variableDefinition() : VariableDefinitionNode
- variableValue() : BooleanValueNode|EnumValueNode|FloatValueNode|IntValueNode|ListValueNode|ObjectValueNode|StringValueNode|VariableNode
- any() : NodeList
- Returns a possibly empty list of parse nodes, determined by the parseFn. This list begins with a lex token of openKind and ends with a lex token of closeKind. Advances the parser to the next lex token after the closing token.
- expect() : Token
- If the next token is of the given kind, return that token after advancing the parser. Otherwise, do not change the parser state and return false.
- expectKeyword() : void
- If the next token is a keyword with the given value, advance the lexer.
- expectOptionalKeyword() : bool
- If the next token is a given keyword, return "true" after advancing the lexer. Otherwise, do not change the parser state and return "false".
- loc() : Location|null
- Returns a location object, used to identify the place in the source that created a given parsed object.
- many() : NodeList
- Returns a non-empty list of parse nodes, determined by the parseFn. This list begins with a lex token of openKind and ends with a lex token of closeKind. Advances the parser to the next lex token after the closing token.
- parseArgument() : ArgumentNode
- parseArguments() : NodeList
- parseArgumentsDefinition() : NodeList
- parseArray() : ListValueNode
- parseConstArgument() : ArgumentNode
- parseConstValue() : BooleanValueNode|EnumValueNode|FloatValueNode|IntValueNode|StringValueNode|VariableNode
- parseDefinition() : ExecutableDefinitionNode|TypeSystemDefinitionNode
- parseDescription() : StringValueNode|null
- parseDirective() : DirectiveNode
- parseDirectiveDefinition() : DirectiveDefinitionNode
- DirectiveDefinition : - Description? directive @ Name ArgumentsDefinition? `repeatable`? on DirectiveLocations
- parseDirectiveLocation() : NameNode
- parseDirectiveLocations() : NodeList
- parseDirectives() : NodeList
- parseDocument() : DocumentNode
- Implements the parsing rules in the Document section.
- parseEnumTypeDefinition() : EnumTypeDefinitionNode
- parseEnumTypeExtension() : EnumTypeExtensionNode
- parseEnumValueDefinition() : EnumValueDefinitionNode
- parseEnumValuesDefinition() : NodeList
- parseExecutableDefinition() : ExecutableDefinitionNode
- parseField() : FieldNode
- parseFieldDefinition() : FieldDefinitionNode
- parseFieldsDefinition() : NodeList
- parseFragment() : FragmentSpreadNode|InlineFragmentNode
- parseFragmentDefinition() : FragmentDefinitionNode
- parseFragmentName() : NameNode
- parseImplementsInterfaces() : NodeList
- ImplementsInterfaces : - implements `&`? NamedType - ImplementsInterfaces & NamedType
- parseInputFieldsDefinition() : NodeList
- parseInputObjectTypeDefinition() : InputObjectTypeDefinitionNode
- parseInputObjectTypeExtension() : InputObjectTypeExtensionNode
- parseInputValueDefinition() : InputValueDefinitionNode
- parseInterfaceTypeDefinition() : InterfaceTypeDefinitionNode
- parseInterfaceTypeExtension() : InterfaceTypeExtensionNode
- parseName() : NameNode
- Converts a name lex token into a name parse node.
- parseNamedType() : NamedTypeNode
- parseObject() : ObjectValueNode
- parseObjectField() : ObjectFieldNode
- parseObjectTypeDefinition() : ObjectTypeDefinitionNode
- parseObjectTypeExtension() : ObjectTypeExtensionNode
- parseOperationDefinition() : OperationDefinitionNode
- parseOperationType() : string
- parseOperationTypeDefinition() : OperationTypeDefinitionNode
- parseScalarTypeDefinition() : ScalarTypeDefinitionNode
- parseScalarTypeExtension() : ScalarTypeExtensionNode
- parseSchemaDefinition() : SchemaDefinitionNode
- parseSchemaTypeExtension() : SchemaTypeExtensionNode
- parseSelection() : SelectionNode
- Selection : - Field - FragmentSpread - InlineFragment
- parseSelectionSet() : SelectionSetNode
- parseStringLiteral() : StringValueNode
- parseTypeExtension() : TypeExtensionNode
- TypeExtension : - ScalarTypeExtension - ObjectTypeExtension - InterfaceTypeExtension - UnionTypeExtension - EnumTypeExtension - InputObjectTypeDefinition
- parseTypeReference() : ListTypeNode|NamedTypeNode|NonNullTypeNode
- Handles the Type: TypeName, ListType, and NonNullType parsing rules.
- parseTypeSystemDefinition() : TypeSystemDefinitionNode
- TypeSystemDefinition : - SchemaDefinition - TypeDefinition - TypeExtension - DirectiveDefinition
- parseUnionMemberTypes() : NodeList
- UnionMemberTypes : - = `|`? NamedType - UnionMemberTypes | NamedType
- parseUnionTypeDefinition() : UnionTypeDefinitionNode
- UnionTypeDefinition : - Description? union Name Directives[Const]? UnionMemberTypes?
- parseUnionTypeExtension() : UnionTypeExtensionNode
- UnionTypeExtension : - extend union Name Directives[Const]? UnionMemberTypes - extend union Name Directives[Const]
- parseValueLiteral() : BooleanValueNode|EnumValueNode|FloatValueNode|IntValueNode|StringValueNode|VariableNode|ListValueNode|ObjectValueNode|NullValueNode
- Value[Const] : - [~Const] Variable - IntValue - FloatValue - StringValue - BooleanValue - NullValue - EnumValue - ListValue[?Const] - ObjectValue[?Const]
- parseVariable() : VariableNode
- parseVariableDefinition() : VariableDefinitionNode
- parseVariableDefinitions() : NodeList
- parseVariableValue() : BooleanValueNode|EnumValueNode|FloatValueNode|IntValueNode|ListValueNode|ObjectValueNode|StringValueNode|VariableNode
- peek() : bool
- Determines if the next token is of a given kind
- peekDescription() : bool
- skip() : bool
- If the next token is of the given kind, return true after advancing the parser. Otherwise, do not change the parser state and return false.
- unexpected() : SyntaxError
Properties
$lexer
private
Lexer
$lexer
Methods
__callStatic()
Parse partial source by delegating calls to the internal parseX methods.
public
static __callStatic(string $name, array<string|int, bool> $arguments) : mixed
Parameters
- $name : string
- $arguments : array<string|int, bool>
Tags
Return values
mixed —__construct()
public
__construct(Source|string $source[, array<string|int, bool> $options = [] ]) : mixed
Parameters
- $source : Source|string
- $options : array<string|int, bool> = []
Return values
mixed —argument()
public
static argument(Source|string $source, array<string|int, bool> $options = []) : ArgumentNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
ArgumentNode —array()
public
static array(Source|string $source, array<string|int, bool> $options = []) : ListValueNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
ListValueNode —constArgument()
public
static constArgument(Source|string $source, array<string|int, bool> $options = []) : ArgumentNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
ArgumentNode —constArray()
public
static constArray(Source|string $source, array<string|int, bool> $options = []) : ListValueNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
ListValueNode —constDirective()
public
static constDirective(Source|string $source, array<string|int, bool> $options = []) : DirectiveNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
DirectiveNode —constObject()
public
static constObject(Source|string $source, array<string|int, bool> $options = []) : ObjectValueNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
ObjectValueNode —constObjectField()
public
static constObjectField(Source|string $source, array<string|int, bool> $options = []) : ObjectFieldNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
ObjectFieldNode —constValue()
public
static constValue(Source|string $source, array<string|int, bool> $options = []) : BooleanValueNode|EnumValueNode|FloatValueNode|IntValueNode|StringValueNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
BooleanValueNode|EnumValueNode|FloatValueNode|IntValueNode|StringValueNode —constValueLiteral()
public
static constValueLiteral(Source|string $source, array<string|int, bool> $options = []) : BooleanValueNode|EnumValueNode|FloatValueNode|IntValueNode|ListValueNode|NullValueNode|ObjectValueNode|StringValueNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
BooleanValueNode|EnumValueNode|FloatValueNode|IntValueNode|ListValueNode|NullValueNode|ObjectValueNode|StringValueNode —definition()
public
static definition(Source|string $source, array<string|int, bool> $options = []) : ExecutableDefinitionNode|TypeSystemDefinitionNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
ExecutableDefinitionNode|TypeSystemDefinitionNode —description()
public
static description(Source|string $source, array<string|int, bool> $options = []) : StringValueNode|null
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
StringValueNode|null —directive()
public
static directive(Source|string $source, array<string|int, bool> $options = []) : DirectiveNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
DirectiveNode —directiveDefinition()
public
static directiveDefinition(Source|string $source, array<string|int, bool> $options = []) : DirectiveDefinitionNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
DirectiveDefinitionNode —directiveLocation()
public
static directiveLocation(Source|string $source, array<string|int, bool> $options = []) : NameNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
NameNode —document()
public
static document(Source|string $source, array<string|int, bool> $options = []) : DocumentNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
DocumentNode —enumTypeDefinition()
public
static enumTypeDefinition(Source|string $source, array<string|int, bool> $options = []) : EnumTypeDefinitionNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
EnumTypeDefinitionNode —enumTypeExtension()
public
static enumTypeExtension(Source|string $source, array<string|int, bool> $options = []) : EnumTypeExtensionNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
EnumTypeExtensionNode —enumValueDefinition()
public
static enumValueDefinition(Source|string $source, array<string|int, bool> $options = []) : EnumValueDefinitionNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
EnumValueDefinitionNode —executableDefinition()
public
static executableDefinition(Source|string $source, array<string|int, bool> $options = []) : ExecutableDefinitionNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
ExecutableDefinitionNode —field()
public
static field(Source|string $source, array<string|int, bool> $options = []) : FieldNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
FieldNode —fieldDefinition()
public
static fieldDefinition(Source|string $source, array<string|int, bool> $options = []) : FieldDefinitionNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
FieldDefinitionNode —fragment()
public
static fragment(Source|string $source, array<string|int, bool> $options = []) : FragmentSpreadNode|InlineFragmentNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
FragmentSpreadNode|InlineFragmentNode —fragmentDefinition()
public
static fragmentDefinition(Source|string $source, array<string|int, bool> $options = []) : FragmentDefinitionNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
FragmentDefinitionNode —fragmentName()
public
static fragmentName(Source|string $source, array<string|int, bool> $options = []) : NameNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
NameNode —inputObjectTypeDefinition()
public
static inputObjectTypeDefinition(Source|string $source, array<string|int, bool> $options = []) : InputObjectTypeDefinitionNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
InputObjectTypeDefinitionNode —inputObjectTypeExtension()
public
static inputObjectTypeExtension(Source|string $source, array<string|int, bool> $options = []) : InputObjectTypeExtensionNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
InputObjectTypeExtensionNode —inputValueDefinition()
public
static inputValueDefinition(Source|string $source, array<string|int, bool> $options = []) : InputValueDefinitionNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
InputValueDefinitionNode —interfaceTypeDefinition()
public
static interfaceTypeDefinition(Source|string $source, array<string|int, bool> $options = []) : InterfaceTypeDefinitionNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
InterfaceTypeDefinitionNode —interfaceTypeExtension()
public
static interfaceTypeExtension(Source|string $source, array<string|int, bool> $options = []) : InterfaceTypeExtensionNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
InterfaceTypeExtensionNode —name()
public
static name(Source|string $source, array<string|int, bool> $options = []) : NameNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
NameNode —namedType()
public
static namedType(Source|string $source, array<string|int, bool> $options = []) : NamedTypeNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
NamedTypeNode —NodeList()
public
static NodeList() : void
<VariableDefinitionNode> variableDefinitions(Source|string $source, bool[] $options = [])
Return values
void —NodeList()
public
static NodeList() : void
<ArgumentNode> arguments(Source|string $source, bool[] $options = [])
Return values
void —NodeList()
public
static NodeList() : void
<ArgumentNode> constArguments(Source|string $source, bool[] $options = [])
Return values
void —NodeList()
public
static NodeList() : void
<DirectiveNode> directives(Source|string $source, bool[] $options = [])
Return values
void —NodeList()
public
static NodeList() : void
<DirectiveNode> constDirectives(Source|string $source, bool[] $options = [])
Return values
void —NodeList()
public
static NodeList() : void
<NamedTypeNode> implementsInterfaces(Source|string $source, bool[] $options = [])
Return values
void —NodeList()
public
static NodeList() : void
<FieldDefinitionNode> fieldsDefinition(Source|string $source, bool[] $options = [])
Return values
void —NodeList()
public
static NodeList() : void
<InputValueDefinitionNode> argumentsDefinition(Source|string $source, bool[] $options = [])
Return values
void —NodeList()
public
static NodeList() : void
<NamedTypeNode> unionMemberTypes(Source|string $source, bool[] $options = [])
Return values
void —NodeList()
public
static NodeList() : void
<EnumValueDefinitionNode> enumValuesDefinition(Source|string $source, bool[] $options = [])
Return values
void —NodeList()
public
static NodeList() : void
<InputValueDefinitionNode> inputFieldsDefinition(Source|string $source, bool[] $options = [])
Return values
void —NodeList()
public
static NodeList() : void
<NameNode> directiveLocations(Source|string $source, bool[] $options = [])
Return values
void —object()
public
static object(Source|string $source, array<string|int, bool> $options = []) : ObjectValueNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
ObjectValueNode —objectField()
public
static objectField(Source|string $source, array<string|int, bool> $options = []) : ObjectFieldNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
ObjectFieldNode —objectTypeDefinition()
public
static objectTypeDefinition(Source|string $source, array<string|int, bool> $options = []) : ObjectTypeDefinitionNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
ObjectTypeDefinitionNode —objectTypeExtension()
public
static objectTypeExtension(Source|string $source, array<string|int, bool> $options = []) : ObjectTypeExtensionNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
ObjectTypeExtensionNode —operationDefinition()
public
static operationDefinition(Source|string $source, array<string|int, bool> $options = []) : OperationDefinitionNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
OperationDefinitionNode —operationType()
public
static operationType(Source|string $source, array<string|int, bool> $options = []) : string
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
string —operationTypeDefinition()
public
static operationTypeDefinition(Source|string $source, array<string|int, bool> $options = []) : OperationTypeDefinitionNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
OperationTypeDefinitionNode —parse()
Given a GraphQL source, parses it into a `GraphQL\Language\AST\DocumentNode`.
public
static parse(Source|string $source[, array<string|int, bool> $options = [] ]) : DocumentNode
Throws GraphQL\Error\SyntaxError
if a syntax error is encountered.
Available options:
noLocation: boolean, (By default, the parser creates AST nodes that know the location in the source that they correspond to. This configuration flag disables that behavior for performance or testing.)
allowLegacySDLEmptyFields: boolean If enabled, the parser will parse empty fields sets in the Schema Definition Language. Otherwise, the parser will follow the current specification.
This option is provided to ease adoption of the final SDL specification and will be removed in a future major release.
allowLegacySDLImplementsInterfaces: boolean
If enabled, the parser will parse implemented interfaces with no &
character between each interface. Otherwise, the parser will follow the
current specification.
This option is provided to ease adoption of the final SDL specification and will be removed in a future major release.
experimentalFragmentVariables: boolean,
(If enabled, the parser will understand and parse variable definitions
contained in a fragment definition. They'll be represented in the
variableDefinitions
field of the FragmentDefinitionNode.
The syntax is identical to normal, query-defined variables. For example:
fragment A($var: Boolean = false) on T {
...
}
Note: this feature is experimental and may change or be removed in the future.)
Parameters
- $source : Source|string
- $options : array<string|int, bool> = []
Tags
Return values
DocumentNode —parseType()
Given a string containing a GraphQL Type (ex. `[Int!]`), parse the AST for that type.
public
static parseType(Source|string $source[, array<string|int, bool> $options = [] ]) : ListTypeNode|NamedTypeNode|NonNullTypeNode
Throws GraphQL\Error\SyntaxError
if a syntax error is encountered.
This is useful within tools that operate upon GraphQL Types directly and in isolation of complete GraphQL documents.
Consider providing the results to the utility function: GraphQL\Utils\AST::typeFromAST()
.
Parameters
- $source : Source|string
- $options : array<string|int, bool> = []
Return values
ListTypeNode|NamedTypeNode|NonNullTypeNode —parseValue()
Given a string containing a GraphQL value (ex. `[42]`), parse the AST for that value.
public
static parseValue(Source|string $source[, array<string|int, bool> $options = [] ]) : BooleanValueNode|EnumValueNode|FloatValueNode|IntValueNode|ListValueNode|ObjectValueNode|StringValueNode|VariableNode
Throws GraphQL\Error\SyntaxError
if a syntax error is encountered.
This is useful within tools that operate upon GraphQL Values directly and in isolation of complete GraphQL documents.
Consider providing the results to the utility function: GraphQL\Utils\AST::valueFromAST()
.
Parameters
- $source : Source|string
- $options : array<string|int, bool> = []
Return values
BooleanValueNode|EnumValueNode|FloatValueNode|IntValueNode|ListValueNode|ObjectValueNode|StringValueNode|VariableNode —scalarTypeDefinition()
public
static scalarTypeDefinition(Source|string $source, array<string|int, bool> $options = []) : ScalarTypeDefinitionNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
ScalarTypeDefinitionNode —scalarTypeExtension()
public
static scalarTypeExtension(Source|string $source, array<string|int, bool> $options = []) : ScalarTypeExtensionNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
ScalarTypeExtensionNode —schemaDefinition()
public
static schemaDefinition(Source|string $source, array<string|int, bool> $options = []) : SchemaDefinitionNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
SchemaDefinitionNode —schemaTypeExtension()
public
static schemaTypeExtension(Source|string $source, array<string|int, bool> $options = []) : SchemaTypeExtensionNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
SchemaTypeExtensionNode —selection()
public
static selection(Source|string $source, array<string|int, bool> $options = []) : mixed
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
mixed —selectionSet()
public
static selectionSet(Source|string $source, array<string|int, bool> $options = []) : SelectionSetNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
SelectionSetNode —stringLiteral()
public
static stringLiteral(Source|string $source, array<string|int, bool> $options = []) : StringValueNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
StringValueNode —typeExtension()
public
static typeExtension(Source|string $source, array<string|int, bool> $options = []) : TypeExtensionNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
TypeExtensionNode —typeReference()
public
static typeReference(Source|string $source, array<string|int, bool> $options = []) : ListTypeNode|NamedTypeNode|NonNullTypeNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
ListTypeNode|NamedTypeNode|NonNullTypeNode —typeSystemDefinition()
public
static typeSystemDefinition(Source|string $source, array<string|int, bool> $options = []) : TypeSystemDefinitionNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
TypeSystemDefinitionNode —unionTypeDefinition()
public
static unionTypeDefinition(Source|string $source, array<string|int, bool> $options = []) : UnionTypeDefinitionNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
UnionTypeDefinitionNode —unionTypeExtension()
public
static unionTypeExtension(Source|string $source, array<string|int, bool> $options = []) : UnionTypeExtensionNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
UnionTypeExtensionNode —valueLiteral()
public
static valueLiteral(Source|string $source, array<string|int, bool> $options = []) : BooleanValueNode|EnumValueNode|FloatValueNode|IntValueNode|ListValueNode|NullValueNode|ObjectValueNode|StringValueNode|VariableNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
BooleanValueNode|EnumValueNode|FloatValueNode|IntValueNode|ListValueNode|NullValueNode|ObjectValueNode|StringValueNode|VariableNode —variable()
public
static variable(Source|string $source, array<string|int, bool> $options = []) : VariableNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
VariableNode —variableDefinition()
public
static variableDefinition(Source|string $source, array<string|int, bool> $options = []) : VariableDefinitionNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
VariableDefinitionNode —variableValue()
public
static variableValue(Source|string $source, array<string|int, bool> $options = []) : BooleanValueNode|EnumValueNode|FloatValueNode|IntValueNode|ListValueNode|ObjectValueNode|StringValueNode|VariableNode
Parameters
- $source : Source|string
- $options = [] : array<string|int, bool>
Return values
BooleanValueNode|EnumValueNode|FloatValueNode|IntValueNode|ListValueNode|ObjectValueNode|StringValueNode|VariableNode —any()
Returns a possibly empty list of parse nodes, determined by the parseFn. This list begins with a lex token of openKind and ends with a lex token of closeKind. Advances the parser to the next lex token after the closing token.
private
any(string $openKind, callable $parseFn, string $closeKind) : NodeList
Parameters
- $openKind : string
- $parseFn : callable
- $closeKind : string
Tags
Return values
NodeList —expect()
If the next token is of the given kind, return that token after advancing the parser. Otherwise, do not change the parser state and return false.
private
expect(string $kind) : Token
Parameters
- $kind : string
Tags
Return values
Token —expectKeyword()
If the next token is a keyword with the given value, advance the lexer.
private
expectKeyword(string $value) : void
Otherwise, throw an error.
Parameters
- $value : string
Tags
Return values
void —expectOptionalKeyword()
If the next token is a given keyword, return "true" after advancing the lexer. Otherwise, do not change the parser state and return "false".
private
expectOptionalKeyword(string $value) : bool
Parameters
- $value : string
Return values
bool —loc()
Returns a location object, used to identify the place in the source that created a given parsed object.
private
loc(Token $startToken) : Location|null
Parameters
- $startToken : Token
Return values
Location|null —many()
Returns a non-empty list of parse nodes, determined by the parseFn. This list begins with a lex token of openKind and ends with a lex token of closeKind. Advances the parser to the next lex token after the closing token.
private
many(string $openKind, callable $parseFn, string $closeKind) : NodeList
Parameters
- $openKind : string
- $parseFn : callable
- $closeKind : string
Tags
Return values
NodeList —parseArgument()
private
parseArgument() : ArgumentNode
Tags
Return values
ArgumentNode —parseArguments()
private
parseArguments(bool $isConst) : NodeList
Parameters
- $isConst : bool
Tags
Return values
NodeList —parseArgumentsDefinition()
private
parseArgumentsDefinition() : NodeList
Tags
Return values
NodeList —parseArray()
private
parseArray(bool $isConst) : ListValueNode
Parameters
- $isConst : bool
Return values
ListValueNode —parseConstArgument()
private
parseConstArgument() : ArgumentNode
Tags
Return values
ArgumentNode —parseConstValue()
private
parseConstValue() : BooleanValueNode|EnumValueNode|FloatValueNode|IntValueNode|StringValueNode|VariableNode
Tags
Return values
BooleanValueNode|EnumValueNode|FloatValueNode|IntValueNode|StringValueNode|VariableNode —parseDefinition()
private
parseDefinition() : ExecutableDefinitionNode|TypeSystemDefinitionNode
Tags
Return values
ExecutableDefinitionNode|TypeSystemDefinitionNode —parseDescription()
private
parseDescription() : StringValueNode|null
Return values
StringValueNode|null —parseDirective()
private
parseDirective(bool $isConst) : DirectiveNode
Parameters
- $isConst : bool
Tags
Return values
DirectiveNode —parseDirectiveDefinition()
DirectiveDefinition : - Description? directive @ Name ArgumentsDefinition? `repeatable`? on DirectiveLocations
private
parseDirectiveDefinition() : DirectiveDefinitionNode
Tags
Return values
DirectiveDefinitionNode —parseDirectiveLocation()
private
parseDirectiveLocation() : NameNode
Tags
Return values
NameNode —parseDirectiveLocations()
private
parseDirectiveLocations() : NodeList
Tags
Return values
NodeList —parseDirectives()
private
parseDirectives(bool $isConst) : NodeList
Parameters
- $isConst : bool
Tags
Return values
NodeList —parseDocument()
Implements the parsing rules in the Document section.
private
parseDocument() : DocumentNode
Tags
Return values
DocumentNode —parseEnumTypeDefinition()
private
parseEnumTypeDefinition() : EnumTypeDefinitionNode
Tags
Return values
EnumTypeDefinitionNode —parseEnumTypeExtension()
private
parseEnumTypeExtension() : EnumTypeExtensionNode
Tags
Return values
EnumTypeExtensionNode —parseEnumValueDefinition()
private
parseEnumValueDefinition() : EnumValueDefinitionNode
Tags
Return values
EnumValueDefinitionNode —parseEnumValuesDefinition()
private
parseEnumValuesDefinition() : NodeList
Tags
Return values
NodeList —parseExecutableDefinition()
private
parseExecutableDefinition() : ExecutableDefinitionNode
Tags
Return values
ExecutableDefinitionNode —parseField()
private
parseField() : FieldNode
Tags
Return values
FieldNode —parseFieldDefinition()
private
parseFieldDefinition() : FieldDefinitionNode
Tags
Return values
FieldDefinitionNode —parseFieldsDefinition()
private
parseFieldsDefinition() : NodeList
Tags
Return values
NodeList —parseFragment()
private
parseFragment() : FragmentSpreadNode|InlineFragmentNode
Tags
Return values
FragmentSpreadNode|InlineFragmentNode —parseFragmentDefinition()
private
parseFragmentDefinition() : FragmentDefinitionNode
Tags
Return values
FragmentDefinitionNode —parseFragmentName()
private
parseFragmentName() : NameNode
Tags
Return values
NameNode —parseImplementsInterfaces()
ImplementsInterfaces : - implements `&`? NamedType - ImplementsInterfaces & NamedType
private
parseImplementsInterfaces() : NodeList
Return values
NodeList —parseInputFieldsDefinition()
private
parseInputFieldsDefinition() : NodeList
Tags
Return values
NodeList —parseInputObjectTypeDefinition()
private
parseInputObjectTypeDefinition() : InputObjectTypeDefinitionNode
Tags
Return values
InputObjectTypeDefinitionNode —parseInputObjectTypeExtension()
private
parseInputObjectTypeExtension() : InputObjectTypeExtensionNode
Tags
Return values
InputObjectTypeExtensionNode —parseInputValueDefinition()
private
parseInputValueDefinition() : InputValueDefinitionNode
Tags
Return values
InputValueDefinitionNode —parseInterfaceTypeDefinition()
private
parseInterfaceTypeDefinition() : InterfaceTypeDefinitionNode
Tags
Return values
InterfaceTypeDefinitionNode —parseInterfaceTypeExtension()
private
parseInterfaceTypeExtension() : InterfaceTypeExtensionNode
Tags
Return values
InterfaceTypeExtensionNode —parseName()
Converts a name lex token into a name parse node.
private
parseName() : NameNode
Tags
Return values
NameNode —parseNamedType()
private
parseNamedType() : NamedTypeNode
Return values
NamedTypeNode —parseObject()
private
parseObject(bool $isConst) : ObjectValueNode
Parameters
- $isConst : bool
Return values
ObjectValueNode —parseObjectField()
private
parseObjectField(bool $isConst) : ObjectFieldNode
Parameters
- $isConst : bool
Return values
ObjectFieldNode —parseObjectTypeDefinition()
private
parseObjectTypeDefinition() : ObjectTypeDefinitionNode
Tags
Return values
ObjectTypeDefinitionNode —parseObjectTypeExtension()
private
parseObjectTypeExtension() : ObjectTypeExtensionNode
Tags
Return values
ObjectTypeExtensionNode —parseOperationDefinition()
private
parseOperationDefinition() : OperationDefinitionNode
Tags
Return values
OperationDefinitionNode —parseOperationType()
private
parseOperationType() : string
Tags
Return values
string —parseOperationTypeDefinition()
private
parseOperationTypeDefinition() : OperationTypeDefinitionNode
Tags
Return values
OperationTypeDefinitionNode —parseScalarTypeDefinition()
private
parseScalarTypeDefinition() : ScalarTypeDefinitionNode
Tags
Return values
ScalarTypeDefinitionNode —parseScalarTypeExtension()
private
parseScalarTypeExtension() : ScalarTypeExtensionNode
Tags
Return values
ScalarTypeExtensionNode —parseSchemaDefinition()
private
parseSchemaDefinition() : SchemaDefinitionNode
Tags
Return values
SchemaDefinitionNode —parseSchemaTypeExtension()
private
parseSchemaTypeExtension() : SchemaTypeExtensionNode
Tags
Return values
SchemaTypeExtensionNode —parseSelection()
Selection : - Field - FragmentSpread - InlineFragment
private
parseSelection() : SelectionNode
Return values
SelectionNode —parseSelectionSet()
private
parseSelectionSet() : SelectionSetNode
Return values
SelectionSetNode —parseStringLiteral()
private
parseStringLiteral() : StringValueNode
Return values
StringValueNode —parseTypeExtension()
TypeExtension : - ScalarTypeExtension - ObjectTypeExtension - InterfaceTypeExtension - UnionTypeExtension - EnumTypeExtension - InputObjectTypeDefinition
private
parseTypeExtension() : TypeExtensionNode
Tags
Return values
TypeExtensionNode —parseTypeReference()
Handles the Type: TypeName, ListType, and NonNullType parsing rules.
private
parseTypeReference() : ListTypeNode|NamedTypeNode|NonNullTypeNode
Tags
Return values
ListTypeNode|NamedTypeNode|NonNullTypeNode —parseTypeSystemDefinition()
TypeSystemDefinition : - SchemaDefinition - TypeDefinition - TypeExtension - DirectiveDefinition
private
parseTypeSystemDefinition() : TypeSystemDefinitionNode
TypeDefinition :
- ScalarTypeDefinition
- ObjectTypeDefinition
- InterfaceTypeDefinition
- UnionTypeDefinition
- EnumTypeDefinition
- InputObjectTypeDefinition
Tags
Return values
TypeSystemDefinitionNode —parseUnionMemberTypes()
UnionMemberTypes : - = `|`? NamedType - UnionMemberTypes | NamedType
private
parseUnionMemberTypes() : NodeList
Return values
NodeList —parseUnionTypeDefinition()
UnionTypeDefinition : - Description? union Name Directives[Const]? UnionMemberTypes?
private
parseUnionTypeDefinition() : UnionTypeDefinitionNode
Tags
Return values
UnionTypeDefinitionNode —parseUnionTypeExtension()
UnionTypeExtension : - extend union Name Directives[Const]? UnionMemberTypes - extend union Name Directives[Const]
private
parseUnionTypeExtension() : UnionTypeExtensionNode
Tags
Return values
UnionTypeExtensionNode —parseValueLiteral()
Value[Const] : - [~Const] Variable - IntValue - FloatValue - StringValue - BooleanValue - NullValue - EnumValue - ListValue[?Const] - ObjectValue[?Const]
private
parseValueLiteral(bool $isConst) : BooleanValueNode|EnumValueNode|FloatValueNode|IntValueNode|StringValueNode|VariableNode|ListValueNode|ObjectValueNode|NullValueNode
BooleanValue : one of true
false
NullValue : null
EnumValue : Name but not true
, false
or null
Parameters
- $isConst : bool
Tags
Return values
BooleanValueNode|EnumValueNode|FloatValueNode|IntValueNode|StringValueNode|VariableNode|ListValueNode|ObjectValueNode|NullValueNode —parseVariable()
private
parseVariable() : VariableNode
Tags
Return values
VariableNode —parseVariableDefinition()
private
parseVariableDefinition() : VariableDefinitionNode
Tags
Return values
VariableDefinitionNode —parseVariableDefinitions()
private
parseVariableDefinitions() : NodeList
Return values
NodeList —parseVariableValue()
private
parseVariableValue() : BooleanValueNode|EnumValueNode|FloatValueNode|IntValueNode|ListValueNode|ObjectValueNode|StringValueNode|VariableNode
Return values
BooleanValueNode|EnumValueNode|FloatValueNode|IntValueNode|ListValueNode|ObjectValueNode|StringValueNode|VariableNode —peek()
Determines if the next token is of a given kind
private
peek(string $kind) : bool
Parameters
- $kind : string
Return values
bool —peekDescription()
private
peekDescription() : bool
Return values
bool —skip()
If the next token is of the given kind, return true after advancing the parser. Otherwise, do not change the parser state and return false.
private
skip(string $kind) : bool
Parameters
- $kind : string
Return values
bool —unexpected()
private
unexpected([Token|null $atToken = null ]) : SyntaxError
Parameters
- $atToken : Token|null = null