Automattic\WooCommerce\Vendor\GraphQL\Type

SchemaConfig::assertMaybeLazyObjectTypeprotectedWC 1.0

Method of the class: SchemaConfig{}

No Hooks.

Returns

null. Nothing (null).

Usage

// protected - for code of main (parent) or child class
$result = $this->assertMaybeLazyObjectType( $maybeLazyObjectType ): void;
$maybeLazyObjectType(mixed) (required)
Should be MaybeLazyObjectType.

SchemaConfig::assertMaybeLazyObjectType() code WC 10.9.4

protected function assertMaybeLazyObjectType($maybeLazyObjectType): void
{
    if ($maybeLazyObjectType instanceof ObjectType || is_callable($maybeLazyObjectType) || is_null($maybeLazyObjectType)) {
        return;
    }

    $notMaybeLazyObjectType = is_object($maybeLazyObjectType)
        ? get_class($maybeLazyObjectType)
        : gettype($maybeLazyObjectType);
    $objectTypeClass = ObjectType::class;
    throw new InvariantViolation("Expected instanceof {$objectTypeClass}, a callable that returns such an instance, or null, got: {$notMaybeLazyObjectType}.");
}