Visitar URL original
Merge pull request #20387 from kamil-tekiela/Refactoring-of-getDbInfo… · phpmyadmin/phpmyadmin@9508038 · GitHub
Skip to content

Commit 9508038

Browse files
Merge pull request #20387 from kamil-tekiela/Refactoring-of-getDbInfo-and-getTablesFull
Refactoring of getDbInfo and getTablesFull
2 parents 9e4dc5b + ccc28ce commit 9508038

19 files changed

Lines changed: 815 additions & 497 deletions

File tree

‎phpstan-baseline.neon‎

Lines changed: 8 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1704,12 +1704,6 @@ parameters:
17041704
count: 1
17051705
path: src/Controllers/Database/StructureController.php
17061706

1707-
-
1708-
message: '#^Parameter \#2 \$table of method PhpMyAdmin\\Dbal\\DatabaseInterface\:\:getTablesFull\(\) expects array\<mixed\>\|string, mixed given\.$#'
1709-
identifier: argument.type
1710-
count: 1
1711-
path: src/Controllers/Database/StructureController.php
1712-
17131707
-
17141708
message: '#^Parameter \#2 \$tableName of method PhpMyAdmin\\Dbal\\DatabaseInterface\:\:getTable\(\) expects string, int\|string\|null given\.$#'
17151709
identifier: argument.type
@@ -1728,6 +1722,12 @@ parameters:
17281722
count: 1
17291723
path: src/Controllers/Database/StructureController.php
17301724

1725+
-
1726+
message: '#^Parameter \#3 \$tableGroup of method PhpMyAdmin\\Dbal\\DatabaseInterface\:\:getTablesFull\(\) expects string, mixed given\.$#'
1727+
identifier: argument.type
1728+
count: 1
1729+
path: src/Controllers/Database/StructureController.php
1730+
17311731
-
17321732
message: '#^Parameter \#2 \$selected of method PhpMyAdmin\\Tracking\\Tracking\:\:createTrackingForMultipleTables\(\) expects array\<mixed\>, mixed given\.$#'
17331733
identifier: argument.type
@@ -4584,7 +4584,7 @@ parameters:
45844584
-
45854585
message: '#^Binary operation "\+" between int\|string\|null and int\|string\|null results in an error\.$#'
45864586
identifier: binaryOp.invalid
4587-
count: 3
4587+
count: 2
45884588
path: src/Dbal/DatabaseInterface.php
45894589

45904590
-
@@ -4620,12 +4620,6 @@ parameters:
46204620
count: 1
46214621
path: src/Dbal/DatabaseInterface.php
46224622

4623-
-
4624-
message: '#^Cannot cast mixed to string\.$#'
4625-
identifier: cast.string
4626-
count: 1
4627-
path: src/Dbal/DatabaseInterface.php
4628-
46294623
-
46304624
message: '#^Cannot use \+\+ on mixed\.$#'
46314625
identifier: postInc.type
@@ -4668,12 +4662,6 @@ parameters:
46684662
count: 1
46694663
path: src/Dbal/DatabaseInterface.php
46704664

4671-
-
4672-
message: '#^Only booleans are allowed in &&, int\|false given on the left side\.$#'
4673-
identifier: booleanAnd.leftNotBoolean
4674-
count: 3
4675-
path: src/Dbal/DatabaseInterface.php
4676-
46774665
-
46784666
message: '#^Only booleans are allowed in a negated boolean, PhpMyAdmin\\Dbal\\ResultInterface\|false given\.$#'
46794667
identifier: booleanNot.exprNotBoolean
@@ -4704,18 +4692,6 @@ parameters:
47044692
count: 1
47054693
path: src/Dbal/DatabaseInterface.php
47064694

4707-
-
4708-
message: '#^Parameter \#1 \$callback of function array_map expects \(callable\(mixed\)\: mixed\)\|null, Closure\(string\)\: non\-empty\-string given\.$#'
4709-
identifier: argument.type
4710-
count: 1
4711-
path: src/Dbal/DatabaseInterface.php
4712-
4713-
-
4714-
message: '#^Parameter \#1 \$callback of function array_map expects \(callable\(mixed\)\: mixed\)\|null, Closure\(string, PhpMyAdmin\\Dbal\\ConnectionType\=\)\: non\-empty\-string given\.$#'
4715-
identifier: argument.type
4716-
count: 1
4717-
path: src/Dbal/DatabaseInterface.php
4718-
47194695
-
47204696
message: '#^Parameter \#1 \$mode of static method PhpMyAdmin\\SqlParser\\Context\:\:setMode\(\) expects int\|string, string\|null given\.$#'
47214697
identifier: argument.type
@@ -4728,12 +4704,6 @@ parameters:
47284704
count: 1
47294705
path: src/Dbal/DatabaseInterface.php
47304706

