Documentation

EnumType extends Type
in package
implements InputType, OutputType, LeafType, NullableType, NamedType

Registry of standard GraphQL types and a base class for all other types.

Interfaces, Classes, Traits and Enums

InputType
export type InputType = | ScalarType | EnumType | InputObjectType | ListOfType<InputType> | NonNull< | ScalarType | EnumType | InputObjectType | ListOfType<InputType>, >;
OutputType
LeafType
NullableType
NamedType
export type NamedType = | ScalarType | ObjectType | InterfaceType | UnionType | EnumType | InputObjectType;

Table of Contents

BOOLEAN  = 'Boolean'
FLOAT  = 'Float'
ID  = 'ID'
INT  = 'Int'
STRING  = 'String'
$astNode  : EnumTypeDefinitionNode|null
$config  : array<string|int, mixed>
$description  : string|null
$extensionASTNodes  : array<string|int, EnumTypeExtensionNode>
$name  : string
$standardTypes  : array<string, ScalarType>
$builtInTypes  : array<string|int, Type>
$nameLookup  : ArrayObject<string, EnumValueDefinition>
$valueLookup  : MixedStore
Lazily initialized.
$values  : array<string|int, EnumValueDefinition>
Lazily initialized.
__construct()  : mixed
__toString()  : string
assertType()  : Type
assertValid()  : mixed
boolean()  : ScalarType
float()  : ScalarType
getAllBuiltInTypes()  : array<string|int, Type>
Returns all builtin in types including base scalar and introspection types
getInternalTypes()  : array<string|int, Type>
getNamedType()  : Type|null
getNullableType()  : Type
getStandardTypes()  : array<string|int, ScalarType>
Returns all builtin scalar types
getValue()  : EnumValueDefinition|null
getValues()  : array<string|int, EnumValueDefinition>
id()  : ScalarType
int()  : ScalarType
isAbstractType()  : bool
isBuiltInType()  : bool
Checks if the type is a builtin type
isCompositeType()  : bool
isInputType()  : bool
isLeafType()  : bool
isOutputType()  : bool
jsonSerialize()  : string
listOf()  : ListOfType
nonNull()  : NonNull
overrideStandardTypes()  : mixed
parseLiteral()  : null
Parses an externally provided literal value (hardcoded in GraphQL query) to use as an input
parseValue()  : mixed
Parses an externally provided value (query variable) to use as an input
serialize()  : mixed
Serializes an internal value to include in a response.
string()  : ScalarType
toString()  : string
tryInferName()  : string|null
getNameLookup()  : ArrayObject
getValueLookup()  : MixedStore
Actually returns a MixedStore<mixed, EnumValueDefinition>, PHPStan won't let us type it that way

Constants

BOOLEAN

public mixed BOOLEAN = 'Boolean'

FLOAT

public mixed FLOAT = 'Float'

ID

public mixed ID = 'ID'

INT

public mixed INT = 'Int'

STRING

public mixed STRING = 'String'

Properties

$config

public array<string|int, mixed> $config

$description

public string|null $description

$name

public string $name

$builtInTypes

private static array<string|int, Type> $builtInTypes

$valueLookup

Lazily initialized.

private MixedStore $valueLookup

Actually a MixedStore<mixed, EnumValueDefinition>, PHPStan won't let us type it that way.

Methods

__construct()

public __construct(mixed $config) : mixed
Parameters
$config : mixed
Return values
mixed

__toString()

public __toString() : string
Return values
string

assertType()

public static assertType(mixed $type) : Type
Parameters
$type : mixed
Return values
Type

getAllBuiltInTypes()

Returns all builtin in types including base scalar and introspection types

public static getAllBuiltInTypes() : array<string|int, Type>
Return values
array<string|int, Type>

getInternalTypes()

public static getInternalTypes() : array<string|int, Type>
Tags
deprecated

Use method getStandardTypes() instead

codeCoverageIgnore
Return values
array<string|int, Type>

getNamedType()

public static getNamedType(Type $type) : Type|null
Parameters
$type : Type
Return values
Type|null

getNullableType()

public static getNullableType(Type $type) : Type
Parameters
$type : Type
Return values
Type

getStandardTypes()

Returns all builtin scalar types

public static getStandardTypes() : array<string|int, ScalarType>
Return values
array<string|int, ScalarType>

isAbstractType()

public static isAbstractType(Type $type) : bool
Parameters
$type : Type
Return values
bool

isBuiltInType()

Checks if the type is a builtin type

public static isBuiltInType(Type $type) : bool
Parameters
$type : Type
Return values
bool

isCompositeType()

public static isCompositeType(Type $type) : bool
Parameters
$type : Type
Return values
bool

isInputType()

public static isInputType(Type $type) : bool
Parameters
$type : Type
Return values
bool

isLeafType()

public static isLeafType(Type $type) : bool
Parameters
$type : Type
Return values
bool

isOutputType()

public static isOutputType(Type $type) : bool
Parameters
$type : Type
Return values
bool

jsonSerialize()

public jsonSerialize() : string
Return values
string

listOf()

public static listOf(Type $wrappedType) : ListOfType
Parameters
$wrappedType : Type
Return values
ListOfType

nonNull()

public static nonNull(callable|NullableType $wrappedType) : NonNull
Parameters
$wrappedType : callable|NullableType
Return values
NonNull

overrideStandardTypes()

public static overrideStandardTypes(array<string, ScalarType$types) : mixed
Parameters
$types : array<string, ScalarType>
Return values
mixed

parseLiteral()

Parses an externally provided literal value (hardcoded in GraphQL query) to use as an input

public parseLiteral(Node $valueNode[, array<string|int, mixed>|null $variables = null ]) : null
Parameters
$valueNode : Node
$variables : array<string|int, mixed>|null = null
Tags
throws
Exception
Return values
null

parseValue()

Parses an externally provided value (query variable) to use as an input

public parseValue(mixed $value) : mixed
Parameters
$value : mixed
Tags
throws
Error
Return values
mixed

serialize()

Serializes an internal value to include in a response.

public serialize(mixed $value) : mixed
Parameters
$value : mixed
Tags
throws
Error
Return values
mixed

toString()

public toString() : string
Return values
string

tryInferName()

protected tryInferName() : string|null
Return values
string|null

getNameLookup()

private getNameLookup() : ArrayObject
Return values
ArrayObject

getValueLookup()

Actually returns a MixedStore<mixed, EnumValueDefinition>, PHPStan won't let us type it that way

private getValueLookup() : MixedStore
Return values
MixedStore

Search results