AiClient::validateModelOrConfigParameter( mixed $modelOrConfig ): void

In this article

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only by core. It is listed here for completeness.

Validates that parameter is ModelInterface, ModelConfig, or null.

Parameters

$modelOrConfigmixedrequired
The parameter to validate.

Return

void

Source

private static function validateModelOrConfigParameter($modelOrConfig): void
{
    if ($modelOrConfig !== null && !$modelOrConfig instanceof ModelInterface && !$modelOrConfig instanceof ModelConfig) {
        throw new InvalidArgumentException('Parameter must be a ModelInterface instance (specific model), ' . 'ModelConfig instance (for auto-discovery), or null (default auto-discovery). ' . sprintf('Received: %s', is_object($modelOrConfig) ? get_class($modelOrConfig) : gettype($modelOrConfig)));
    }
}

User Contributed Notes

You must log in before being able to contribute a note or feedback.