Automattic\WooCommerce\Vendor\GraphQL\Type\Definition
NonNull{}└─ WrappingType, OutputType, InputType, Type
No Hooks.
Usage
$NonNull = new NonNull(); // use class methods
Methods
- public __construct($type)
- public getInnermostType()
- public getWrappedType()
- public toString()
NonNull{} NonNull{} code WC 10.9.1
class NonNull extends Type implements WrappingType, OutputType, InputType
{
/**
* @var Type|callable
*
* @phpstan-var WrappedType
*/
private $wrappedType;
/**
* @param Type|callable $type
*
* @phpstan-param WrappedType $type
*/
public function __construct($type)
{
$this->wrappedType = $type;
}
public function toString(): string
{
return $this->getWrappedType()->toString() . '!';
}
/** @return NullableType&Type */
public function getWrappedType(): Type
{
return Schema::resolveType($this->wrappedType);
}
public function getInnermostType(): NamedType
{
$type = $this->getWrappedType();
while ($type instanceof WrappingType) {
$type = $type->getWrappedType();
}
assert($type instanceof NamedType, 'known because we unwrapped all the way down');
return $type;
}
}