Skip to content

Commit a3ba333

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

3 files changed

Lines changed: 5 additions & 32 deletions

File tree

libraries/classes/Index.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class Index
4040
/**
4141
* Columns in index
4242
*
43-
* @var array
43+
* @var array<string, IndexColumn>
4444
*/
4545
private $columns = [];
4646

@@ -239,7 +239,7 @@ private static function loadIndexes($table, $schema): bool
239239
/**
240240
* Add column to index
241241
*
242-
* @param array $params column params
242+
* @param string[] $params column params
243243
*/
244244
public function addColumn(array $params): void
245245
{
@@ -556,7 +556,7 @@ public function setName($name): void
556556
/**
557557
* Returns the columns of the index
558558
*
559-
* @return IndexColumn[] the columns of the index
559+
* @return array<string, IndexColumn>
560560
*/
561561
public function getColumns()
562562
{

phpstan-baseline.neon

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4215,11 +4215,6 @@ parameters:
42154215
count: 1
42164216
path: libraries/classes/Index.php
42174217

4218-
-
4219-
message: "#^Method PhpMyAdmin\\\\Index\\:\\:addColumn\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#"
4220-
count: 1
4221-
path: libraries/classes/Index.php
4222-
42234218
-
42244219
message: "#^Method PhpMyAdmin\\\\Index\\:\\:addColumns\\(\\) has parameter \\$columns with no value type specified in iterable type array\\.$#"
42254220
count: 1
@@ -4235,11 +4230,6 @@ parameters:
42354230
count: 1
42364231
path: libraries/classes/Index.php
42374232

4238-
-
4239-
message: "#^Property PhpMyAdmin\\\\Index\\:\\:\\$columns type has no value type specified in iterable type array\\.$#"
4240-
count: 1
4241-
path: libraries/classes/Index.php
4242-
42434233
-
42444234
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\\>\\>\\>\\.$#"
42454235
count: 1

psalm-baseline.xml

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7719,11 +7719,10 @@
77197719
<DocblockTypeContradiction occurrences="1">
77207720
<code>$this-&gt;packed === null</code>
77217721
</DocblockTypeContradiction>
7722-
<MixedArgument occurrences="5">
7722+
<MixedArgument occurrences="4">
77237723
<code>$_each_index</code>
77247724
<code>$_each_index</code>
77257725
<code>$column</code>
7726-
<code>$key</code>
77277726
<code>$params['columns']</code>
77287727
</MixedArgument>
77297728
<MixedArrayAccess occurrences="1">
@@ -7737,11 +7736,8 @@
77377736
<code>self::$registry[$schema][$table][$keyName]</code>
77387737
<code>self::$registry[$schema][$table][$keyName]</code>
77397738
</MixedArrayOffset>
7740-
<MixedAssignment occurrences="19">
7741-
<code>$column</code>
7739+
<MixedAssignment occurrences="16">
77427740
<code>$column</code>
7743-
<code>$data['columns'][]</code>
7744-
<code>$key</code>
77457741
<code>$key</code>
77467742
<code>$keyName</code>
77477743
<code>$name</code>
@@ -7758,19 +7754,9 @@
77587754
<code>$this-&gt;table</code>
77597755
<code>$this-&gt;type</code>
77607756
</MixedAssignment>
7761-
<MixedMethodCall occurrences="1">
7762-
<code>getCompareData</code>
7763-
</MixedMethodCall>
7764-
<MixedOperand occurrences="1">
7765-
<code>$key</code>
7766-
</MixedOperand>
77677757
<MixedPropertyTypeCoercion occurrences="1">
77687758
<code>self::$registry</code>
77697759
</MixedPropertyTypeCoercion>
7770-
<MixedReturnTypeCoercion occurrences="2">
7771-
<code>$this-&gt;columns</code>
7772-
<code>IndexColumn[]</code>
7773-
</MixedReturnTypeCoercion>
77747760
<PossiblyNullPropertyAssignmentValue occurrences="3">
77757761
<code>null</code>
77767762
<code>null</code>
@@ -12797,9 +12783,6 @@
1279712783
<code>$_SESSION['tmpval']['pos']</code>
1279812784
<code>$_SESSION['tmpval']['possible_as_geometry']</code>
1279912785
</MixedArrayAssignment>
12800-
<MixedArrayTypeCoercion occurrences="1">
12801-
<code>$columns[$indexColumnName]</code>
12802-
</MixedArrayTypeCoercion>
1280312786
<MixedAssignment occurrences="16">
1280412787
<code>$maxRows</code>
1280512788
<code>$oneFieldMeta</code>

0 commit comments

Comments
 (0)