diff --git a/libraries/classes/ConfigStorage/Relation.php b/libraries/classes/ConfigStorage/Relation.php index fe5b50b5f7..f5b25a8114 100644 --- a/libraries/classes/ConfigStorage/Relation.php +++ b/libraries/classes/ConfigStorage/Relation.php @@ -444,7 +444,7 @@ class Relation if (($source === 'both' || $source === 'foreign') && strlen($table) > 0) { $tableObj = new Table($table, $db); $show_create_table = $tableObj->showCreate(); - if ($show_create_table) { + if ($show_create_table !== '') { $parser = new Parser($show_create_table); $stmt = $parser->statements[0]; $foreign['foreign_keys_data'] = []; diff --git a/libraries/classes/Controllers/Table/Structure/PartitioningController.php b/libraries/classes/Controllers/Table/Structure/PartitioningController.php index 1c945e6d73..7f42cdcc1f 100644 --- a/libraries/classes/Controllers/Table/Structure/PartitioningController.php +++ b/libraries/classes/Controllers/Table/Structure/PartitioningController.php @@ -93,7 +93,7 @@ final class PartitioningController extends AbstractController private function extractPartitionDetails(): ?array { $createTable = (new Table($this->table, $this->db))->showCreate(); - if (! $createTable) { + if ($createTable === '') { return null; } diff --git a/libraries/classes/Table.php b/libraries/classes/Table.php index 288b03f3bb..c0f80d886f 100644 --- a/libraries/classes/Table.php +++ b/libraries/classes/Table.php @@ -2584,7 +2584,7 @@ class Table implements Stringable } $createTable = $this->showCreate(); - if (! $createTable) { + if ($createTable === '') { return false; } @@ -2616,12 +2616,10 @@ class Table implements Stringable /** * Returns the CREATE statement for this table - * - * @return mixed */ - public function showCreate() + public function showCreate(): string { - return $this->dbi->fetchValue( + return (string) $this->dbi->fetchValue( 'SHOW CREATE TABLE ' . Util::backquote($this->dbName) . '.' . Util::backquote($this->name), 1 diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index e843da7551..5cb37a835a 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -955,11 +955,6 @@ parameters: count: 1 path: libraries/classes/ConfigStorage/Relation.php - - - message: "#^Parameter \\#1 \\$list of class PhpMyAdmin\\\\SqlParser\\\\Parser constructor expects PhpMyAdmin\\\\SqlParser\\\\TokensList\\|PhpMyAdmin\\\\SqlParser\\\\UtfString\\|string\\|null, mixed given\\.$#" - count: 1 - path: libraries/classes/ConfigStorage/Relation.php - - message: "#^Parameter \\#2 \\$callback of function usort expects callable\\(string\\|null, string\\|null\\)\\: int, 'strnatcasecmp' given\\.$#" count: 1 @@ -1080,11 +1075,6 @@ parameters: count: 1 path: libraries/classes/Controllers/Database/Structure/FavoriteTableController.php - - - message: "#^Parameter \\#1 \\$buffer of static method PhpMyAdmin\\\\Core\\:\\:mimeDefaultFunction\\(\\) expects string, mixed given\\.$#" - count: 1 - path: libraries/classes/Controllers/Database/Structure/ShowCreateController.php - - message: "#^Cannot use array destructuring on array\\|null\\.$#" count: 4 @@ -1630,11 +1620,6 @@ parameters: count: 1 path: libraries/classes/Controllers/Table/Structure/PartitioningController.php - - - message: "#^Parameter \\#1 \\$list of class PhpMyAdmin\\\\SqlParser\\\\Parser constructor expects PhpMyAdmin\\\\SqlParser\\\\TokensList\\|PhpMyAdmin\\\\SqlParser\\\\UtfString\\|string\\|null, mixed given\\.$#" - count: 1 - path: libraries/classes/Controllers/Table/Structure/PartitioningController.php - - message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, array\\\\|null given\\.$#" count: 1 @@ -1800,11 +1785,6 @@ parameters: count: 2 path: libraries/classes/Controllers/Transformation/WrapperController.php - - - message: "#^Parameter \\#1 \\$string of function substr expects string, mixed given\\.$#" - count: 1 - path: libraries/classes/Controllers/View/CreateController.php - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Statements\\\\CreateStatement\\:\\:\\$body \\(array\\\\|string\\) in isset\\(\\) is not nullable\\.$#" count: 1 @@ -8405,11 +8385,6 @@ parameters: count: 1 path: libraries/classes/Table.php - - - message: "#^Parameter \\#1 \\$list of class PhpMyAdmin\\\\SqlParser\\\\Parser constructor expects PhpMyAdmin\\\\SqlParser\\\\TokensList\\|PhpMyAdmin\\\\SqlParser\\\\UtfString\\|string\\|null, mixed given\\.$#" - count: 1 - path: libraries/classes/Table.php - - message: "#^Parameter \\#1 \\$string of function substr expects string, mixed given\\.$#" count: 2 diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 73619ec61a..f6385eb8b4 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -848,7 +848,7 @@ - + $_SESSION['sql_history'] $_SESSION['sql_history'] $_SESSION['sql_history'] @@ -865,7 +865,6 @@ $foreign_table $foreign_table $one_key['index_list'] - $show_create_table $tableNameReplacements[$tableName] @@ -896,7 +895,7 @@ $foreign[$key] $one_key['ref_index_list'][$column_index] - + $child_references $column $columns @@ -918,7 +917,6 @@ $key $one_key $relations - $show_create_table $the_total $value $value @@ -1756,9 +1754,6 @@ $selected - - $object->showCreate() - @@ -3863,12 +3858,6 @@ - - $createTable - - - $createTable - $stmt->partitions $stmt->partitions[0]->subpartitions @@ -4354,8 +4343,7 @@ $view['as'] - - $createView + $db $db @@ -4368,8 +4356,7 @@ $urlParams['goto'] $urlParams['reload'] - - $createView + $urlParams['db'] $view['as'] $view['as'] @@ -13491,7 +13478,7 @@ $tableAutoIncrement ?? '' - + $GLOBALS['sql_auto_increments'] $GLOBALS['sql_indexes'] $_POST['constraint_name'][$masterFieldMd5] @@ -13502,7 +13489,6 @@ $column['Extra'] $column['Extra'] $column['Extra'] - $createTable $eachCol $eachCol $errorUrl @@ -13611,7 +13597,7 @@ $optionsArray[$existrelForeign[$masterFieldMd5]['on_delete'] ?? ''] $optionsArray[$existrelForeign[$masterFieldMd5]['on_update'] ?? ''] - + $altered $altered $cachedResult @@ -13621,7 +13607,6 @@ $column $columns[$row['Field']] $constraintName - $createTable $currCreateTime $e $eachCol