Fix type hint for getFieldNames()

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
This commit is contained in:
Kamil Tekiela 2024-09-17 09:54:36 +01:00
parent 60d16cc6e7
commit a5c792f977
5 changed files with 10 additions and 54 deletions

View File

@ -6295,11 +6295,6 @@ parameters:
count: 1
path: src/Dbal/MysqliResult.php
-
message: "#^Method PhpMyAdmin\\\\Dbal\\\\MysqliResult\\:\\:getFieldNames\\(\\) should return array\\<int, non\\-empty\\-string\\> but returns array\\<int, string\\>\\.$#"
count: 1
path: src/Dbal/MysqliResult.php
-
message: "#^Parameter \\#1 \\$field of class PhpMyAdmin\\\\FieldMetadata constructor expects object\\{name\\: non\\-empty\\-string, orgname\\: string, table\\: string, orgtable\\: string, max_length\\: int, length\\: int, charsetnr\\: int, flags\\: int, type\\: int, decimals\\: int, db\\: string, def\\: string, catalog\\: string\\}, object\\{name\\: string, orgname\\: string, table\\: string, orgtable\\: string, def\\: string, db\\: string, catalog\\: 'def', max_length\\: 0, length\\: int, charsetnr\\: string, flags\\: int, type\\: int, decimals\\: int\\}&stdClass given\\.$#"
count: 1
@ -9550,14 +9545,9 @@ parameters:
count: 1
path: src/Plugins/Export/ExportCsv.php
-
message: "#^Cannot access offset non\\-empty\\-string on mixed\\.$#"
count: 1
path: src/Plugins/Export/ExportCsv.php
-
message: "#^Cannot access offset string on mixed\\.$#"
count: 1
count: 2
path: src/Plugins/Export/ExportCsv.php
-
@ -9600,14 +9590,9 @@ parameters:
count: 3
path: src/Plugins/Export/ExportHtmlword.php
-
message: "#^Cannot access offset non\\-empty\\-string on mixed\\.$#"
count: 1
path: src/Plugins/Export/ExportHtmlword.php
-
message: "#^Cannot access offset string on mixed\\.$#"
count: 5
count: 6
path: src/Plugins/Export/ExportHtmlword.php
-
@ -9660,14 +9645,9 @@ parameters:
count: 2
path: src/Plugins/Export/ExportLatex.php
-
message: "#^Cannot access offset non\\-empty\\-string on mixed\\.$#"
count: 1
path: src/Plugins/Export/ExportLatex.php
-
message: "#^Cannot access offset string on mixed\\.$#"
count: 3
count: 4
path: src/Plugins/Export/ExportLatex.php
-
@ -9880,14 +9860,9 @@ parameters:
count: 1
path: src/Plugins/Export/ExportPhparray.php
-
message: "#^Cannot access offset non\\-empty\\-string on mixed\\.$#"
count: 1
path: src/Plugins/Export/ExportPhparray.php
-
message: "#^Cannot access offset string on mixed\\.$#"
count: 1
count: 2
path: src/Plugins/Export/ExportPhparray.php
-
@ -10185,14 +10160,9 @@ parameters:
count: 3
path: src/Plugins/Export/ExportTexytext.php
-
message: "#^Cannot access offset non\\-empty\\-string on mixed\\.$#"
count: 1
path: src/Plugins/Export/ExportTexytext.php
-
message: "#^Cannot access offset string on mixed\\.$#"
count: 5
count: 6
path: src/Plugins/Export/ExportTexytext.php
-
@ -10235,14 +10205,9 @@ parameters:
count: 1
path: src/Plugins/Export/ExportXml.php
-
message: "#^Cannot access offset non\\-empty\\-string on mixed\\.$#"
count: 1
path: src/Plugins/Export/ExportXml.php
-
message: "#^Cannot access offset string on mixed\\.$#"
count: 1
count: 2
path: src/Plugins/Export/ExportXml.php
-

View File

@ -5227,18 +5227,12 @@
<code><![CDATA[list<array<array-key, string|null>>]]></code>
<code><![CDATA[list<string|null>]]></code>
</InvalidReturnType>
<LessSpecificReturnStatement>
<code><![CDATA[array_column($this->result->fetch_fields(), 'name')]]></code>
</LessSpecificReturnStatement>
<MixedReturnTypeCoercion>
<code><![CDATA[array<array-key, string|null>]]></code>
<code><![CDATA[array_column($result, $column)]]></code>
<code><![CDATA[array_column($this->result->fetch_all(), 1, 0)]]></code>
<code><![CDATA[list<string|null>]]></code>
</MixedReturnTypeCoercion>
<MoreSpecificReturnType>
<code><![CDATA[list<non-empty-string>]]></code>
</MoreSpecificReturnType>
</file>
<file src="src/Display/Results.php">
<InvalidArgument>

View File

@ -207,7 +207,7 @@ final class MysqliResult implements ResultInterface
}
/**
* returns meta info for fields in $result
* Returns meta info for fields in $result
*
* @return array<int, FieldMetadata> meta info for fields in $result
* @psalm-return list<FieldMetadata>
@ -229,8 +229,7 @@ final class MysqliResult implements ResultInterface
/**
* Returns the names of the fields in the result
*
* @return array<int, string> Fields names
* @psalm-return list<non-empty-string>
* @return list<string> Fields names
*/
public function getFieldNames(): array
{

View File

@ -106,8 +106,7 @@ interface ResultInterface extends IteratorAggregate
/**
* Returns the names of the fields in the result
*
* @return array<int, string> Fields names
* @psalm-return list<non-empty-string>
* @return list<string> Fields names
*/
public function getFieldNames(): array;
}

View File

@ -265,8 +265,7 @@ class DummyResult implements ResultInterface
/**
* Returns the names of the fields in the result
*
* @return array<int, string> Fields names
* @psalm-return list<non-empty-string>
* @return list<string> Fields names
*/
public function getFieldNames(): array
{