diff --git a/src/ConnectionString.php b/src/ConnectionString.php index 8ea1359b..fc11b7f6 100644 --- a/src/ConnectionString.php +++ b/src/ConnectionString.php @@ -60,7 +60,7 @@ public static function getConnectionSettings( if ('connectto' === $key) { continue; } - + if (! \array_key_exists($key, self::$allowedValues)) { throw new InvalidArgumentException(\sprintf( 'Key %s is not an allowed key in %s', @@ -154,10 +154,6 @@ public static function getUriFromConnectionString(string $connectionString): ?Ur { $values = \explode(';', $connectionString); - if (1 === \count($values)) { - return Uri::fromString($connectionString); - } - foreach ($values as $value) { list($key, $value) = \explode('=', $value); diff --git a/src/EventStoreAsyncConnectionFactory.php b/src/EventStoreAsyncConnectionFactory.php index 0612b699..87868966 100644 --- a/src/EventStoreAsyncConnectionFactory.php +++ b/src/EventStoreAsyncConnectionFactory.php @@ -25,7 +25,7 @@ class EventStoreAsyncConnectionFactory public static function createFromConnectionString( string $connectionString, ConnectionSettings $settings = null, - string $connectionName = '' + ?string $connectionName = null ): AsyncConnection { $settings = ConnectionString::getConnectionSettings( $connectionString, @@ -52,7 +52,7 @@ public static function createFromConnectionString( public static function createFromUri( ?Uri $uri, ?ConnectionSettings $connectionSettings = null, - string $connectionName = '' + ?string $connectionName = null ): AsyncConnection { $connectionSettings = $connectionSettings ?? ConnectionSettings::default(); @@ -141,7 +141,7 @@ public static function createFromUri( public static function createFromEndPoint( EndPoint $endPoint, ?ConnectionSettings $settings = null, - string $connectionName = '' + ?string $connectionName = null ): AsyncConnection { $settings = $settings ?? ConnectionSettings::default(); @@ -158,7 +158,7 @@ public static function createFromEndPoint( public static function createFromSettings( ConnectionSettings $settings, - string $connectionName = '' + ?string $connectionName = null ): AsyncConnection { return self::createFromUri(null, $settings, $connectionName); } diff --git a/src/EventStoreSyncConnectionFactory.php b/src/EventStoreSyncConnectionFactory.php index bcff9918..20e29d82 100644 --- a/src/EventStoreSyncConnectionFactory.php +++ b/src/EventStoreSyncConnectionFactory.php @@ -25,7 +25,7 @@ class EventStoreSyncConnectionFactory public static function createFromConnectionString( string $connectionString, ConnectionSettings $settings = null, - string $connectionName = '' + ?string $connectionName = null ): SyncConnection { $settings = ConnectionString::getConnectionSettings( $connectionString, @@ -52,7 +52,7 @@ public static function createFromConnectionString( public static function createFromUri( ?Uri $uri, ?ConnectionSettings $connectionSettings = null, - string $connectionName = '' + ?string $connectionName = null ): SyncConnection { $connectionSettings = $connectionSettings ?? ConnectionSettings::default(); @@ -141,7 +141,7 @@ public static function createFromUri( public static function createFromEndPoint( EndPoint $endPoint, ?ConnectionSettings $settings = null, - string $connectionName = '' + ?string $connectionName = null ): SyncConnection { $settings = $settings ?? ConnectionSettings::default(); @@ -158,7 +158,7 @@ public static function createFromEndPoint( public static function createFromSettings( ConnectionSettings $settings, - string $connectionName = '' + ?string $connectionName = null ): SyncConnection { return self::createFromUri(null, $settings, $connectionName); }