Skip to content

Commit f4f933d

Browse files
Merge pull request #17968 from kamil-tekiela/Remove-dependencies
Remove unused class dependencies Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2 parents 2b2a758 + 65ab160 commit f4f933d

8 files changed

Lines changed: 11 additions & 164 deletions

File tree

libraries/classes/Controllers/Database/StructureController.php

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,10 @@
88
use PhpMyAdmin\CheckUserPrivileges;
99
use PhpMyAdmin\Config\PageSettings;
1010
use PhpMyAdmin\ConfigStorage\Relation;
11-
use PhpMyAdmin\ConfigStorage\RelationCleanup;
1211
use PhpMyAdmin\Controllers\AbstractController;
1312
use PhpMyAdmin\DatabaseInterface;
14-
use PhpMyAdmin\FlashMessages;
1513
use PhpMyAdmin\Html\Generator;
1614
use PhpMyAdmin\Http\ServerRequest;
17-
use PhpMyAdmin\Operations;
1815
use PhpMyAdmin\RecentFavoriteTable;
1916
use PhpMyAdmin\Replication;
2017
use PhpMyAdmin\ReplicationInfo;
@@ -74,38 +71,23 @@ class StructureController extends AbstractController
7471
/** @var Replication */
7572
private $replication;
7673

77-
/** @var RelationCleanup */
78-
private $relationCleanup;
79-
80-
/** @var Operations */
81-
private $operations;
82-
8374
/** @var ReplicationInfo */
8475
private $replicationInfo;
8576

8677
/** @var DatabaseInterface */
8778
private $dbi;
8879

89-
/** @var FlashMessages */
90-
private $flash;
91-
9280
public function __construct(
9381
ResponseRenderer $response,
9482
Template $template,
9583
Relation $relation,
9684
Replication $replication,
97-
RelationCleanup $relationCleanup,
98-
Operations $operations,
99-
DatabaseInterface $dbi,
100-
FlashMessages $flash
85+
DatabaseInterface $dbi
10186
) {
10287
parent::__construct($response, $template);
10388
$this->relation = $relation;
10489
$this->replication = $replication;
105-
$this->relationCleanup = $relationCleanup;
106-
$this->operations = $operations;
10790
$this->dbi = $dbi;
108-
$this->flash = $flash;
10991

11092
$this->replicationInfo = new ReplicationInfo($this->dbi);
11193
}

libraries/classes/Controllers/Server/DatabasesController.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@
66

77
use PhpMyAdmin\Charsets;
88
use PhpMyAdmin\CheckUserPrivileges;
9-
use PhpMyAdmin\ConfigStorage\RelationCleanup;
109
use PhpMyAdmin\Controllers\AbstractController;
1110
use PhpMyAdmin\DatabaseInterface;
1211
use PhpMyAdmin\Http\ServerRequest;
1312
use PhpMyAdmin\Query\Utilities;
1413
use PhpMyAdmin\ReplicationInfo;
1514
use PhpMyAdmin\ResponseRenderer;
1615
use PhpMyAdmin\Template;
17-
use PhpMyAdmin\Transformations;
1816
use PhpMyAdmin\Url;
1917
use PhpMyAdmin\Util;
2018

@@ -50,25 +48,15 @@ class DatabasesController extends AbstractController
5048
/** @var int position in list navigation */
5149
private $position;
5250

53-
/** @var Transformations */
54-
private $transformations;
55-
56-
/** @var RelationCleanup */
57-
private $relationCleanup;
58-
5951
/** @var DatabaseInterface */
6052
private $dbi;
6153

