WooCommerce Code Reference

ASTDefinitionBuilder
in package

Tags
see

FieldDefinition, InputObjectField

phpstan-import-type

UnnamedFieldDefinitionConfig from FieldDefinition

phpstan-import-type

InputObjectFieldConfig from InputObjectField

phpstan-import-type

UnnamedInputObjectFieldConfig from InputObjectField

phpstan-type

ResolveType callable(string, Node|null): (Type&NamedType)

phpstan-type

TypeConfigDecorator callable(array<string, mixed>, Node&TypeDefinitionNode, array<string, Node&TypeDefinitionNode>): array<string, mixed>

phpstan-type

FieldConfigDecorator callable(UnnamedFieldDefinitionConfig, FieldDefinitionNode, ObjectTypeDefinitionNode|ObjectTypeExtensionNode|InterfaceTypeDefinitionNode|InterfaceTypeExtensionNode): UnnamedFieldDefinitionConfig

Table of Contents

$cache  : array<string|int, mixed>
$fieldConfigDecorator  : callable|null
$resolveType  : callable
$typeConfigDecorator  : callable|null
$typeDefinitionsMap  : array<string|int, mixed>
$typeExtensionsMap  : array<string|int, mixed>
__construct()  : mixed
buildDirective()  : Directive
buildEnumValue()  : array<string, mixed>
buildField()  : UnnamedFieldDefinitionConfig
buildInputField()  : InputObjectFieldConfig
buildType()  : Type|NamedType
maybeBuildType()  : (\Automattic\WooCommerce\Vendor\GraphQL\Type\Definition\Type&\Automattic\WooCommerce\Vendor\GraphQL\Type\Definition\NamedType)|null
Calling this method is an equivalent of `typeMap[typeName]` in `graphql-js`.
buildWrappedType()  : Type
getDeprecationReason()  : string|null
Given a collection of directives, returns the string value for the deprecation reason.
internalBuildType()  : Type|NamedType
makeEnumDef()  : EnumType
makeFieldDefMap()  : array<string|int, mixed>
makeImplementedInterfaces()  : array<int, InterfaceType>
makeInputFields()  : array<string, UnnamedInputObjectFieldConfig>
makeInputObjectDef()  : InputObjectType
makeInputValues()  : array<string, UnnamedInputObjectFieldConfig>
makeInterfaceDef()  : InterfaceType
makeScalarDef()  : CustomScalarType
makeSchemaDef()  : CustomScalarType|EnumType|InputObjectType|InterfaceType|ObjectType|UnionType
makeSchemaDefFromConfig()  : CustomScalarType|EnumType|InputObjectType|InterfaceType|ObjectType|UnionType
makeTypeDef()  : ObjectType
makeUnionDef()  : UnionType

Properties

Methods

__construct()

public __construct(array<string, \Automattic\WooCommerce\Vendor\GraphQL\Language\AST\Node&\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\TypeDefinitionNode> $typeDefinitionsMap, array<string, array<int, \Automattic\WooCommerce\Vendor\GraphQL\Language\AST\Node&\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\TypeExtensionNode>> $typeExtensionsMap, callable $resolveType[, callable|null $typeConfigDecorator = null ][, callable|null $fieldConfigDecorator = null ]) : mixed
Parameters
$typeDefinitionsMap : array<string, \Automattic\WooCommerce\Vendor\GraphQL\Language\AST\Node&\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\TypeDefinitionNode>
$typeExtensionsMap : array<string, array<int, \Automattic\WooCommerce\Vendor\GraphQL\Language\AST\Node&\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\TypeExtensionNode>>
$resolveType : callable
$typeConfigDecorator : callable|null = null
$fieldConfigDecorator : callable|null = null
Tags
phpstan-param

ResolveType $resolveType

phpstan-param

TypeConfigDecorator|null $typeConfigDecorator

throws
InvariantViolation
Return values
mixed

buildType()

