Merge pull request #18167 from kamil-tekiela/Better-array-types-3
Better array types in Normalization
This commit is contained in:
commit
27af8d2903
@ -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
|
||||
{
|
||||
|
||||
@ -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
|
||||
|
||||
@ -8977,12 +8977,9 @@
|
||||
<code>$dependents</code>
|
||||
<code>$dependents</code>
|
||||
<code>$dependents</code>
|
||||
<code>$distinctValCount[$column]</code>
|
||||
<code>$distinctValCount[$partialKey]</code>
|
||||
<code><![CDATA[$dropCols['nonpk']]]></code>
|
||||
<code><![CDATA[$dropCols['pk']]]></code>
|
||||
<code>$key</code>
|
||||
<code>$partialKey</code>
|
||||
<code>$table</code>
|
||||
<code>$table</code>
|
||||
<code>$table</code>
|
||||
@ -9012,17 +9009,10 @@
|
||||
<code><![CDATA[$dropCols['pk']]]></code>
|
||||
<code><![CDATA[$res[0][$column . '_cnt']]]></code>
|
||||
</MixedArrayAccess>
|
||||
<MixedArrayOffset>
|
||||
<code>$dependencyList[$partialKey]</code>
|
||||
<code>$distinctValCount[$partialKey]</code>
|
||||
<code>$result[$column]</code>
|
||||
</MixedArrayOffset>
|
||||
<MixedAssignment>
|
||||
<code>$arrDependson</code>
|
||||
<code>$col</code>
|
||||
<code>$cols</code>
|
||||
<code>$column</code>
|
||||
<code>$column</code>
|
||||
<code>$dependent</code>
|
||||
<code>$dependents</code>
|
||||
<code>$dependents</code>
|
||||
@ -9030,9 +9020,7 @@
|
||||
<code>$dropCols</code>
|
||||
<code>$element</code>
|
||||
<code>$key</code>
|
||||
<code>$partialKey</code>
|
||||
<code>$pkColCnt</code>
|
||||
<code>$result[$column]</code>
|
||||
<code>$table</code>
|
||||
<code>$table</code>
|
||||
<code>$tablesList</code>
|
||||
@ -9040,9 +9028,6 @@
|
||||
<code>$type</code>
|
||||
</MixedAssignment>
|
||||
<MixedOperand>
|
||||
<code>$column</code>
|
||||
<code>$column</code>
|
||||
<code>$column</code>
|
||||
<code>$element</code>
|
||||
</MixedOperand>
|
||||
<PossiblyNullArgument>
|
||||
@ -9053,6 +9038,9 @@
|
||||
<code><![CDATA[$def['Type']]]></code>
|
||||
<code><![CDATA[$def['Type']]]></code>
|
||||
</PossiblyUndefinedArrayOffset>
|
||||
<RedundantCast>
|
||||
<code>(string) $dependon</code>
|
||||
</RedundantCast>
|
||||
</file>
|
||||
<file src="libraries/classes/Operations.php">
|
||||
<DeprecatedMethod>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user