Update commands to php 8.1

This commit is contained in:
Tim 2022-09-28 13:34:03 +02:00
parent 55395666b7
commit 3920ed4244
7 changed files with 9 additions and 8 deletions

View File

@ -14,7 +14,7 @@ use Symfony\Component\Console\Question\Question;
class CreateDatabaseCommand extends Command class CreateDatabaseCommand extends Command
{ {
public function __construct( public function __construct(
private DatabaseService $db, private readonly DatabaseService $db,
) )
{ {
parent::__construct(); parent::__construct();

View File

@ -16,7 +16,7 @@ class DeleteDatabaseCommand extends Command
use SelectDatabaseQuestion; use SelectDatabaseQuestion;
public function __construct( public function __construct(
private DatabaseService $db, private readonly DatabaseService $db,
) )
{ {
parent::__construct(); parent::__construct();

View File

@ -12,7 +12,7 @@ use Symfony\Component\Console\Output\OutputInterface;
class ListDatabasesCommand extends Command class ListDatabasesCommand extends Command
{ {
public function __construct( public function __construct(
private DatabaseService $db, private readonly DatabaseService $db,
) )
{ {
parent::__construct(); parent::__construct();

View File

@ -12,7 +12,7 @@ use Symfony\Component\Console\Output\OutputInterface;
class ListUsersCommand extends Command class ListUsersCommand extends Command
{ {
public function __construct( public function __construct(
private DatabaseService $db, private readonly DatabaseService $db,
) )
{ {
parent::__construct(); parent::__construct();

View File

@ -16,7 +16,7 @@ class PurgeDatabaseCommand extends Command
use SelectDatabaseQuestion; use SelectDatabaseQuestion;
public function __construct( public function __construct(
private DatabaseService $db, private readonly DatabaseService $db,
) )
{ {
parent::__construct(); parent::__construct();

View File

@ -19,8 +19,8 @@ class RestoreDatabaseCommand extends Command
use SelectDatabaseQuestion; use SelectDatabaseQuestion;
public function __construct( public function __construct(
private DatabaseService $db, private readonly DatabaseService $db,
private BackupService $bs, private readonly BackupService $bs,
) )
{ {
parent::__construct(); parent::__construct();

View File

@ -2,6 +2,7 @@
namespace App\Service; namespace App\Service;
use Exception;
use mysqli; use mysqli;
class MysqliConnection class MysqliConnection
@ -12,7 +13,7 @@ class MysqliConnection
{ {
$this->connection = new mysqli($credentials->getHostname(), $credentials->getUser(), $credentials->getPassword()); $this->connection = new mysqli($credentials->getHostname(), $credentials->getUser(), $credentials->getPassword());
if ($this->connection->connect_error) { if ($this->connection->connect_error) {
throw new \Exception("Connection failed: " . $this->connection->connect_error); throw new Exception("Connection failed: " . $this->connection->connect_error);
} }
} }