Merge pull request #6366 from rxu/ticket/16965

[ticket/16965] Allow empty value as default database server name on installing
This commit is contained in:
Marc Alexander 2022-02-22 22:36:03 +01:00 committed by GitHub
commit 661b9192ad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -25,7 +25,7 @@ class connection_parameter_factory
* Returns configuration options for Doctrine DBAL. * Returns configuration options for Doctrine DBAL.
* *
* @param string $driver Driver name. * @param string $driver Driver name.
* @param string $host Hostname. * @param string|null $host Hostname.
* @param string|null $user Username. * @param string|null $user Username.
* @param string|null $password Password. * @param string|null $password Password.
* @param string|null $name Database name. * @param string|null $name Database name.
@ -37,7 +37,7 @@ class connection_parameter_factory
*/ */
public static function get_configuration( public static function get_configuration(
string $driver, string $driver,
string $host, ?string $host = null,
?string $user = null, ?string $user = null,
?string $password = null, ?string $password = null,
?string $name = null, ?string $name = null,
@ -61,7 +61,7 @@ class connection_parameter_factory
* Build Doctrine configuration array. * Build Doctrine configuration array.
* *
* @param array $params Parameter array. * @param array $params Parameter array.
* @param string $host Database hostname. * @param string|null $host Database hostname.
* @param string|null $user Username. * @param string|null $user Username.
* @param string|null $password Password. * @param string|null $password Password.
* @param string|null $name Database name. * @param string|null $name Database name.
@ -73,7 +73,7 @@ class connection_parameter_factory
*/ */
private static function build_connection_parameters( private static function build_connection_parameters(
array $params, array $params,
string $host, ?string $host = null,
?string $user = null, ?string $user = null,
?string $password = null, ?string $password = null,
?string $name = null, ?string $name = null,
@ -86,7 +86,7 @@ class connection_parameter_factory
); );
} }
if (empty($host) || empty($user) || empty($name)) if (empty($user) || empty($name))
{ {
throw new InvalidArgumentException('Required database parameter is not set.'); throw new InvalidArgumentException('Required database parameter is not set.');
} }