Skip to content

Commit 6e102ed

Browse files
committed
Add type hint for getStatusInfo()
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
1 parent 344e330 commit 6e102ed

4 files changed

Lines changed: 61 additions & 179 deletions

File tree

phpstan-baseline.neon

Lines changed: 18 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1590,11 +1590,6 @@ parameters:
15901590
count: 1
15911591
path: src/Controllers/Database/DataDictionaryController.php
15921592

1593-
-
1594-
message: "#^Cannot cast mixed to string\\.$#"
1595-
count: 1
1596-
path: src/Controllers/Database/DataDictionaryController.php
1597-
15981593
-
15991594
message: "#^Cannot access offset 'dbName' on mixed\\.$#"
16001595
count: 2
@@ -5891,58 +5886,28 @@ parameters:
58915886
path: src/Controllers/Table/Structure/SaveController.php
58925887

58935888
-
5894-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
5895-
count: 1
5896-
path: src/Controllers/Table/StructureController.php
5897-
5898-
-
5899-
message: "#^Cannot access offset 'Check_time' on mixed\\.$#"
5900-
count: 1
5901-
path: src/Controllers/Table/StructureController.php
5902-
5903-
-
5904-
message: "#^Cannot access offset 'Create_time' on mixed\\.$#"
5905-
count: 1
5906-
path: src/Controllers/Table/StructureController.php
5907-
5908-
-
5909-
message: "#^Cannot access offset 'Data_free' on mixed\\.$#"
5910-
count: 1
5911-
path: src/Controllers/Table/StructureController.php
5912-
5913-
-
5914-
message: "#^Cannot access offset 'Data_length' on mixed\\.$#"
5915-
count: 7
5916-
path: src/Controllers/Table/StructureController.php
5917-
5918-
-
5919-
message: "#^Cannot access offset 'Index_length' on mixed\\.$#"
5920-
count: 2
5921-
path: src/Controllers/Table/StructureController.php
5922-
5923-
-
5924-
message: "#^Cannot access offset 'Name' on mixed\\.$#"
5925-
count: 1
5889+
message: "#^Binary operation \"\\+\" between int\\|non\\-falsy\\-string and int\\|non\\-falsy\\-string results in an error\\.$#"
5890+
count: 4
59265891
path: src/Controllers/Table/StructureController.php
59275892

59285893
-
5929-
message: "#^Cannot access offset 'Rows' on mixed\\.$#"
5894+
message: "#^Binary operation \"\\-\" between mixed and int\\|string results in an error\\.$#"
59305895
count: 1
59315896
path: src/Controllers/Table/StructureController.php
59325897

59335898
-
5934-
message: "#^Cannot access offset 'Type' on mixed\\.$#"
5899+
message: "#^Binary operation \"/\" between mixed and int\\|string\\|null results in an error\\.$#"
59355900
count: 1
59365901
path: src/Controllers/Table/StructureController.php
59375902

59385903
-
5939-
message: "#^Cannot access offset 'Update_time' on mixed\\.$#"
5904+
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
59405905
count: 1
59415906
path: src/Controllers/Table/StructureController.php
59425907

59435908
-
59445909
message: "#^Cannot use array destructuring on array\\<int, string\\>\\|null\\.$#"
5945-
count: 1
5910+
count: 4
59465911
path: src/Controllers/Table/StructureController.php
59475912

59485913
-
@@ -5956,28 +5921,18 @@ parameters:
59565921
path: src/Controllers/Table/StructureController.php
59575922

59585923
-
5959-
message: "#^Parameter \\#1 \\$datetime of function strtotime expects string, mixed given\\.$#"
5924+
message: "#^Parameter \\#1 \\$datetime of function strtotime expects string, int\\|string given\\.$#"
59605925
count: 3
59615926
path: src/Controllers/Table/StructureController.php
59625927

59635928
-
5964-
message: "#^Parameter \\#1 \\$showTableName of method PhpMyAdmin\\\\Table\\\\Table\\:\\:getNumRows\\(\\) expects string, mixed given\\.$#"
5965-
count: 1
5966-
path: src/Controllers/Table/StructureController.php
5967-
5968-
-
5969-
message: "#^Parameter \\#1 \\$timestamp of static method PhpMyAdmin\\\\Util\\:\\:localisedDate\\(\\) expects int, \\(int\\|false\\) given\\.$#"
5929+
message: "#^Parameter \\#1 \\$timestamp of static method PhpMyAdmin\\\\Util\\:\\:localisedDate\\(\\) expects int, int\\|false given\\.$#"
59705930
count: 3
59715931
path: src/Controllers/Table/StructureController.php
59725932

