Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix connection string usage #33

Merged
merged 2 commits into from
Nov 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions src/ConnectionString.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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);

Expand Down
8 changes: 4 additions & 4 deletions src/EventStoreAsyncConnectionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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();

Expand Down Expand Up @@ -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();

Expand All @@ -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);
}
Expand Down
8 changes: 4 additions & 4 deletions src/EventStoreSyncConnectionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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();

Expand Down Expand Up @@ -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();

Expand All @@ -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);
}
Expand Down