Skip to content

Commit ef713d7

Browse files
committed
refactor: remove unneeded isset($config) check
1 parent 2456f67 commit ef713d7

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

system/Database/Config.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,12 @@ public static function connect($group = null, bool $getShared = true)
6565
if (! isset($dbConfig->{$group})) {
6666
throw new InvalidArgumentException($group . ' is not a valid database connection group.');
6767
}
68-
}
6968

70-
if ($getShared && isset(static::$instances[$group])) {
71-
return static::$instances[$group];
72-
}
73-
74-
if (isset($dbConfig->{$group})) {
7569
$config = $dbConfig->{$group};
7670
}
7771

78-
if (! isset($config)) {
79-
throw new InvalidArgumentException('There is no valid database config.');
72+
if ($getShared && isset(static::$instances[$group])) {
73+
return static::$instances[$group];
8074
}
8175

8276
static::ensureFactory();

0 commit comments

Comments
 (0)