Merge pull request #17880 from kamil-tekiela/Refactor-isEngine()

Refactor isEngine() method
This commit is contained in:
Maurício Meneghini Fauth 2022-11-07 20:31:05 -03:00 committed by GitHub
commit 3c90ff3c1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 23 deletions

View File

@ -205,24 +205,15 @@ class Table implements Stringable
/**
* Checks the storage engine used to create table
*
* @param array|string $engine Checks the table engine against an
* @param string[]|string $engine Checks the table engine against an
* array of engine strings or a single string, should be uppercase
*/
public function isEngine($engine): bool
{
$engine = (array) $engine;
$tableStorageEngine = $this->getStorageEngine();
if (is_array($engine)) {
foreach ($engine as $e) {
if ($e == $tableStorageEngine) {
return true;
}
}
return false;
}
return $tableStorageEngine == $engine;
return in_array($tableStorageEngine, $engine, true);
}
/**
@ -362,9 +353,6 @@ class Table implements Stringable
public function getStorageEngine(): string
{
$tableStorageEngine = $this->getStatusInfo('ENGINE', false, true);
if ($tableStorageEngine === false) {
return '';
}
return strtoupper((string) $tableStorageEngine);
}
@ -2152,7 +2140,7 @@ class Table implements Stringable
$index->getChoice() !== 'SPATIAL'
&& $index->getChoice() !== 'FULLTEXT'
&& in_array($type, Index::getIndexTypes())
&& ! $this->isEngine(['TOKUDB'])
&& ! $this->isEngine('TOKUDB')
) {
$sqlQuery .= ' USING ' . $type;
}

View File

@ -8080,11 +8080,6 @@ parameters:
count: 1
path: libraries/classes/Table.php
-
message: "#^Method PhpMyAdmin\\\\Table\\:\\:isEngine\\(\\) has parameter \\$engine with no value type specified in iterable type array\\.$#"
count: 1
path: libraries/classes/Table.php
-
message: "#^Method PhpMyAdmin\\\\Table\\:\\:updateForeignKeys\\(\\) has parameter \\$destinationForeignColumn with no value type specified in iterable type array\\.$#"
count: 1

View File

@ -13640,7 +13640,7 @@
<code>$optionsArray[$existrelForeign[$masterFieldMd5]['on_delete'] ?? '']</code>
<code>$optionsArray[$existrelForeign[$masterFieldMd5]['on_update'] ?? '']</code>
</MixedArrayTypeCoercion>
<MixedAssignment occurrences="48">
<MixedAssignment occurrences="47">
<code>$GLOBALS['errorUrl']</code>
<code>$cachedResult</code>
<code>$cachedResult</code>
@ -13651,7 +13651,6 @@
<code>$constraintName</code>
<code>$createTable</code>
<code>$currCreateTime</code>
<code>$e</code>
<code>$eachCol</code>
<code>$foreignDb</code>
<code>$foreignDb</code>