public buildType(string|(\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\Node&\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\NamedTypeNode)|(\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\Node&\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\TypeDefinitionNode) $ref) : Type|NamedType
Parameters
$ref : string|(\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\Node&\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\NamedTypeNode)|(\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\Node&\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\TypeDefinitionNode)
Tags
throws
Exception
throws
ReflectionException
throws
Error
throws
InvariantViolation
Return values
Type|NamedType

maybeBuildType()

Calling this method is an equivalent of `typeMap[typeName]` in `graphql-js`.

public maybeBuildType(string $name) : (\Automattic\WooCommerce\Vendor\GraphQL\Type\Definition\Type&\Automattic\WooCommerce\Vendor\GraphQL\Type\Definition\NamedType)|null

It is legal to access a type from the map of already-built types that doesn't exist in the map. Since we build types lazily, and we don't have a such map of built types, this method provides a way to build a type that may not exist in the SDL definitions and returns null instead.

Parameters
$name : string
Tags
throws
Exception
throws
ReflectionException
throws
Error
throws
InvariantViolation
Return values
(\Automattic\WooCommerce\Vendor\GraphQL\Type\Definition\Type&\Automattic\WooCommerce\Vendor\GraphQL\Type\Definition\NamedType)|null

internalBuildType()

private internalBuildType(string $typeName[, (\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\Node&\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\NamedTypeNode)|(\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\Node&\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\TypeDefinitionNode)|null $typeNode = null ]) : Type|NamedType
Parameters
$typeName : string
$typeNode : (\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\Node&\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\NamedTypeNode)|(\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\Node&\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\TypeDefinitionNode)|null = null
Tags
throws
Exception
throws
ReflectionException
throws
Error
throws
InvariantViolation
Return values
Type|NamedType

makeFieldDefMap()

private makeFieldDefMap(array<string|int, \Automattic\WooCommerce\Vendor\GraphQL\Language\AST\ObjectTypeDefinitionNode|\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\ObjectTypeExtensionNode|\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\InterfaceTypeDefinitionNode|\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\InterfaceTypeExtensionNode> $nodes) : array<string|int, mixed>
Parameters
$nodes : array<string|int, \Automattic\WooCommerce\Vendor\GraphQL\Language\AST\ObjectTypeDefinitionNode|\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\ObjectTypeExtensionNode|\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\InterfaceTypeDefinitionNode|\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\InterfaceTypeExtensionNode>
Tags
throws
Exception
phpstan-return

array<string, UnnamedFieldDefinitionConfig>

Return values
array<string|int, mixed>

makeImplementedInterfaces()

private makeImplementedInterfaces(array<string|int, \Automattic\WooCommerce\Vendor\GraphQL\Language\AST\ObjectTypeDefinitionNode|\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\ObjectTypeExtensionNode|\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\InterfaceTypeDefinitionNode|\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\InterfaceTypeExtensionNode> $nodes) : array<int, InterfaceType>
Parameters
$nodes : array<string|int, \Automattic\WooCommerce\Vendor\GraphQL\Language\AST\ObjectTypeDefinitionNode|\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\ObjectTypeExtensionNode|\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\InterfaceTypeDefinitionNode|\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\InterfaceTypeExtensionNode>
Tags
throws
Exception
throws
Error
throws
InvariantViolation
Return values
array<int, InterfaceType>

makeInputFields()

private makeInputFields(array<string|int, \Automattic\WooCommerce\Vendor\GraphQL\Language\AST\InputObjectTypeDefinitionNode|\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\InputObjectTypeExtensionNode> $nodes) : array<string, UnnamedInputObjectFieldConfig>
Parameters
$nodes : array<string|int, \Automattic\WooCommerce\Vendor\GraphQL\Language\AST\InputObjectTypeDefinitionNode|\Automattic\WooCommerce\Vendor\GraphQL\Language\AST\InputObjectTypeExtensionNode>
Tags
throws
Exception
Return values
array<string, UnnamedInputObjectFieldConfig>