6254
public function __construct(
6355
ResponseRenderer $response,
6456
Template $template,
65-
Transformations $transformations,
66-
RelationCleanup $relationCleanup,
6757
DatabaseInterface $dbi
6858
) {
6959
parent::__construct($response, $template);
70-
$this->transformations = $transformations;
71-
$this->relationCleanup = $relationCleanup;
7260
$this->dbi = $dbi;
7361

7462
$checkUserPrivileges = new CheckUserPrivileges($dbi);

libraries/classes/Controllers/Table/StructureController.php

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,12 @@
88
use PhpMyAdmin\CheckUserPrivileges;
99
use PhpMyAdmin\Config\PageSettings;
1010
use PhpMyAdmin\ConfigStorage\Relation;
11-
use PhpMyAdmin\ConfigStorage\RelationCleanup;
1211
use PhpMyAdmin\ConfigStorage\RelationParameters;
1312
use PhpMyAdmin\Controllers\AbstractController;
14-
use PhpMyAdmin\CreateAddField;
1513
use PhpMyAdmin\Database\CentralColumns;
1614
use PhpMyAdmin\DatabaseInterface;
1715
use PhpMyAdmin\DbTableExists;
1816
use PhpMyAdmin\Engines\Innodb;
19-
use PhpMyAdmin\FlashMessages;
2017
use PhpMyAdmin\Html\Generator;
2118
use PhpMyAdmin\Http\ServerRequest;
2219
use PhpMyAdmin\Index;
@@ -47,41 +44,26 @@ class StructureController extends AbstractController
4744
/** @var Table The table object */
4845
protected $tableObj;
4946

50-
/** @var CreateAddField */
51-
private $createAddField;
52-
5347
/** @var Relation */
5448
private $relation;
5549

5650
/** @var Transformations */
5751
private $transformations;
5852

59-
/** @var RelationCleanup */
60-
private $relationCleanup;
61-
6253
/** @var DatabaseInterface */
6354
private $dbi;
6455

65-
/** @var FlashMessages */
66-
private $flash;
67-
6856
public function __construct(
6957
ResponseRenderer $response,
7058
Template $template,
7159
Relation $relation,
7260
Transformations $transformations,
73-
CreateAddField $createAddField,
74-
RelationCleanup $relationCleanup,
75-
DatabaseInterface $dbi,
76-
FlashMessages $flash
61+
DatabaseInterface $dbi
7762
) {
7863
parent::__construct($response, $template);
79-
$this->createAddField = $createAddField;
8064
$this->relation = $relation;
8165
$this->transformations = $transformations;
82-
$this->relationCleanup = $relationCleanup;
8366
$this->dbi = $dbi;
84-
$this->flash = $flash;
8567

8668
$this->tableObj = $this->dbi->getTable($GLOBALS['db'], $GLOBALS['table']);
8769
}

libraries/services_controllers.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -421,10 +421,7 @@
421421
'$template' => '@template',
422422
'$relation' => '@relation',
423423
'$replication' => '@replication',
424-
'$relationCleanup' => '@relation_cleanup',
425-
'$operations' => '@operations',
426424
'$dbi' => '@dbi',
427-
'$flash' => '@flash',
428425
],
429426
],
430427
Database\TrackingController::class => [
@@ -856,8 +853,6 @@
856853
'arguments' => [
857854
'$response' => '@response',
858855
'$template' => '@template',
859-
'$transformations' => '@transformations',
860-
'$relationCleanup' => '@relation_cleanup',
861856
'$dbi' => '@dbi',
862857
],
863858
],
@@ -1609,10 +1604,7 @@
16091604
'$template' => '@template',
16101605
'$relation' => '@relation',
16111606
'$transformations' => '@transformations',
1612-
'$createAddField' => '@create_add_field',
1613-
'$relationCleanup' => '@relation_cleanup',
16141607
'$dbi' => '@dbi',
1615-
'$flash' => '@flash',
16161608
],
16171609
],
16181610
Table\TrackingController::class => [

phpstan-baseline.neon

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1270,21 +1270,6 @@ parameters:
12701270
count: 1
12711271
path: libraries/classes/Controllers/Database/StructureController.php
12721272

1273-
-
1274-
message: "#^Property PhpMyAdmin\\\\Controllers\\\\Database\\\\StructureController\\:\\:\\$flash is never read, only written\\.$#"
1275-
count: 1
1276-
path: libraries/classes/Controllers/Database/StructureController.php
1277-
1278-
-
1279-
message: "#^Property PhpMyAdmin\\\\Controllers\\\\Database\\\\StructureController\\:\\:\\$operations is never read, only written\\.$#"
1280-
count: 1
1281-
path: libraries/classes/Controllers/Database/StructureController.php
1282-
1283-
-
1284-
message: "#^Property PhpMyAdmin\\\\Controllers\\\\Database\\\\StructureController\\:\\:\\$relationCleanup is never read, only written\\.$#"
1285-
count: 1
1286-
path: libraries/classes/Controllers/Database/StructureController.php
1287-
12881273
-
12891274
message: "#^Property PhpMyAdmin\\\\Controllers\\\\Database\\\\StructureController\\:\\:\\$tables type has no value type specified in iterable type array\\.$#"
12901275
count: 1
@@ -1615,16 +1600,6 @@ parameters:
16151600
count: 1
16161601
path: libraries/classes/Controllers/Server/DatabasesController.php
16171602

1618-
-
1619-
message: "#^Property PhpMyAdmin\\\\Controllers\\\\Server\\\\DatabasesController\\:\\:\\$relationCleanup is never read, only written\\.$#"
1620-
count: 1
1621-
path: libraries/classes/Controllers/Server/DatabasesController.php
1622-
1623-
-
1624-
message: "#^Property PhpMyAdmin\\\\Controllers\\\\Server\\\\DatabasesController\\:\\:\\$transformations is never read, only written\\.$#"
1625-
count: 1
1626-
path: libraries/classes/Controllers/Server/DatabasesController.php
1627-
16281603
-
16291604
message: "#^Cannot cast mixed to int\\.$#"
16301605
count: 1
@@ -2045,21 +2020,6 @@ parameters:
20452020
count: 1
20462021
path: libraries/classes/Controllers/Table/StructureController.php
20472022

2048-
-
2049-
message: "#^Property PhpMyAdmin\\\\Controllers\\\\Table\\\\StructureController\\:\\:\\$createAddField is never read, only written\\.$#"
2050-
count: 1
2051-
path: libraries/classes/Controllers/Table/StructureController.php
2052-
2053-
-
2054-
message: "#^Property PhpMyAdmin\\\\Controllers\\\\Table\\\\StructureController\\:\\:\\$flash is never read, only written\\.$#"
2055-
count: 1
2056-
path: libraries/classes/Controllers/Table/StructureController.php
2057-
2058-
-
2059-
message: "#^Property PhpMyAdmin\\\\Controllers\\\\Table\\\\StructureController\\:\\:\\$relationCleanup is never read, only written\\.$#"
2060-
count: 1
2061-
path: libraries/classes/Controllers/Table/StructureController.php
2062-
20632023
-
20642024
message: "#^Cannot cast mixed to string\\.$#"
20652025
count: 1

test/classes/Controllers/Database/StructureControllerTest.php

Lines changed: 8 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,9 @@
55
namespace PhpMyAdmin\Tests\Controllers\Database;
66

77
use PhpMyAdmin\ConfigStorage\Relation;
8-
use PhpMyAdmin\ConfigStorage\RelationCleanup;
98
use PhpMyAdmin\Controllers\Database\StructureController;
109
use PhpMyAdmin\DatabaseInterface;
11-
use PhpMyAdmin\FlashMessages;
1210
use PhpMyAdmin\Http\ServerRequest;
13-
use PhpMyAdmin\Operations;
1411
use PhpMyAdmin\Replication;
1512
use PhpMyAdmin\Table;
1613
use PhpMyAdmin\Template;
@@ -36,15 +33,6 @@ class StructureControllerTest extends AbstractTestCase
3633
/** @var Template */
3734
private $template;
3835

39-
/** @var RelationCleanup */
40-
private $relationCleanup;
41-
42-
/** @var Operations */
43-
private $operations;
44-
45-
/** @var FlashMessages */
46-
private $flash;
47-
4836
/**
4937
* Prepares environment for the test.
5038
*/
@@ -80,9 +68,6 @@ protected function setUp(): void
8068
$this->response = new ResponseStub();
8169
$this->relation = new Relation($dbi);
8270
$this->replication = new Replication();
83-
$this->relationCleanup = new RelationCleanup($dbi, $this->relation);
84-
$this->operations = new Operations($dbi, $this->relation);
85-
$this->flash = new FlashMessages();
8671
}
8772