5973-
-
5974-
message: "#^Parameter \\#1 \\$value of static method PhpMyAdmin\\\\Util\\:\\:formatByteDown\\(\\) expects float\\|int\\|string\\|null, \\(array\\|float\\|int\\) given\\.$#"
5975-
count: 2
5976-
path: src/Controllers/Table/StructureController.php
5977-
59785933
-
59795934
message: "#^Parameter \\#1 \\$value of static method PhpMyAdmin\\\\Util\\:\\:formatByteDown\\(\\) expects float\\|int\\|string\\|null, mixed given\\.$#"
5980-
count: 3
5935+
count: 4
59815936
path: src/Controllers/Table/StructureController.php
59825937

59835938
-
@@ -13015,26 +12970,6 @@ parameters:
1301512970
count: 10
1301612971
path: src/Plugins/Schema/Pdf/PdfRelationSchema.php
1301712972

13018-
-
13019-
message: "#^Cannot access offset 'Check_time' on mixed\\.$#"
13020-
count: 1
13021-
path: src/Plugins/Schema/Pdf/PdfRelationSchema.php
13022-
13023-
-
13024-
message: "#^Cannot access offset 'Comment' on mixed\\.$#"
13025-
count: 1
13026-
path: src/Plugins/Schema/Pdf/PdfRelationSchema.php
13027-
13028-
-
13029-
message: "#^Cannot access offset 'Create_time' on mixed\\.$#"
13030-
count: 1
13031-
path: src/Plugins/Schema/Pdf/PdfRelationSchema.php
13032-
13033-
-
13034-
message: "#^Cannot access offset 'Update_time' on mixed\\.$#"
13035-
count: 1
13036-
path: src/Plugins/Schema/Pdf/PdfRelationSchema.php
13037-
1303812973
-
1303912974
message: "#^Cannot access offset 'foreign_field' on mixed\\.$#"
1304012975
count: 1
@@ -13091,7 +13026,7 @@ parameters:
1309113026
path: src/Plugins/Schema/Pdf/PdfRelationSchema.php
1309213027

1309313028
-
13094-
message: "#^Parameter \\#1 \\$datetime of function strtotime expects string, mixed given\\.$#"
13029+
message: "#^Parameter \\#1 \\$datetime of function strtotime expects string, int\\|string given\\.$#"
1309513030
count: 3
1309613031
path: src/Plugins/Schema/Pdf/PdfRelationSchema.php
1309713032

@@ -13101,7 +13036,7 @@ parameters:
1310113036
path: src/Plugins/Schema/Pdf/PdfRelationSchema.php
1310213037

1310313038
-
13104-
message: "#^Parameter \\#1 \\$timestamp of static method PhpMyAdmin\\\\Util\\:\\:localisedDate\\(\\) expects int, \\(int\\|false\\) given\\.$#"
13039+
message: "#^Parameter \\#1 \\$timestamp of static method PhpMyAdmin\\\\Util\\:\\:localisedDate\\(\\) expects int, int\\|false given\\.$#"
1310513040
count: 3
1310613041
path: src/Plugins/Schema/Pdf/PdfRelationSchema.php
1310713042

@@ -15452,31 +15387,31 @@ parameters:
1545215387

1545315388
-
1545415389
message: "#^Cannot cast mixed to int\\.$#"
15455-
count: 2
15390+
count: 1
1545615391
path: src/Table/Table.php
1545715392

1545815393
-
1545915394
message: "#^Cannot cast mixed to string\\.$#"
15460-
count: 3
15395+
count: 2
1546115396
path: src/Table/Table.php
1546215397

1546315398
-
1546415399
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
15465-
count: 19
15400+
count: 18
1546615401
path: src/Table/Table.php
1546715402

