diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index ad1905a510..5aee2e78d6 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -14635,11 +14635,6 @@ parameters: count: 1 path: src/StorageEngine.php - - - message: "#^Cannot access offset 'Support' on mixed\\.$#" - count: 1 - path: src/StorageEngine.php - - message: "#^Cannot access offset 'desc' on mixed\\.$#" count: 1 @@ -14677,7 +14672,7 @@ parameters: - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" - count: 3 + count: 2 path: src/StorageEngine.php - @@ -14691,7 +14686,7 @@ parameters: path: src/StorageEngine.php - - message: "#^Method PhpMyAdmin\\\\StorageEngine\\:\\:getStorageEngines\\(\\) should return array\\ but returns mixed\\.$#" + message: "#^Method PhpMyAdmin\\\\StorageEngine\\:\\:getStorageEngines\\(\\) should return array\\ but returns mixed\\.$#" count: 1 path: src/StorageEngine.php @@ -14725,16 +14720,6 @@ parameters: count: 1 path: src/StorageEngine.php - - - message: "#^Property PhpMyAdmin\\\\StorageEngine\\:\\:\\$comment \\(string\\) does not accept mixed\\.$#" - count: 1 - path: src/StorageEngine.php - - - - message: "#^Property PhpMyAdmin\\\\StorageEngine\\:\\:\\$title \\(string\\) does not accept mixed\\.$#" - count: 1 - path: src/StorageEngine.php - - message: "#^Variable method call on \\$this\\(PhpMyAdmin\\\\StorageEngine\\)\\.$#" count: 1 diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 8c5be852f4..40d87cea74 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -11128,11 +11128,7 @@ - - - - $dataLength $decodedData @@ -11140,11 +11136,9 @@ $indexLength $mroongaData - comment]]> - title]]> - mixed[][] + ]]> string diff --git a/src/StorageEngine.php b/src/StorageEngine.php index bafa85bf12..37b3345034 100644 --- a/src/StorageEngine.php +++ b/src/StorageEngine.php @@ -67,13 +67,13 @@ class StorageEngine public function __construct(string $engine) { $storageEngines = self::getStorageEngines(); - if (empty($storageEngines[$engine])) { + if (! array_key_exists($engine, $storageEngines)) { return; } $this->engine = $engine; $this->title = $storageEngines[$engine]['Engine']; - $this->comment = $storageEngines[$engine]['Comment'] ?? ''; + $this->comment = $storageEngines[$engine]['Comment']; $this->support = match ($storageEngines[$engine]['Support']) { 'DEFAULT' => self::SUPPORT_DEFAULT, 'YES' => self::SUPPORT_YES, @@ -85,7 +85,7 @@ class StorageEngine /** * Returns array of storage engines * - * @return mixed[][] array of storage engines + * @return array * * @staticvar array $storage_engines storage engines */ @@ -95,6 +95,7 @@ class StorageEngine if ($storageEngines == null) { $dbi = DatabaseInterface::getInstance(); + /** @var array $storageEngines */ $storageEngines = $dbi->fetchResult('SHOW STORAGE ENGINES', 'Engine'); if (! $dbi->isMariaDB() && $dbi->getVersion() >= 50708) { $disabled = (string) SessionCache::get( @@ -269,9 +270,7 @@ class StorageEngine return true; } - $storageEngines = self::getStorageEngines(); - - return isset($storageEngines[$engine]); + return array_key_exists($engine, self::getStorageEngines()); } /**