Refactor getPartitionMethod()

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
This commit is contained in:
Kamil Tekiela 2024-12-19 02:47:10 +00:00
parent b687a6f62b
commit e41782c403
3 changed files with 3 additions and 15 deletions

View File

@ -11118,12 +11118,6 @@ parameters:
count: 2
path: src/Partitioning/Partition.php
-
message: '#^Method PhpMyAdmin\\Partitioning\\Partition\:\:getPartitionMethod\(\) should return string\|null but returns mixed\.$#'
identifier: return.type
count: 1
path: src/Partitioning/Partition.php
-
message: '#^Only booleans are allowed in an if condition, string\|false\|null given\.$#'
identifier: if.condNotBoolean

View File

@ -6497,12 +6497,6 @@
<code><![CDATA[$this->name]]></code>
<code><![CDATA[$value]]></code>
</MixedAssignment>
<MixedInferredReturnType>
<code><![CDATA[string|null]]></code>
</MixedInferredReturnType>
<MixedReturnStatement>
<code><![CDATA[$partitionMethod[0]]]></code>
</MixedReturnStatement>
<PossiblyInvalidArgument>
<code><![CDATA[$row]]></code>
</PossiblyInvalidArgument>

View File

@ -207,14 +207,14 @@ class Partition extends SubPartition
{
if (self::havePartitioning()) {
$dbi = DatabaseInterface::getInstance();
$partitionMethod = $dbi->fetchResultSimple(
$partitionMethod = $dbi->fetchValue(
'SELECT `PARTITION_METHOD` FROM `information_schema`.`PARTITIONS`'
. ' WHERE `TABLE_SCHEMA` = ' . $dbi->quoteString($db)
. ' AND `TABLE_NAME` = ' . $dbi->quoteString($table)
. ' LIMIT 1',
);
if ($partitionMethod !== []) {
return $partitionMethod[0];
if ($partitionMethod !== false) {
return $partitionMethod;
}
}