Use array_fill_keys

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
This commit is contained in:
Kamil Tekiela 2023-04-02 23:34:03 +01:00
parent 49cb7e89b2
commit cd9ca8419a
2 changed files with 3 additions and 11 deletions

View File

@ -19,6 +19,7 @@ use PhpMyAdmin\Util;
use PhpMyAdmin\Version;
use function __;
use function array_fill_keys;
use function array_keys;
use function array_reverse;
use function array_search;
@ -220,9 +221,6 @@ class Relation
*/
private function checkRelationsParam(): array
{
$relationParams = [];
$relationParams['version'] = Version::VERSION;
$workToTable = [
'relwork' => 'relation',
'displaywork' => ['relation', 'table_info'],
@ -244,10 +242,9 @@ class Relation
'exporttemplateswork' => 'export_templates',
];
foreach (array_keys($workToTable) as $work) {
$relationParams[$work] = false;
}
$relationParams = array_fill_keys(array_keys($workToTable), false);
$relationParams['version'] = Version::VERSION;
$relationParams['allworks'] = false;
$relationParams['user'] = null;
$relationParams['db'] = null;

View File

@ -710,11 +710,6 @@ parameters:
count: 1
path: libraries/classes/ConfigStorage/Relation.php
-
message: "#^Foreach overwrites \\$work with its key variable\\.$#"
count: 1
path: libraries/classes/ConfigStorage/Relation.php
-
message: "#^Method PhpMyAdmin\\\\ConfigStorage\\\\Relation\\:\\:getDisplayField\\(\\) should return string\\|false but returns mixed\\.$#"
count: 1