Skip to content

Commit e9d742f

Browse files
committed
Add better type description to Index::$registry
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
1 parent ec9af1b commit e9d742f

3 files changed

Lines changed: 25 additions & 23 deletions

File tree

libraries/classes/Index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Index
2424
/**
2525
* Class-wide storage container for indexes (caching, singleton)
2626
*
27-
* @var array
27+
* @var array<string, array<string, array<string, Index>>>
2828
*/
2929
private static $registry = [];
3030

phpstan-baseline.neon

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4241,7 +4241,7 @@ parameters:
42414241
path: libraries/classes/Index.php
42424242

42434243
-
4244-
message: "#^Property PhpMyAdmin\\\\Index\\:\\:\\$registry type has no value type specified in iterable type array\\.$#"
4244+
message: "#^Static property PhpMyAdmin\\\\Index\\:\\:\\$registry \\(array\\<string, array\\<string, array\\<string, PhpMyAdmin\\\\Index\\>\\>\\>\\) does not accept array\\<string, array\\<string, array\\<int\\|string, PhpMyAdmin\\\\Index\\>\\>\\>\\.$#"
42454245
count: 1
42464246
path: libraries/classes/Index.php
42474247

@@ -5850,6 +5850,11 @@ parameters:
58505850
count: 1
58515851
path: libraries/classes/Plugins/Import/ImportSql.php
58525852

5853+
-
5854+
message: "#^Cannot assign new offset to array\\<int, array\\<int, string\\>\\|string\\>\\|string\\.$#"
5855+
count: 1
5856+
path: libraries/classes/Plugins/Import/ImportXml.php
5857+
58535858
-
58545859
message: "#^Offset 'charset' does not exist on SimpleXMLElement\\|null\\.$#"
58555860
count: 1
@@ -5865,6 +5870,16 @@ parameters:
58655870
count: 8
58665871
path: libraries/classes/Plugins/Import/ImportXml.php
58675872

5873+
-
5874+
message: "#^Parameter \\#1 \\$str1 of function strcmp expects string, array\\<int, array\\<int, string\\>\\|string\\>\\|string given\\.$#"
5875+
count: 1
5876+
path: libraries/classes/Plugins/Import/ImportXml.php
5877+
5878+
-
5879+
message: "#^array\\<int, array\\<int, string\\>\\|string\\>\\|string does not accept array\\<int, string\\>\\.$#"
5880+
count: 1
5881+
path: libraries/classes/Plugins/Import/ImportXml.php
5882+
58685883
-
58695884
message: "#^Method PhpMyAdmin\\\\Plugins\\\\Import\\\\Upload\\\\UploadNoplugin\\:\\:getUploadStatus\\(\\) return type has no value type specified in iterable type array\\.$#"
58705885
count: 1

psalm-baseline.xml

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7726,28 +7726,23 @@
77267726
<code>$key</code>
77277727
<code>$params['columns']</code>
77287728
</MixedArgument>
7729-
<MixedArrayAccess occurrences="2">
7729+
<MixedArrayAccess occurrences="1">
77307730
<code>$_each_index['Key_name']</code>
7731-
<code>self::$registry[$schema][$table][$keyName]</code>
77327731
</MixedArrayAccess>
7733-
<MixedArrayAssignment occurrences="3">
7732+
<MixedArrayAssignment occurrences="1">
77347733
<code>$_each_index['Schema']</code>
7735-
<code>self::$registry[$schema][$table]</code>
7736-
<code>self::$registry[$schema][$table]</code>
77377734
</MixedArrayAssignment>
7738-
<MixedArrayOffset occurrences="4">
7735+
<MixedArrayOffset occurrences="3">
77397736
<code>$columns['sub_parts'][$key]</code>
77407737
<code>self::$registry[$schema][$table][$keyName]</code>
77417738
<code>self::$registry[$schema][$table][$keyName]</code>
7742-
<code>self::$registry[$schema][$table][$keyName]</code>
77437739
</MixedArrayOffset>
7744-
<MixedAssignment occurrences="20">
7740+
<MixedAssignment occurrences="19">
77457741
<code>$column</code>
77467742
<code>$column</code>
77477743
<code>$data['columns'][]</code>
77487744
<code>$key</code>
77497745
<code>$key</code>
7750-
<code>$key</code>
77517746
<code>$keyName</code>
77527747
<code>$name</code>
77537748
<code>$sub_part</code>
@@ -7763,23 +7758,15 @@
77637758
<code>$this-&gt;table</code>
77647759
<code>$this-&gt;type</code>
77657760
</MixedAssignment>
7766-
<MixedInferredReturnType occurrences="3">
7767-
<code>Index</code>
7768-
<code>Index[]</code>
7769-
<code>Index|false</code>
7770-
</MixedInferredReturnType>
7771-
<MixedMethodCall occurrences="2">
7772-
<code>addColumn</code>
7761+
<MixedMethodCall occurrences="1">
77737762
<code>getCompareData</code>
77747763
</MixedMethodCall>
77757764
<MixedOperand occurrences="1">
77767765
<code>$key</code>
77777766
</MixedOperand>
7778-
<MixedReturnStatement occurrences="3">
7779-
<code>self::$registry[$schema][$table]</code>
7780-
<code>self::$registry[$schema][$table][$index_name]</code>
7781-
<code>self::$registry[$schema][$table]['PRIMARY']</code>
7782-
</MixedReturnStatement>
7767+
<MixedPropertyTypeCoercion occurrences="1">
7768+
<code>self::$registry</code>
7769+
</MixedPropertyTypeCoercion>
77837770
<MixedReturnTypeCoercion occurrences="2">
77847771
<code>$this-&gt;columns</code>
77857772
<code>IndexColumn[]</code>

0 commit comments

Comments
 (0)