Automattic\WooCommerce\Vendor\GraphQL\Type\Definition
UnionType::getTypes
Method of the class: UnionType{}
No Hooks.
Returns
Array
Usage
$UnionType = new UnionType(); $UnionType->getTypes(): array;
UnionType::getTypes() UnionType::getTypes code WC 10.9.1
public function getTypes(): array
{
if (! isset($this->types)) {
$this->types = [];
$types = $this->config['types'] ?? null; // @phpstan-ignore nullCoalesce.initializedProperty (unnecessary according to types, but can happen during runtime)
if (is_callable($types)) {
$types = $types();
}
if (! is_iterable($types)) {
throw new InvariantViolation("Must provide iterable of types or a callable which returns such an iterable for Union {$this->name}.");
}
foreach ($types as $type) {
$this->types[] = Schema::resolveType($type); // @phpstan-ignore argument.templateType
}
}
return $this->types;
}