Visitar URL original
Fix an error found by Psalm · phpmyadmin/phpmyadmin@0b5d7b6 · GitHub
Skip to content

Commit 0b5d7b6

Browse files
committed
Fix an error found by Psalm
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
1 parent 81b7b74 commit 0b5d7b6

3 files changed

Lines changed: 8 additions & 35 deletions

File tree

‎libraries/classes/Tracker.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -929,7 +929,7 @@ public static function handleQuery($query): void
929929
// 3. the statements
930930
// we want to track
931931
$sqlQuery .= " WHERE FIND_IN_SET('" . $result['identifier'] . "',tracking) > 0" .
932-
" AND `db_name` = '" . $GLOBALS['dbi']->escapeString($dbname ?? '') . "' " .
932+
" AND `db_name` = '" . $GLOBALS['dbi']->escapeString($dbname) . "' " .
933933
" AND `table_name` = '"
934934
. $GLOBALS['dbi']->escapeString($result['tablename']) . "' " .
935935
" AND `version` = '" . $GLOBALS['dbi']->escapeString((string) $version) . "' ";

‎phpstan-baseline.neon‎

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1916,22 +1916,22 @@ parameters:
19161916
path: libraries/classes/Database/Designer/Common.php
19171917

19181918
-
1919-
message: "#^Offset 'DCN' does not exist on array\\{C_NAME\\: array\\<int\\<0, max\\>, string\\>, DCN\\?\\: non\\-empty\\-array\\<int\\<0, max\\>, string\\>, DTN\\?\\: non\\-empty\\-array\\<int\\<0, max\\>, non\\-empty\\-string\\>, SCN\\?\\: non\\-empty\\-array\\<int\\<0, max\\>, string\\>, STN\\?\\: non\\-empty\\-array\\<int\\<0, max\\>, non\\-empty\\-string\\>\\}\\.$#"
1919+
message: "#^Offset 'DCN' does not exist on array\\{C_NAME\\: array\\{\\}\\}\\|array\\{C_NAME\\: non\\-empty\\-array\\<int\\<0, max\\>, string\\>, DCN\\: non\\-empty\\-array\\<int\\<0, max\\>, string\\>, DTN\\: non\\-empty\\-array\\<int\\<0, max\\>, non\\-falsy\\-string\\>, SCN\\: non\\-empty\\-array\\<int\\<0, max\\>, string\\>, STN\\: non\\-empty\\-array\\<int\\<0, max\\>, non\\-falsy\\-string\\>\\}\\.$#"
19201920
count: 1
19211921
path: libraries/classes/Database/Designer/Common.php
19221922

19231923
-
1924-
message: "#^Offset 'DTN' does not exist on array\\{C_NAME\\: array\\<int\\<0, max\\>, string\\>, DCN\\?\\: non\\-empty\\-array\\<int\\<0, max\\>, string\\>, DTN\\?\\: non\\-empty\\-array\\<int\\<0, max\\>, non\\-empty\\-string\\>, SCN\\?\\: non\\-empty\\-array\\<int\\<0, max\\>, string\\>, STN\\?\\: non\\-empty\\-array\\<int\\<0, max\\>, non\\-empty\\-string\\>\\}\\.$#"
1924+
message: "#^Offset 'DTN' does not exist on array\\{C_NAME\\: array\\{\\}\\}\\|array\\{C_NAME\\: non\\-empty\\-array\\<int\\<0, max\\>, string\\>, DCN\\: non\\-empty\\-array\\<int\\<0, max\\>, string\\>, DTN\\: non\\-empty\\-array\\<int\\<0, max\\>, non\\-falsy\\-string\\>, SCN\\: non\\-empty\\-array\\<int\\<0, max\\>, string\\>, STN\\: non\\-empty\\-array\\<int\\<0, max\\>, non\\-falsy\\-string\\>\\}\\.$#"
19251925
count: 1
19261926
path: libraries/classes/Database/Designer/Common.php
19271927

19281928
-
1929-
message: "#^Offset 'SCN' does not exist on array\\{C_NAME\\: array\\<int\\<0, max\\>, string\\>, DCN\\?\\: non\\-empty\\-array\\<int\\<0, max\\>, string\\>, DTN\\?\\: non\\-empty\\-array\\<int\\<0, max\\>, non\\-empty\\-string\\>, SCN\\?\\: non\\-empty\\-array\\<int\\<0, max\\>, string\\>, STN\\?\\: non\\-empty\\-array\\<int\\<0, max\\>, non\\-empty\\-string\\>\\}\\.$#"
1929+
message: "#^Offset 'SCN' does not exist on array\\{C_NAME\\: array\\{\\}\\}\\|array\\{C_NAME\\: non\\-empty\\-array\\<int\\<0, max\\>, string\\>, DCN\\: non\\-empty\\-array\\<int\\<0, max\\>, string\\>, DTN\\: non\\-empty\\-array\\<int\\<0, max\\>, non\\-falsy\\-string\\>, SCN\\: non\\-empty\\-array\\<int\\<0, max\\>, string\\>, STN\\: non\\-empty\\-array\\<int\\<0, max\\>, non\\-falsy\\-string\\>\\}\\.$#"
19301930
count: 1
19311931
path: libraries/classes/Database/Designer/Common.php
19321932