1546815403
-
15469-
message: "#^Method PhpMyAdmin\\\\Table\\\\Table\\:\\:getAutoIncrement\\(\\) should return string but returns mixed\\.$#"
15404+
message: "#^Method PhpMyAdmin\\\\Table\\\\Table\\:\\:getAutoIncrement\\(\\) should return string but returns int\\|string\\.$#"
1547015405
count: 1
1547115406
path: src/Table/Table.php
1547215407

1547315408
-
15474-
message: "#^Method PhpMyAdmin\\\\Table\\\\Table\\:\\:getCollation\\(\\) should return string but returns mixed\\.$#"
15409+
message: "#^Method PhpMyAdmin\\\\Table\\\\Table\\:\\:getCollation\\(\\) should return string but returns int\\|string\\.$#"
1547515410
count: 1
1547615411
path: src/Table/Table.php
1547715412

1547815413
-
15479-
message: "#^Method PhpMyAdmin\\\\Table\\\\Table\\:\\:getComment\\(\\) should return string but returns mixed\\.$#"
15414+
message: "#^Method PhpMyAdmin\\\\Table\\\\Table\\:\\:getComment\\(\\) should return string but returns int\\|string\\.$#"
1548015415
count: 1
1548115416
path: src/Table/Table.php
1548215417

@@ -15627,7 +15562,7 @@ parameters:
1562715562

1562815563
-
1562915564
message: "#^Parameter \\#2 \\$string of function explode expects string, mixed given\\.$#"
15630-
count: 3
15565+
count: 2
1563115566
path: src/Table/Table.php
1563215567

1563315568
-

psalm-baseline.xml

