Skip to content

Commit 136f4eb

Browse files
authored
Switch back to ternaries in DatabaseManager to allow for empty named connections (#56906)
1 parent 905c93a commit 136f4eb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Illuminate/Database/DatabaseManager.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public function __construct($app, ConnectionFactory $factory)
9292
*/
9393
public function connection($name = null)
9494
{
95-
[$database, $type] = $this->parseConnectionName($name = enum_value($name) ?? $this->getDefaultConnection());
95+
[$database, $type] = $this->parseConnectionName($name = enum_value($name) ?: $this->getDefaultConnection());
9696

9797
// If we haven't created this connection, we'll create it based on the config
9898
// provided in the application. Once we've created the connections we will
@@ -298,7 +298,7 @@ protected function setPdoForType(Connection $connection, $type = null)
298298
*/
299299
public function purge($name = null)
300300
{
301-
$this->disconnect($name = enum_value($name) ?? $this->getDefaultConnection());
301+
$this->disconnect($name = enum_value($name) ?: $this->getDefaultConnection());
302302

303303
unset($this->connections[$name]);
304304
}
@@ -311,7 +311,7 @@ public function purge($name = null)
311311
*/
312312
public function disconnect($name = null)
313313
{
314-
if (isset($this->connections[$name = enum_value($name) ?? $this->getDefaultConnection()])) {
314+
if (isset($this->connections[$name = enum_value($name) ?: $this->getDefaultConnection()])) {
315315
$this->connections[$name]->disconnect();
316316
}
317317
}
@@ -324,7 +324,7 @@ public function disconnect($name = null)
324324
*/
325325
public function reconnect($name = null)
326326
{
327-
$this->disconnect($name = enum_value($name) ?? $this->getDefaultConnection());
327+
$this->disconnect($name = enum_value($name) ?: $this->getDefaultConnection());
328328

329329
if (! isset($this->connections[$name])) {
330330
return $this->connection($name);

0 commit comments

Comments
 (0)