Automattic\WooCommerce\Vendor\GraphQL\Utils
ASTDefinitionBuilder::makeSchemaDefFromConfig
Method of the class: ASTDefinitionBuilder{}
No Hooks.
Returns
CustomScalarType|EnumType|InputObjectType|InterfaceType|ObjectType|UnionType.
Usage
// private - for code of main (parent) class only $result = $this->makeSchemaDefFromConfig( $def, $config ): Type;
- $def(Node) (required)
- .
- $config(array) (required)
- .
ASTDefinitionBuilder::makeSchemaDefFromConfig() ASTDefinitionBuilder::makeSchemaDefFromConfig code WC 10.9.1
private function makeSchemaDefFromConfig(Node $def, array $config): Type
{
switch (true) {
case $def instanceof ObjectTypeDefinitionNode:
// @phpstan-ignore-next-line assume the config matches
return new ObjectType($config);
case $def instanceof InterfaceTypeDefinitionNode:
// @phpstan-ignore-next-line assume the config matches
return new InterfaceType($config);
case $def instanceof EnumTypeDefinitionNode:
// @phpstan-ignore-next-line assume the config matches
return new EnumType($config);
case $def instanceof UnionTypeDefinitionNode:
// @phpstan-ignore-next-line assume the config matches
return new UnionType($config);
case $def instanceof ScalarTypeDefinitionNode:
// @phpstan-ignore-next-line assume the config matches
return new CustomScalarType($config);
case $def instanceof InputObjectTypeDefinitionNode:
// @phpstan-ignore-next-line assume the config matches
return new InputObjectType($config);
default:
throw new Error("Type kind of {$def->kind} not supported.");
}
}