Skip to content

Commit b8f668b

Browse files
committed
Fix Psalm issues after upgrade to 6
1 parent 83e4ad9 commit b8f668b

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/SqlConfig.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ protected static function parseConnectionString(string $connectionString, array
4343
throw new \ValueError("Empty connection string");
4444
}
4545

46-
if (!\preg_match_all(
47-
self::KEY_VALUE_PAIR_REGEXP,
48-
$connectionString,
49-
$matches,
46+
if (\preg_match_all(
47+
pattern: self::KEY_VALUE_PAIR_REGEXP,
48+
subject: $connectionString,
49+
matches: $matches,
5050
flags: \PREG_SET_ORDER | \PREG_UNMATCHED_AS_NULL,
51-
)) {
51+
) === false) {
5252
throw new \ValueError("Invalid connection string");
5353
}
5454

@@ -64,13 +64,15 @@ protected static function parseConnectionString(string $connectionString, array
6464
}
6565
}
6666

67+
\assert($key !== null && $key !== '');
6768
$key = $keymap[$key] ?? $key;
6869
if (\array_key_exists($key, $values)) {
6970
throw new \ValueError("Duplicate connection string key '{$key}'");
7071
}
7172

7273
$values[$key] = $value;
7374

75+
\assert($pair !== null);
7476
$offset += \strlen($pair);
7577
}
7678

0 commit comments

Comments
 (0)