Automattic\WooCommerce\Vendor\GraphQL\Utils

ASTDefinitionBuilder::maybeBuildTypepublicWC 1.0

Calling this method is an equivalent of typeMap[typeName] in graphql-js. 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.

Method of the class: ASTDefinitionBuilder{}

No Hooks.

Returns

(Type&NamedType)|null.

Usage

$ASTDefinitionBuilder = new ASTDefinitionBuilder();
$ASTDefinitionBuilder->maybeBuildType( $name ): ?Type;
$name(string) (required)
.

ASTDefinitionBuilder::maybeBuildType() code WC 10.9.1

public function maybeBuildType(string $name): ?Type
{
    return isset($this->typeDefinitionsMap[$name])
        ? $this->buildType($name)
        : null;
}