Refactor getColumnNames()
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
This commit is contained in:
parent
c4f4a1ee9e
commit
94f70f8b68
@ -6958,7 +6958,7 @@ parameters:
|
||||
path: src/DatabaseInterface.php
|
||||
|
||||
-
|
||||
message: '#^Method PhpMyAdmin\\DatabaseInterface\:\:getColumnNames\(\) should return list\<string\> but returns array\<mixed\>\.$#'
|
||||
message: '#^Method PhpMyAdmin\\DatabaseInterface\:\:getColumnNames\(\) should return list\<string\> but returns list\<string\|null\>\.$#'
|
||||
identifier: return.type
|
||||
count: 1
|
||||
path: src/DatabaseInterface.php
|
||||
|
||||
@ -4229,9 +4229,6 @@
|
||||
<code><![CDATA[$row['Max_data_length']]]></code>
|
||||
<code><![CDATA[$row['Rows']]]></code>
|
||||
</InvalidOperand>
|
||||
<LessSpecificReturnStatement>
|
||||
<code><![CDATA[$this->fetchResultSimple($sql, 'Field', $connectionType)]]></code>
|
||||
</LessSpecificReturnStatement>
|
||||
<MixedArgument>
|
||||
<code><![CDATA[$a]]></code>
|
||||
<code><![CDATA[$b]]></code>
|
||||
@ -4300,10 +4297,9 @@
|
||||
* Visible?: string,
|
||||
* Expression?: string|null
|
||||
* }>]]></code>
|
||||
</MixedReturnTypeCoercion>
|
||||
<MoreSpecificReturnType>
|
||||
<code><![CDATA[array_column($result->fetchAllAssoc(), 'Field')]]></code>
|
||||
<code><![CDATA[list<string>]]></code>
|
||||
</MoreSpecificReturnType>
|
||||
</MixedReturnTypeCoercion>
|
||||
<NullableReturnStatement>
|
||||
<code><![CDATA[$user]]></code>
|
||||
</NullableReturnStatement>
|
||||
|
||||
@ -989,8 +989,14 @@ class DatabaseInterface implements DbalInterface
|
||||
): array {
|
||||
$sql = QueryGenerator::getColumnsSql($database, $table);
|
||||
|
||||
$result = $this->tryQuery($sql, $connectionType, cacheAffectedRows: false);
|
||||
|
||||
if ($result === false) {
|
||||
return [];
|
||||
}
|
||||
|
||||
// We only need the 'Field' column which contains the table's column names
|
||||
return $this->fetchResultSimple($sql, 'Field', $connectionType);
|
||||
return array_column($result->fetchAllAssoc(), 'Field');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user