4731-
-
4732-
message: '#^Parameter \#1 \$string of function strtolower expects string, int\|string given\.$#'
4733-
identifier: argument.type
4734-
count: 1
4735-
path: src/Dbal/DatabaseInterface.php
4736-
47374707
-
47384708
message: '#^Parameter \#2 \$arrays of function array_diff expects an array of values castable to string, array given\.$#'
47394709
identifier: argument.type
@@ -17049,7 +17019,7 @@ parameters:
1704917019
Use dependency injection instead\.$#
1705017020
'''
1705117021
identifier: staticMethod.deprecated
17052-
count: 1
17022+
count: 3
1705317023
path: tests/unit/Plugins/Export/ExportSqlTest.php
1705417024

1705517025
-

‎psalm-baseline.xml‎

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -999,6 +999,7 @@
999999
<code><![CDATA[$replicaInfo['Wild_Do_Table']]]></code>
10001000
<code><![CDATA[$replicaInfo['Wild_Ignore_Table']]]></code>
10011001
<code><![CDATA[$request->getParam('pos')]]></code>
1002+
<code><![CDATA[Current::$database]]></code>
10021003
</MixedArgument>
10031004
<MixedArgumentTypeCoercion>
10041005
<code><![CDATA[uksort($tables, strnatcasecmp(...))]]></code>
@@ -3356,10 +3357,6 @@
33563357
<code><![CDATA[$this->versionComment]]></code>
33573358
<code><![CDATA[$this->versionString]]></code>
33583359
</MixedArgument>
3359-
<MixedArgumentTypeCoercion>
3360-
<code><![CDATA[uksort($eachTables, strnatcasecmp(...))]]></code>
3361-
<code><![CDATA[uksort($oneDatabaseTables, strnatcasecmp(...))]]></code>
3362-
</MixedArgumentTypeCoercion>
33633360
<MixedArrayAccess>
33643361
<code><![CDATA[$resultTarget[$row[$keyIndex]]]]></code>
33653362
<code><![CDATA[$resultTarget[]]]></code>
@@ -3368,8 +3365,6 @@
33683365
<code><![CDATA[$resultTarget[$row[$keyIndex]]]]></code>
33693366
</MixedArrayAssignment>
33703367
<MixedAssignment>
3371-
<code><![CDATA[$aLength]]></code>
3372-
<code><![CDATA[$bLength]]></code>
33733368
<code><![CDATA[$resultTarget]]></code>
33743369
<code><![CDATA[$resultTarget]]></code>
33753370
<code><![CDATA[$this->versionComment]]></code>
@@ -3409,17 +3404,10 @@
34093404
<NullableReturnStatement>
34103405
<code><![CDATA[$resultRows]]></code>
34113406
</NullableReturnStatement>
3412-
<PossiblyInvalidArgument>
3413-
<code><![CDATA[$tableData[$sortBy] ?? '']]></code>
3414-
</PossiblyInvalidArgument>
34153407
<PossiblyInvalidArrayOffset>
34163408
<code><![CDATA[$resultTarget[$row[$keyIndex]]]]></code>
34173409
<code><![CDATA[$resultTarget[$row[$keyIndex]]]]></code>
34183410
</PossiblyInvalidArrayOffset>
3419-
<PossiblyInvalidOperand>
3420-
<code><![CDATA[$tableData['Data_length']]]></code>
3421-
<code><![CDATA[$tableData['Index_length']]]></code>
3422-
</PossiblyInvalidOperand>
34233411
<PossiblyNullArgument>
34243412
<code><![CDATA[$_SERVER['SCRIPT_NAME']]]></code>
34253413
<code><![CDATA[$version['@@sql_mode']]]></code>
@@ -3441,8 +3429,6 @@
34413429
<code><![CDATA[$row['Index_length']]]></code>
34423430
<code><![CDATA[$row['Max_data_length']]]></code>
34433431
<code><![CDATA[$row['Rows']]]></code>
3444-
<code><![CDATA[$tableData['Data_length']]]></code>
3445-
<code><![CDATA[$tableData['Index_length']]]></code>
34463432
</PossiblyNullOperand>
34473433
<PossiblyUndefinedArrayOffset>
34483434
<code><![CDATA[$_SERVER['SCRIPT_NAME']]]></code>
@@ -3454,9 +3440,6 @@
34543440
<code><![CDATA[$index->isUnique()]]></code>
34553441
<code><![CDATA[$limitCount]]></code>
34563442
<code><![CDATA[$limitCount]]></code>
3457-
<code><![CDATA[$limitCount]]></code>
3458-
<code><![CDATA[$limitCount]]></code>
3459-
<code><![CDATA[$limitCount]]></code>
34603443
<code><![CDATA[empty($fieldData['Key'])]]></code>
34613444
</RiskyTruthyFalsyComparison>
34623445
<UnsupportedReferenceUsage>
@@ -5629,10 +5612,10 @@
56295612
<code><![CDATA[empty($statement->fields)]]></code>
56305613
<code><![CDATA[empty($statement->name->database)]]></code>
56315614
<code><![CDATA[empty($statement->table->database)]]></code>
5615+
<code><![CDATA[empty($tableStatus['Check_time'])]]></code>
5616+
<code><![CDATA[empty($tableStatus['Create_time'])]]></code>
5617+
<code><![CDATA[empty($tableStatus['Update_time'])]]></code>
56325618
<code><![CDATA[empty($this->config->selectedServer['port'])]]></code>
5633-
<code><![CDATA[empty($tmpres['Check_time'])]]></code>
5634-
<code><![CDATA[empty($tmpres['Create_time'])]]></code>
5635-
<code><![CDATA[empty($tmpres['Update_time'])]]></code>
56365619
</RiskyTruthyFalsyComparison>
56375620
</file>
56385621
<file src="src/Plugins/Export/ExportTexytext.php">
@@ -9898,6 +9881,8 @@
98989881
<file src="tests/unit/Plugins/Export/ExportSqlTest.php">
98999882
<DeprecatedMethod>
99009883
<code><![CDATA[Config::getInstance()]]></code>
9884+
<code><![CDATA[Config::getInstance()]]></code>
9885+
<code><![CDATA[Config::getInstance()]]></code>
99019886
</DeprecatedMethod>
99029887
<MixedArgument>
99039888
<code><![CDATA[$result]]></code>

0 commit comments

Comments
 (0)