8873
/**
@@ -98,10 +83,7 @@ public function testGetValuesForInnodbTable(): void
9883
$this->template,
9984
$this->relation,
10085
$this->replication,
101-
$this->relationCleanup,
102-
$this->operations,
103-
$GLOBALS['dbi'],
104-
$this->flash
86+
$GLOBALS['dbi']
10587
);
10688
// Showing statistics
10789
$property = $class->getProperty('isShowStats');
@@ -145,10 +127,7 @@ public function testGetValuesForInnodbTable(): void
145127
$this->template,
146128
$this->relation,
147129
$this->replication,
148-
$this->relationCleanup,
149-
$this->operations,
150-
$GLOBALS['dbi'],
151-
$this->flash
130+
$GLOBALS['dbi']
152131
);
153132

154133
$currentTable['ENGINE'] = 'InnoDB';
@@ -176,10 +155,7 @@ public function testGetValuesForAriaTable(): void
176155
$this->template,
177156
$this->relation,
178157
$this->replication,
179-
$this->relationCleanup,
180-
$this->operations,
181-
$GLOBALS['dbi'],
182-
$this->flash
158+
$GLOBALS['dbi']
183159
);
184160
// Showing statistics
185161
$property = $class->getProperty('isShowStats');
@@ -231,10 +207,7 @@ public function testGetValuesForAriaTable(): void
231207
$this->template,
232208
$this->relation,
233209
$this->replication,
234-
$this->relationCleanup,
235-
$this->operations,
236-
$GLOBALS['dbi'],
237-
$this->flash
210+
$GLOBALS['dbi']
238211
);
239212
[$currentTable, , , , , , $sumSize] = $method->invokeArgs(
240213
$controller,
@@ -255,10 +228,7 @@ public function testGetValuesForAriaTable(): void
255228
$this->template,
256229
$this->relation,
257230
$this->replication,
258-
$this->relationCleanup,
259-
$this->operations,
260-
$GLOBALS['dbi'],
261-
$this->flash
231+
$GLOBALS['dbi']
262232
);
263233
[$currentTable] = $method->invokeArgs(
264234
$controller,
@@ -289,10 +259,7 @@ public function testHasTable(): void
289259
$this->template,
290260
$this->relation,
291261
$this->replication,
292-
$this->relationCleanup,
293-
$this->operations,
294-
$GLOBALS['dbi'],
295-
$this->flash
262+
$GLOBALS['dbi']
296263
);
297264

298265
// When parameter $db is empty
@@ -327,10 +294,7 @@ public function testCheckFavoriteTable(): void
327294
$this->template,
328295
$this->relation,
329296
$this->replication,
330-
$this->relationCleanup,
331-
$this->operations,
332-
$GLOBALS['dbi'],
333-
$this->flash
297+
$GLOBALS['dbi']
334298
);
335299

336300
$_SESSION['tmpval']['favoriteTables'][$GLOBALS['server']] = [
@@ -363,10 +327,7 @@ public function testDisplayTableList(): void
363327
$this->template,
364328
$this->relation,
365329
$this->replication,
366-
$this->relationCleanup,
367-
$this->operations,
368-
$GLOBALS['dbi'],
369-
$this->flash
330+
$GLOBALS['dbi']
370331
);
371332
// Showing statistics
372333
$class = new ReflectionClass(StructureController::class);

0 commit comments

Comments
 (0)