19331933
-
1934-
message: "#^Offset 'STN' does not exist on array\\{C_NAME\\: array\\<int\\<0, max\\>, string\\>, DCN\\?\\: non\\-empty\\-array\\<int\\<0, max\\>, string\\>, DTN\\?\\: non\\-empty\\-array\\<int\\<0, max\\>, non\\-empty\\-string\\>, SCN\\?\\: non\\-empty\\-array\\<int\\<0, max\\>, string\\>, STN\\?\\: non\\-empty\\-array\\<int\\<0, max\\>, non\\-empty\\-string\\>\\}\\.$#"
1934+
message: "#^Offset 'STN' does not exist on array\\{C_NAME\\: array\\{\\}\\}\\|array\\{C_NAME\\: non\\-empty\\-array\\<int\\<0, max\\>, string\\>, DCN\\: non\\-empty\\-array\\<int\\<0, max\\>, string\\>, DTN\\: non\\-empty\\-array\\<int\\<0, max\\>, non\\-falsy\\-string\\>, SCN\\: non\\-empty\\-array\\<int\\<0, max\\>, string\\>, STN\\: non\\-empty\\-array\\<int\\<0, max\\>, non\\-falsy\\-string\\>\\}\\.$#"
19351935
count: 2
19361936
path: libraries/classes/Database/Designer/Common.php
19371937

@@ -2430,11 +2430,6 @@ parameters:
24302430
count: 1
24312431
path: libraries/classes/DatabaseInterface.php
24322432

2433-
-
2434-
message: "#^Comparison operation \"\\<\\=\\>\" between \\(array\\|float\\|int\\) and \\(array\\|float\\|int\\) results in an error\\.$#"
2435-
count: 1
2436-
path: libraries/classes/DatabaseInterface.php
2437-
24382433
-
24392434
message: "#^Method PhpMyAdmin\\\\DatabaseInterface\\:\\:attachIndexInfoToColumns\\(\\) has parameter \\$fields with no value type specified in iterable type array\\.$#"
24402435
count: 1
@@ -2730,16 +2725,6 @@ parameters:
27302725
count: 2
27312726
path: libraries/classes/Dbal/MysqliResult.php
27322727

2733-
-
2734-
message: "#^Binary operation \"\\+\" between array\\<string, bool\\|string\\>\\|string and array\\{default_action\\: 'insert'\\} results in an error\\.$#"
2735-
count: 3
2736-
path: libraries/classes/Display/Results.php
2737-
2738-
-
2739-
message: "#^Binary operation \"\\+\" between array\\<string, bool\\|string\\>\\|string and array\\{default_action\\: 'update'\\} results in an error\\.$#"
2740-
count: 3
2741-
path: libraries/classes/Display/Results.php
2742-
27432728
-
27442729
message: "#^Cannot access offset int\\<0, max\\> on mixed\\.$#"
27452730
count: 2
@@ -6611,7 +6596,7 @@ parameters:
66116596
path: libraries/classes/SavedSearches.php
66126597

66136598
-
6614-
message: "#^Offset non\\-empty\\-string does not exist on array\\|string\\.$#"
6599+
message: "#^Offset non\\-falsy\\-string does not exist on array\\|string\\.$#"
66156600
count: 1
66166601
path: libraries/classes/SavedSearches.php
66176602

@@ -7780,11 +7765,6 @@ parameters:
77807765
count: 1
77817766
path: libraries/classes/Tracker.php
77827767

7783-
-
7784-
message: "#^Variable \\$dbname on left side of \\?\\? always exists and is not nullable\\.$#"
7785-
count: 1
7786-
path: libraries/classes/Tracker.php
7787-
77887768
-
77897769
message: "#^Cannot access offset 'COLUMNS' on mixed\\.$#"
77907770
count: 1

‎psalm-baseline.xml‎

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<files psalm-version="4.26.0@6998fabb2bf528b65777bf9941920888d23c03ac">
2+
<files psalm-version="4.27.0@faf106e717c37b8c81721845dba9de3d8deed8ff">
33
<file src="libraries/classes/Advisory/Advisor.php">
44
<MixedArgument occurrences="8">
55
<code>$matches[1]</code>
@@ -5572,7 +5572,7 @@
55725572
<InvalidReturnType occurrences="1">
55735573
<code>int|bool</code>
55745574
</InvalidReturnType>
5575-
<MixedArgument occurrences="48">
5575+
<MixedArgument occurrences="47">
55765576
<code>$_SERVER['SCRIPT_NAME']</code>
55775577
<code>$a</code>
55785578
<code>$arrayKeys</code>
@@ -5597,7 +5597,6 @@
55975597
<code>$link</code>
55985598
<code>$link</code>
55995599
<code>$password</code>
5600-
<code>$server</code>
56015600
<code>$sql</code>
56025601
<code>$table</code>
56035602
<code>$table</code>
@@ -13560,17 +13559,11 @@
1356013559
<RedundantCastGivenDocblockType occurrences="1">
1356113560
<code>(string) $version</code>
1356213561
</RedundantCastGivenDocblockType>
13563-
<RedundantCondition occurrences="1">
13564-
<code>$dbname</code>
13565-
</RedundantCondition>
1356613562
<RedundantConditionGivenDocblockType occurrences="3">
1356713563
<code>$statement-&gt;name !== null</code>
1356813564
<code>$statement-&gt;name !== null</code>
1356913565
<code>isset($statement-&gt;options)</code>
1357013566
</RedundantConditionGivenDocblockType>
13571-
<TypeDoesNotContainNull occurrences="1">
13572-
<code>''</code>
13573-
</TypeDoesNotContainNull>
1357413567
</file>
1357513568
<file src="libraries/classes/Tracking.php">
1357613569
<MixedArgument occurrences="47">

0 commit comments

Comments
 (0)