Exception thrown when configuration is missing, invalid, or malformed in the cmd-bus system.
InvalidConfigurationException handles configuration-related errors in the command bus system. It provides specific factory methods for common configuration problems like missing keys, invalid values, unmapped commands, and handler resolution issues.
final class InvalidConfigurationException extends InvalidArgumentException
{
public static function fromMissingKey(string $key): self;
public static function fromInvalidValue(string $key, mixed $value): self;
public static function fromInvalidType(string $key, mixed $value): self;
public static function fromUnMappedCommand(string $commandClass): self;
public static function fromInvalidHandler(string $handlerClass, mixed $handler): self;
public static function fromHandlerNotFound(string $handlerClass): ServiceNotFoundException;
}Creates an exception for missing configuration keys.
Parameters:
$key- The missing configuration key
Returns:
- Exception with message: "Configuration key "{key}" is missing."
Creates an exception for invalid configuration values.
Parameters:
$key- The configuration key$value- The invalid value
Returns:
- Exception with message showing the key and value type
Creates an exception for incorrect configuration value types.
Parameters:
$key- The configuration key$value- The value with wrong type
Returns:
- Exception with message showing expected vs actual type
Creates an exception for commands without handler mappings.
Parameters:
$commandClass- The unmapped command class
Returns:
- Exception with message: "Missing CommandMap entry for "{commandClass}"."
Creates an exception for invalid command handlers.
Parameters:
$handlerClass- The expected handler class$handler- The invalid handler instance
Returns:
- Exception describing the type mismatch
Creates a service not found exception for missing handlers.
Parameters:
$handlerClass- The missing handler class
Returns:
ServiceNotFoundExceptioninstance
- ServiceNotFoundException - Related service resolution exception
- CommandException - Related command processing exception
- ConfigProvider - Configuration provider that might throw this exception