diff --git a/libraries/classes/Normalization.php b/libraries/classes/Normalization.php index 287f83933d..5586176a72 100644 --- a/libraries/classes/Normalization.php +++ b/libraries/classes/Normalization.php @@ -1027,18 +1027,18 @@ class Normalization /** * function to get distinct values count of all the column in the array $columns * - * @param array $columns array of backquoted columns whose distinct values - * need to be counted. - * @param string $table table to which these columns belong + * @param string[] $columns array of backquoted columns whose distinct values + * need to be counted. + * @param string $table table to which these columns belong * - * @return array associative array containing the count + * @return int[] associative array containing the count */ private function findDistinctValuesCount(array $columns, $table): array { $result = []; $query = 'SELECT '; foreach ($columns as $column) { - if (! $column) { + if ($column === '') { continue; } @@ -1052,11 +1052,11 @@ class Normalization . ' LIMIT 500) as dt;'; $res = $this->dbi->fetchResult($query, null, null); foreach ($columns as $column) { - if (! $column) { + if ($column === '') { continue; } - $result[$column] = $res[0][$column . '_cnt'] ?? null; + $result[$column] = (int) $res[0][$column . '_cnt']; } return $result; @@ -1067,7 +1067,7 @@ class Normalization * * @param array $primaryKey array containing all the column present in primary key * - * @return array containing all the possible partial keys(subset of primary key) + * @return string[] containing all the possible partial keys(subset of primary key) */ private function getAllCombinationPartialKeys(array $primaryKey): array { diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 0308de8ea9..237cad3c87 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -5730,6 +5730,11 @@ parameters: count: 1 path: libraries/classes/Navigation/Nodes/NodeTable.php + - + message: "#^Casting to string something that's already string\\.$#" + count: 1 + path: libraries/classes/Normalization.php + - message: "#^Method PhpMyAdmin\\\\Normalization\\:\\:createNewTablesFor2NF\\(\\) has parameter \\$partialDependencies with no value type specified in iterable type array\\.$#" count: 1 @@ -5755,26 +5760,11 @@ parameters: count: 1 path: libraries/classes/Normalization.php - - - message: "#^Method PhpMyAdmin\\\\Normalization\\:\\:findDistinctValuesCount\\(\\) has parameter \\$columns with no value type specified in iterable type array\\.$#" - count: 1 - path: libraries/classes/Normalization.php - - - - message: "#^Method PhpMyAdmin\\\\Normalization\\:\\:findDistinctValuesCount\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: libraries/classes/Normalization.php - - message: "#^Method PhpMyAdmin\\\\Normalization\\:\\:getAllCombinationPartialKeys\\(\\) has parameter \\$primaryKey with no value type specified in iterable type array\\.$#" count: 1 path: libraries/classes/Normalization.php - - - message: "#^Method PhpMyAdmin\\\\Normalization\\:\\:getAllCombinationPartialKeys\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: libraries/classes/Normalization.php - - message: "#^Method PhpMyAdmin\\\\Normalization\\:\\:getHtmlFor3NFstep1\\(\\) has parameter \\$tables with no value type specified in iterable type array\\.$#" count: 1 diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 157e6309f8..5fbbd3ec69 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -8977,12 +8977,9 @@ $dependents $dependents $dependents - $distinctValCount[$column] - $distinctValCount[$partialKey] $key - $partialKey $table $table $table @@ -9012,17 +9009,10 @@ - - $dependencyList[$partialKey] - $distinctValCount[$partialKey] - $result[$column] - $arrDependson $col $cols - $column - $column $dependent $dependents $dependents @@ -9030,9 +9020,7 @@ $dropCols $element $key - $partialKey $pkColCnt - $result[$column] $table $table $tablesList @@ -9040,9 +9028,6 @@ $type - $column - $column - $column $element @@ -9053,6 +9038,9 @@ + + (string) $dependon +