From 49149b218dac030567226a780428559841d42c3b Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Fri, 22 Dec 2023 13:42:57 +0100 Subject: [PATCH 1/3] Make StructureController final Signed-off-by: Kamil Tekiela --- .../Database/StructureController.php | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Controllers/Database/StructureController.php b/src/Controllers/Database/StructureController.php index bb1d05c8be..a43bc71ac2 100644 --- a/src/Controllers/Database/StructureController.php +++ b/src/Controllers/Database/StructureController.php @@ -56,25 +56,25 @@ use function urlencode; /** * Handles database structure logic */ -class StructureController extends AbstractController +final class StructureController extends AbstractController { /** @var int Number of tables */ - protected int $numTables = 0; + private int $numTables = 0; /** @var int Current position in the list */ - protected int $position = 0; + private int $position = 0; /** @var bool DB is information_schema */ - protected bool $dbIsSystemSchema = false; + private bool $dbIsSystemSchema = false; /** @var int Number of tables */ - protected int $totalNumTables = 0; + private int $totalNumTables = 0; /** @var mixed[] Tables in the database */ - protected array $tables = []; + private array $tables = []; /** @var bool whether stats show or not */ - protected bool $isShowStats = false; + private bool $isShowStats = false; private ReplicationInfo $replicationInfo; @@ -215,7 +215,7 @@ class StructureController extends AbstractController } /** @param mixed[] $replicaInfo */ - protected function displayTableList(array $replicaInfo): string + private function displayTableList(array $replicaInfo): string { $html = ''; @@ -530,7 +530,7 @@ class StructureController extends AbstractController * * @return string HTML for tracking icon */ - protected function getTrackingIcon(string $table, TrackedTable|null $trackedTable): string + private function getTrackingIcon(string $table, TrackedTable|null $trackedTable): string { $trackingIcon = ''; if (Tracker::isActive() && $trackedTable !== null) { @@ -552,7 +552,7 @@ class StructureController extends AbstractController * * @return mixed[] */ - protected function isRowCountApproximated( + private function isRowCountApproximated( array $currentTable, bool $tableIsView, ): array { @@ -597,7 +597,7 @@ class StructureController extends AbstractController * * @return mixed[] */ - protected function getReplicationStatus(array $replicaInfo, string $table): array + private function getReplicationStatus(array $replicaInfo, string $table): array { $do = $ignored = false; if ($replicaInfo['status']) { @@ -627,7 +627,7 @@ class StructureController extends AbstractController * @param mixed[] $db DB to look into * @param string $truename Table name */ - protected function hasTable(array $db, string $truename): bool + private function hasTable(array $db, string $truename): bool { foreach ($db as $dbTable) { if ( @@ -656,7 +656,7 @@ class StructureController extends AbstractController * * @return mixed[] */ - protected function getStuffForEngineTypeTable( + private function getStuffForEngineTypeTable( array $currentTable, int $sumSize, int $overheadSize, @@ -776,7 +776,7 @@ class StructureController extends AbstractController * * @return mixed[] */ - protected function getValuesForAriaTable( + private function getValuesForAriaTable( array $currentTable, int $sumSize, int $overheadSize, @@ -814,7 +814,7 @@ class StructureController extends AbstractController * * @return mixed[] */ - protected function getValuesForInnodbTable( + private function getValuesForInnodbTable( array $currentTable, int $sumSize, ): array { @@ -852,7 +852,7 @@ class StructureController extends AbstractController * * @return mixed[] */ - protected function getValuesForMroongaTable( + private function getValuesForMroongaTable( array $currentTable, int $sumSize, ): array { From b3276b39c389a6acccec23f37ca5c6a95238db88 Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Fri, 22 Dec 2023 13:46:08 +0100 Subject: [PATCH 2/3] Make BinlogController final Signed-off-by: Kamil Tekiela --- src/Controllers/Server/BinlogController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Controllers/Server/BinlogController.php b/src/Controllers/Server/BinlogController.php index fabfea442d..d2cf0b8cf2 100644 --- a/src/Controllers/Server/BinlogController.php +++ b/src/Controllers/Server/BinlogController.php @@ -20,14 +20,14 @@ use function array_key_exists; /** * Handles viewing binary logs */ -class BinlogController extends AbstractController +final class BinlogController extends AbstractController { /** * binary log files * * @var mixed[] */ - protected array $binaryLogs; + private array $binaryLogs; public function __construct(ResponseRenderer $response, Template $template, private DatabaseInterface $dbi) { From 435da9cc4d8ec4aaf3c2398ad85299a59e80a3ba Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Fri, 22 Dec 2023 13:48:31 +0100 Subject: [PATCH 3/3] Remove property redefinitions Signed-off-by: Kamil Tekiela --- src/Controllers/Console/Bookmark/RefreshController.php | 4 ++-- src/Controllers/Table/DeleteConfirmController.php | 4 ++-- src/Controllers/Table/DropColumnConfirmationController.php | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Controllers/Console/Bookmark/RefreshController.php b/src/Controllers/Console/Bookmark/RefreshController.php index 4f9df3b450..eb6765ac9a 100644 --- a/src/Controllers/Console/Bookmark/RefreshController.php +++ b/src/Controllers/Console/Bookmark/RefreshController.php @@ -13,8 +13,8 @@ use PhpMyAdmin\Template; final class RefreshController extends AbstractController { public function __construct( - protected ResponseRenderer $response, - protected Template $template, + ResponseRenderer $response, + Template $template, private Console $console, ) { parent::__construct($response, $template); diff --git a/src/Controllers/Table/DeleteConfirmController.php b/src/Controllers/Table/DeleteConfirmController.php index 7902f24b72..cfba4a22f8 100644 --- a/src/Controllers/Table/DeleteConfirmController.php +++ b/src/Controllers/Table/DeleteConfirmController.php @@ -24,8 +24,8 @@ use function is_array; final class DeleteConfirmController extends AbstractController { public function __construct( - protected ResponseRenderer $response, - protected Template $template, + ResponseRenderer $response, + Template $template, private readonly DbTableExists $dbTableExists, ) { parent::__construct($response, $template); diff --git a/src/Controllers/Table/DropColumnConfirmationController.php b/src/Controllers/Table/DropColumnConfirmationController.php index 7185658404..b2626056a3 100644 --- a/src/Controllers/Table/DropColumnConfirmationController.php +++ b/src/Controllers/Table/DropColumnConfirmationController.php @@ -21,8 +21,8 @@ use function __; final class DropColumnConfirmationController extends AbstractController { public function __construct( - protected ResponseRenderer $response, - protected Template $template, + ResponseRenderer $response, + Template $template, private readonly DbTableExists $dbTableExists, ) { parent::__construct($response, $template);