Lines changed: 30 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -2404,8 +2404,6 @@
24042404
<code><![CDATA[$GLOBALS['auto_increment']]]></code>
24052405
<code><![CDATA[$GLOBALS['errorUrl']]]></code>
24062406
<code><![CDATA[$GLOBALS['message_to_show']]]></code>
2407-
<code>$rowFormat</code>
2408-
<code>$rowFormat</code>
24092407
</MixedAssignment>
24102408
</file>
24112409
<file src="src/Controllers/Operations/ViewController.php">
@@ -4087,47 +4085,34 @@
40874085
<InvalidArrayOffset>
40884086
<code><![CDATA[$GLOBALS['errorUrl']]]></code>
40894087
</InvalidArrayOffset>
4090-
<MixedArgument>
4091-
<code><![CDATA[$showTable['Check_time']]]></code>
4092-
<code><![CDATA[$showTable['Create_time']]]></code>
4093-
<code><![CDATA[$showTable['Data_free']]]></code>
4094-
<code><![CDATA[$showTable['Data_length']]]></code>
4095-
<code><![CDATA[$showTable['Data_length']
4096-
+ $showTable['Index_length']]]></code>
4097-
<code><![CDATA[$showTable['Data_length']
4098-
+ $showTable['Index_length']
4099-
- $showTable['Data_free']]]></code>
4100-
<code><![CDATA[$showTable['Data_length'] + $showTable['Index_length']]]></code>
4101-
<code><![CDATA[$showTable['Index_length']]]></code>
4102-
<code><![CDATA[$showTable['Name']]]></code>
4103-
<code><![CDATA[$showTable['Update_time']]]></code>
4104-
<code><![CDATA[($showTable['Data_length']
4105-
+ $showTable['Index_length'])
4106-
/ $showTable['Rows']]]></code>
4107-
</MixedArgument>
4108-
<MixedArrayAccess>
4109-
<code><![CDATA[$showTable['Name']]]></code>
4110-
<code><![CDATA[$showTable['Rows']]]></code>
4111-
</MixedArrayAccess>
4112-
<MixedArrayAssignment>
4113-
<code><![CDATA[$showTable['Data_length']]]></code>
4114-
<code><![CDATA[$showTable['Index_length']]]></code>
4115-
</MixedArrayAssignment>
41164088
<MixedAssignment>
41174089
<code><![CDATA[$GLOBALS['errorUrl']]]></code>
41184090
<code>$attributes[$rownum]</code>
4119-
<code>$showTable</code>
41204091
</MixedAssignment>
41214092
<MixedOperand>
41224093
<code><![CDATA[$displayedFields[$rownum]->icon]]></code>
41234094
<code><![CDATA[$displayedFields[$rownum]->icon]]></code>
4095+
</MixedOperand>
4096+
<PossiblyInvalidArgument>
4097+
<code><![CDATA[$showTable['Check_time']]]></code>
4098+
<code><![CDATA[$showTable['Create_time']]]></code>
4099+
<code><![CDATA[$showTable['Update_time']]]></code>
4100+
</PossiblyInvalidArgument>
4101+
<PossiblyInvalidOperand>
4102+
<code><![CDATA[$showTable['Data_free']]]></code>
4103+
<code><![CDATA[$showTable['Data_length']]]></code>
4104+
<code><![CDATA[$showTable['Data_length']]]></code>
4105+
<code><![CDATA[$showTable['Data_length']]]></code>
41244106
<code><![CDATA[$showTable['Data_length']]]></code>
4125-
<code><![CDATA[$showTable['Data_length']
4126-
+ $showTable['Index_length']]]></code>
41274107
<code><![CDATA[$showTable['Index_length']]]></code>
41284108
<code><![CDATA[$showTable['Index_length']]]></code>
41294109
<code><![CDATA[$showTable['Index_length']]]></code>
4130-
</MixedOperand>
4110+
<code><![CDATA[$showTable['Index_length']]]></code>
4111+
<code><![CDATA[$showTable['Rows']]]></code>
4112+
</PossiblyInvalidOperand>
4113+
<PossiblyNullOperand>
4114+
<code><![CDATA[$showTable['Rows']]]></code>
4115+
</PossiblyNullOperand>
41314116
</file>
41324117
<file src="src/Controllers/Table/TrackingController.php">
41334118
<DeprecatedMethod>
@@ -5529,7 +5514,6 @@
55295514
<code>$query</code>
55305515
<code>$rel</code>
55315516
<code>$relationalDisplay</code>
5532-
<code>$tableCreateTime</code>
55335517
<code>$value</code>
55345518
</MixedAssignment>
55355519
<MixedInferredReturnType>
@@ -9806,9 +9790,6 @@
98069790
<code><![CDATA[$oneKey['ref_table_name']]]></code>
98079791
<code><![CDATA[$rel['foreign_field']]]></code>
98089792
<code><![CDATA[$rel['foreign_table']]]></code>
9809-
<code><![CDATA[$showTable['Check_time']]]></code>
9810-
<code><![CDATA[$showTable['Create_time']]]></code>
9811-
<code><![CDATA[$showTable['Update_time']]]></code>
98129793
<code>$table</code>
98139794
<code>$table</code>
98149795
<code>$table</code>
@@ -9831,10 +9812,6 @@
98319812
<code><![CDATA[$rel['foreign_field']]]></code>
98329813
<code><![CDATA[$rel['foreign_table']]]></code>
98339814
<code><![CDATA[$rel['foreign_table']]]></code>
9834-
<code><![CDATA[$showTable['Check_time']]]></code>
9835-
<code><![CDATA[$showTable['Comment']]]></code>
9836-
<code><![CDATA[$showTable['Create_time']]]></code>
9837-
<code><![CDATA[$showTable['Update_time']]]></code>
98389815
<code><![CDATA[$this->pdf->customLinks['RT']['-']]]></code>
98399816
<code><![CDATA[$this->pdf->customLinks['doc'][$foreigner['foreign_table']]]]></code>
98409817
<code><![CDATA[$this->pdf->customLinks['doc'][$table]]]></code>
@@ -9872,8 +9849,6 @@
98729849
<code>$oneField</code>
98739850
<code>$oneKey</code>
98749851
<code>$rel</code>
9875-
<code>$showComment</code>
9876-
<code>$showTable</code>
98779852
<code>$table</code>
98789853
<code>$table</code>
98799854
<code>$type</code>
@@ -9884,12 +9859,14 @@
98849859
<code><![CDATA[$foreigner['foreign_table']]]></code>
98859860
<code><![CDATA[$foreigner['on_delete']]]></code>
98869861
<code><![CDATA[$foreigner['on_update']]]></code>
9887-
<code>$showComment</code>
98889862
<code>$table</code>
98899863
<code>$table</code>
98909864
</MixedOperand>
98919865
<PossiblyInvalidArgument>
98929866
<code><![CDATA[$_REQUEST['pdf_table_order']]]></code>
9867+
<code><![CDATA[$showTable['Check_time']]]></code>
9868+
<code><![CDATA[$showTable['Create_time']]]></code>
9869+
<code><![CDATA[$showTable['Update_time']]]></code>
98939870
</PossiblyInvalidArgument>
98949871
<PossiblyInvalidCast>
98959872
<code><![CDATA[$_REQUEST['pdf_orientation']]]></code>
@@ -11588,6 +11565,16 @@
1158811565
<code><![CDATA[$GLOBALS['sql_auto_increments']]]></code>
1158911566
<code><![CDATA[$GLOBALS['sql_indexes']]]></code>
1159011567
</InvalidArrayOffset>
11568+
<InvalidReturnStatement>
11569+
<code><![CDATA[$tableAutoIncrement ?? '']]></code>
11570+
<code><![CDATA[$this->getStatusInfo('TABLE_COLLATION') ?? '']]></code>
11571+
<code><![CDATA[$this->getStatusInfo('TABLE_COMMENT') ?? '']]></code>
11572+
</InvalidReturnStatement>
11573+
<InvalidReturnType>
11574+
<code>string</code>
11575+
<code>string</code>
11576+
<code>string</code>
11577+
</InvalidReturnType>
1159111578
<MixedArgument>
1159211579
<code><![CDATA[$GLOBALS['sql_auto_increments']]]></code>
1159311580
<code><![CDATA[$GLOBALS['sql_indexes']]]></code>
@@ -11627,7 +11614,6 @@
1162711614
<code><![CDATA[$optionsArray[$existrelForeign[$masterFieldMd5]['on_update'] ?? ''] ?? null]]></code>
1162811615
<code><![CDATA[$options['expr']]]></code>
1162911616
<code><![CDATA[$row['Type']]]></code>
11630-
<code>$tableOptions</code>
1163111617
<code><![CDATA[$this->uiprefs[$property]]]></code>
1163211618
<code><![CDATA[$this->uiprefs[$property]]]></code>
1163311619
<code>$value</code>
@@ -11703,7 +11689,6 @@
1170311689
<code>$column</code>
1170411690
<code><![CDATA[$columns[$row['Field']]]]></code>
1170511691
<code>$constraintName</code>
11706-
<code>$currCreateTime</code>
1170711692
<code>$eachCol</code>
1170811693
<code>$foreignDb</code>
1170911694
<code>$foreignDb</code>
@@ -11723,14 +11708,6 @@
1172311708
<code>$refDbName</code>
1172411709
<code>$ret[]</code>
1172511710
<code>$row</code>
11726-
<code>$tableAutoIncrement</code>
11727-
<code>$tableCollation</code>
11728-
<code>$tableComment</code>
11729-
<code>$tableNumRowInfo</code>
11730-
<code>$tableOptions</code>
11731-
<code>$tableRowFormat</code>
11732-
<code>$tableStorageEngine</code>
11733-
<code>$type</code>
1173411711
<code>$value</code>
1173511712
<code>$value</code>
1173611713
<code>$value</code>
@@ -11739,9 +11716,6 @@
1173911716
<code>mixed[]</code>
1174011717
<code>string</code>
1174111718
<code>string</code>
11742-
<code>string</code>
11743-
<code>string</code>
11744-
<code>string</code>
1174511719
</MixedInferredReturnType>
1174611720
<MixedMethodCall>
1174711721
<code>has</code>
@@ -11760,11 +11734,6 @@
1176011734
<code><![CDATA[$altered->options]]></code>
1176111735
</MixedPropertyFetch>
1176211736
<MixedReturnStatement>
11763-
<code><![CDATA[$tableAutoIncrement ?? '']]></code>
11764-
<code><![CDATA[$tableAutoIncrement ?? '']]></code>
11765-
<code><![CDATA[$tableCollation ?? '']]></code>
11766-
<code><![CDATA[$tableCollation ?? '']]></code>
11767-
<code>$tableComment</code>
1176811737
<code><![CDATA[end($this->errors)]]></code>
1176911738
<code><![CDATA[end($this->messages)]]></code>
1177011739
<code>json_decode($value, true)</code>

0 commit comments

Comments
 (0)