WooCommerce Code Reference

SchemaConfig
in package

Configuration options for schema construction.

The options accepted by the create method are described in the schema definition docs.

Usage example:

$config = SchemaConfig::create()
    ->setQuery($myQueryType)
    ->setTypeLoader($myTypeLoader);

$schema = new Schema($config);
Tags
see

Type, NamedType

phpstan-type

MaybeLazyObjectType ObjectType|(callable(): (ObjectType|null))|null

phpstan-type

TypeLoader callable(string $typeName): ((Type&NamedType)|null)

phpstan-type

Types iterable<Type&NamedType>|(callable(): iterable<Type&NamedType>)|iterable<(callable(): Type&NamedType)>|(callable(): iterable<(callable(): Type&NamedType)>)

phpstan-type

SchemaConfigOptions array{ description?: string|null, query?: MaybeLazyObjectType, mutation?: MaybeLazyObjectType, subscription?: MaybeLazyObjectType, types?: Types|null, directives?: array|null, typeLoader?: TypeLoader|null, assumeValid?: bool|null, astNode?: SchemaDefinitionNode|null, extensionASTNodes?: array|null, }

Table of Contents

$assumeValid  : bool
$astNode  : SchemaDefinitionNode|null
$description  : string|null
$directives  : array<string|int, mixed>|null
$extensionASTNodes  : array<string|int, mixed>
$mutation  : MaybeLazyObjectType
$query  : MaybeLazyObjectType
$subscription  : MaybeLazyObjectType
$typeLoader  : callable|null
$types  : iteratable<string|int, mixed>|callable
create()  : self
Converts an array of options to instance of SchemaConfig (or just returns empty config when array is not passed).
getAssumeValid()  : bool
getAstNode()  : SchemaDefinitionNode|null
getDescription()  : string|null
getDirectives()  : array<string|int, Directive>|null
getExtensionASTNodes()  : array<string|int, SchemaExtensionNode>
getMutation()  : MaybeLazyObjectType
getQuery()  : MaybeLazyObjectType
getSubscription()  : MaybeLazyObjectType
getTypeLoader()  : callable|null
getTypes()  : array<string|int, mixed>|callable
setAssumeValid()  : self
setAstNode()  : self
setDescription()  : self
setDirectives()  : self
setExtensionASTNodes()  : self
setMutation()  : self
setQuery()  : self
setSubscription()  : self
setTypeLoader()  : self
setTypes()  : self
assertMaybeLazyObjectType()  : void

Properties

Methods

create()

Converts an array of options to instance of SchemaConfig (or just returns empty config when array is not passed).

public static create([array<string|int, mixed> $options = [] ]) : self
Parameters
$options : array<string|int, mixed> = []
Tags
phpstan-param

SchemaConfigOptions $options

throws
InvariantViolation
Return values
self

setTypeLoader()

public setTypeLoader(callable|null $typeLoader) : self
Parameters
$typeLoader : callable|null
Tags
phpstan-param

TypeLoader|null $typeLoader

Return values
self

setTypes()

public setTypes(array<string|int, mixed>|callable $types) : self
Parameters
$types : array<string|int, mixed>|callable
Tags
phpstan-param

Types $types

Return values
self