From 3920ed4244d3876060e123917c7259f5b64d22bd Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 28 Sep 2022 13:34:03 +0200 Subject: [PATCH] Update commands to php 8.1 --- src/Console/CreateDatabaseCommand.php | 2 +- src/Console/DeleteDatabaseCommand.php | 2 +- src/Console/ListDatabasesCommand.php | 2 +- src/Console/ListUsersCommand.php | 2 +- src/Console/PurgeDatabaseCommand.php | 2 +- src/Console/RestoreDatabaseCommand.php | 4 ++-- src/Service/MysqliConnection.php | 3 ++- 7 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/Console/CreateDatabaseCommand.php b/src/Console/CreateDatabaseCommand.php index f9431db..019df9c 100644 --- a/src/Console/CreateDatabaseCommand.php +++ b/src/Console/CreateDatabaseCommand.php @@ -14,7 +14,7 @@ use Symfony\Component\Console\Question\Question; class CreateDatabaseCommand extends Command { public function __construct( - private DatabaseService $db, + private readonly DatabaseService $db, ) { parent::__construct(); diff --git a/src/Console/DeleteDatabaseCommand.php b/src/Console/DeleteDatabaseCommand.php index 3fdbad8..110651f 100644 --- a/src/Console/DeleteDatabaseCommand.php +++ b/src/Console/DeleteDatabaseCommand.php @@ -16,7 +16,7 @@ class DeleteDatabaseCommand extends Command use SelectDatabaseQuestion; public function __construct( - private DatabaseService $db, + private readonly DatabaseService $db, ) { parent::__construct(); diff --git a/src/Console/ListDatabasesCommand.php b/src/Console/ListDatabasesCommand.php index 160ed80..235cf02 100644 --- a/src/Console/ListDatabasesCommand.php +++ b/src/Console/ListDatabasesCommand.php @@ -12,7 +12,7 @@ use Symfony\Component\Console\Output\OutputInterface; class ListDatabasesCommand extends Command { public function __construct( - private DatabaseService $db, + private readonly DatabaseService $db, ) { parent::__construct(); diff --git a/src/Console/ListUsersCommand.php b/src/Console/ListUsersCommand.php index 6564884..7f0fda2 100644 --- a/src/Console/ListUsersCommand.php +++ b/src/Console/ListUsersCommand.php @@ -12,7 +12,7 @@ use Symfony\Component\Console\Output\OutputInterface; class ListUsersCommand extends Command { public function __construct( - private DatabaseService $db, + private readonly DatabaseService $db, ) { parent::__construct(); diff --git a/src/Console/PurgeDatabaseCommand.php b/src/Console/PurgeDatabaseCommand.php index 0a7f4b5..0b7432a 100644 --- a/src/Console/PurgeDatabaseCommand.php +++ b/src/Console/PurgeDatabaseCommand.php @@ -16,7 +16,7 @@ class PurgeDatabaseCommand extends Command use SelectDatabaseQuestion; public function __construct( - private DatabaseService $db, + private readonly DatabaseService $db, ) { parent::__construct(); diff --git a/src/Console/RestoreDatabaseCommand.php b/src/Console/RestoreDatabaseCommand.php index b1272d8..12397a6 100644 --- a/src/Console/RestoreDatabaseCommand.php +++ b/src/Console/RestoreDatabaseCommand.php @@ -19,8 +19,8 @@ class RestoreDatabaseCommand extends Command use SelectDatabaseQuestion; public function __construct( - private DatabaseService $db, - private BackupService $bs, + private readonly DatabaseService $db, + private readonly BackupService $bs, ) { parent::__construct(); diff --git a/src/Service/MysqliConnection.php b/src/Service/MysqliConnection.php index 25952d0..ba763ce 100644 --- a/src/Service/MysqliConnection.php +++ b/src/Service/MysqliConnection.php @@ -2,6 +2,7 @@ namespace App\Service; +use Exception; use mysqli; class MysqliConnection @@ -12,7 +13,7 @@ class MysqliConnection { $this->connection = new mysqli($credentials->getHostname(), $credentials->getUser(), $credentials->getPassword()); if ($this->connection->connect_error) { - throw new \Exception("Connection failed: " . $this->connection->connect_error); + throw new Exception("Connection failed: " . $this->connection->connect_error); } }