Skip to content

Commit 9e76cb9

Browse files
committed
[database] improvement: use null coalescing operator
1 parent 2ddb388 commit 9e76cb9

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

lib/database/sfDatabaseManager.class.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,7 @@ public function setDatabase($name, sfDatabase $database)
9292
*/
9393
public function getDatabase($name = 'default')
9494
{
95-
if (isset($this->databases[$name])) {
96-
return $this->databases[$name];
97-
}
98-
99-
// nonexistent database name
100-
throw new sfDatabaseException(sprintf('Database "%s" does not exist.', $name));
95+
return $this->databases[$name] ?? throw new sfDatabaseException(sprintf('Database "%s" does not exist.', $name));
10196
}
10297

10398
/**

0 commit comments

Comments
 (0)