WooCommerce Code Reference

BuildSchema
in package

Build instance of @see \Automattic\WooCommerce\Vendor\GraphQL\Type\Schema out of schema language definition (string or parsed AST).

See schema definition language docs for details.

Tags
phpstan-import-type

TypeConfigDecorator from ASTDefinitionBuilder

phpstan-import-type

FieldConfigDecorator from ASTDefinitionBuilder

phpstan-type

BuildSchemaOptions array{ assumeValid?: bool, assumeValidSDL?: bool }

  • assumeValid: When building a schema from a Automattic\WooCommerce\Vendor\GraphQL service's introspection result, it might be safe to assume the schema is valid. Set to true to assume the produced schema is valid. Default: false

  • assumeValidSDL: Set to true to assume the SDL is valid. Default: false

see
BuildSchemaTest

Table of Contents

$ast  : DocumentNode
$fieldConfigDecorator  : callable|null
$options  : array<string|int, mixed>
$typeConfigDecorator  : callable|null
__construct()  : mixed
build()  : Schema
A helper function to build a GraphQLSchema directly from a source document.
buildAST()  : Schema
This takes the AST of a schema from @see \Automattic\WooCommerce\Vendor\GraphQL\Language\Parser::parse().
buildSchema()  : Schema
unknownType()  : Error
getOperationTypes()  : array<string, string>

Properties

Methods

__construct()

public __construct(DocumentNode $ast[, callable|null $typeConfigDecorator = null ][, array<string, bool> $options = [] ][, callable|null $fieldConfigDecorator = null ]) : mixed
Parameters
$ast : DocumentNode
$typeConfigDecorator : callable|null = null
$options : array<string, bool> = []
$fieldConfigDecorator : callable|null = null
Tags
phpstan-param

TypeConfigDecorator|null $typeConfigDecorator

phpstan-param

BuildSchemaOptions $options

Return values
mixed

build()

A helper function to build a GraphQLSchema directly from a source document.

public static build(DocumentNode|Source|string $source[, callable|null $typeConfigDecorator = null ][, array<string, bool> $options = [] ][, callable|null $fieldConfigDecorator = null ]) : Schema
Parameters
$source : DocumentNode|Source|string
$typeConfigDecorator : callable|null = null
$options : array<string, bool> = []
$fieldConfigDecorator : callable|null = null
Tags
phpstan-param

TypeConfigDecorator|null $typeConfigDecorator

phpstan-param

FieldConfigDecorator|null $fieldConfigDecorator

phpstan-param

BuildSchemaOptions $options

throws
Exception
throws
ReflectionException
throws
Error
throws
InvariantViolation
throws
SyntaxError
Return values
Schema

buildAST()

This takes the AST of a schema from @see \Automattic\WooCommerce\Vendor\GraphQL\Language\Parser::parse().

public static buildAST(DocumentNode $ast[, callable|null $typeConfigDecorator = null ][, array<string, bool> $options = [] ][, callable|null $fieldConfigDecorator = null ]) : Schema

If no schema definition is provided, then it will look for types named Query and Mutation.

Given that AST it constructs a @see \Automattic\WooCommerce\Vendor\GraphQL\Type\Schema. The resulting schema has no resolve methods, so execution will use default resolvers.

Parameters
$ast : DocumentNode
$typeConfigDecorator : callable|null = null
$options : array<string, bool> = []
$fieldConfigDecorator : callable|null = null
Tags
phpstan-param

TypeConfigDecorator|null $typeConfigDecorator

phpstan-param

FieldConfigDecorator|null $fieldConfigDecorator

phpstan-param

BuildSchemaOptions $options

throws
Exception
throws
ReflectionException
throws
Error
throws
InvariantViolation
Return values
Schema