diff --git a/examples/openid.php b/examples/openid.php index 130c0580fb..aa01827a57 100644 --- a/examples/openid.php +++ b/examples/openid.php @@ -105,7 +105,7 @@ if ($returnTo[strlen($returnTo) - 1] != '/') { $returnTo .= 'openid.php'; /* Display form */ -if (! count($_GET) && ! count($_POST) || isset($_GET['phpMyAdmin'])) { +if ((! count($_GET) && ! count($_POST)) || isset($_GET['phpMyAdmin'])) { /* Show simple form */ $content = '
OpenID:
diff --git a/libraries/classes/Advisor.php b/libraries/classes/Advisor.php index 82e250e96e..2b2f751dec 100644 --- a/libraries/classes/Advisor.php +++ b/libraries/classes/Advisor.php @@ -385,7 +385,7 @@ class Advisor public static function splitJustification(array $rule): array { $jst = preg_split('/\s*\|\s*/', $rule['justification'], 2); - if (count($jst) > 1) { + if ($jst !== null && count($jst) > 1) { return [ $jst[0], $jst[1], @@ -691,9 +691,9 @@ class Advisor * * This function is used when evaluating advisory_rules.txt * - * @param double|string $value the value to format - * @param int $limes the sensitiveness - * @param int $comma the number of decimals to retain + * @param double|int $value the value to format + * @param int $limes the sensitiveness + * @param int $comma the number of decimals to retain * * @return string the formatted value with unit */ diff --git a/libraries/classes/Common.php b/libraries/classes/Common.php index 9faeaebc20..8e6ae0a7ab 100644 --- a/libraries/classes/Common.php +++ b/libraries/classes/Common.php @@ -119,7 +119,7 @@ final class Common [$db_charset] = explode('_', $_POST['db_collation']); $sql_query = 'ALTER DATABASE ' . Util::backquote($db) . ' DEFAULT' . Util::getCharsetQueryPart($_POST['db_collation']); - $result = $dbi->query($sql_query); + $dbi->query($sql_query); $message = Message::success(); /** diff --git a/libraries/classes/Controllers/Database/StructureController.php b/libraries/classes/Controllers/Database/StructureController.php index c37b68b2cf..84d7c00312 100644 --- a/libraries/classes/Controllers/Database/StructureController.php +++ b/libraries/classes/Controllers/Database/StructureController.php @@ -382,7 +382,6 @@ class StructureController extends AbstractController $overhead = ''; $input_class = ['checkall']; - $table_is_view = false; // Sets parameters for links $tableUrlParams = [ 'db' => $this->db, diff --git a/libraries/classes/Controllers/ExportController.php b/libraries/classes/Controllers/ExportController.php index df1f508280..966c14d1dc 100644 --- a/libraries/classes/Controllers/ExportController.php +++ b/libraries/classes/Controllers/ExportController.php @@ -72,7 +72,6 @@ final class ExportController extends AbstractController //check if it's the GET request to check export time out if (isset($_GET['check_time_out'])) { if (isset($_SESSION['pma_export_error'])) { - $err = $_SESSION['pma_export_error']; unset($_SESSION['pma_export_error']); echo 'timeout'; } else { @@ -483,7 +482,7 @@ final class ExportController extends AbstractController || isset($GLOBALS[$what . '_comments']); $do_mime = isset($GLOBALS[$what . '_mime']); if ($do_relation || $do_comments || $do_mime) { - $cfgRelation = $this->relation->getRelationsParam(); + $this->relation->getRelationsParam(); } // Include dates in export? diff --git a/libraries/classes/Controllers/ImportStatusController.php b/libraries/classes/Controllers/ImportStatusController.php index 658a770f52..546cd68a46 100644 --- a/libraries/classes/Controllers/ImportStatusController.php +++ b/libraries/classes/Controllers/ImportStatusController.php @@ -34,11 +34,11 @@ class ImportStatusController { global $SESSION_KEY, $upload_id, $plugins, $timestamp; - list( + [ $SESSION_KEY, $upload_id, - $plugins - ) = ImportAjax::uploadProgressSetup(); + $plugins, + ] = ImportAjax::uploadProgressSetup(); // $_GET["message"] is used for asking for an import message if (isset($_GET['message']) && $_GET['message']) { diff --git a/libraries/classes/Controllers/Table/StructureController.php b/libraries/classes/Controllers/Table/StructureController.php index 98fd3711b7..6aee06ed66 100644 --- a/libraries/classes/Controllers/Table/StructureController.php +++ b/libraries/classes/Controllers/Table/StructureController.php @@ -1224,7 +1224,6 @@ class StructureController extends AbstractController $this->db, $this->table ); - $columns_list = []; $titles = [ 'Change' => Generator::getIcon('b_edit', __('Change')), diff --git a/libraries/classes/Display/ChangePassword.php b/libraries/classes/Display/ChangePassword.php index 42bd05fa89..f0345ca3e9 100644 --- a/libraries/classes/Display/ChangePassword.php +++ b/libraries/classes/Display/ChangePassword.php @@ -46,11 +46,6 @@ class ChangePassword $is_privileges = isset($_REQUEST['route']) && $_REQUEST['route'] === '/server/privileges'; - $action = Url::getFromRoute('/user-password'); - if ($is_privileges) { - $action = Url::getFromRoute('/server/privileges'); - } - $template = new Template(); $html = $template->render('display/change_password/file_a', [ 'is_privileges' => $is_privileges, diff --git a/libraries/classes/Import.php b/libraries/classes/Import.php index 2abba4934c..171f128c90 100644 --- a/libraries/classes/Import.php +++ b/libraries/classes/Import.php @@ -988,6 +988,7 @@ class Import ?array $options = null, array &$sql_data ): void { + global $import_notice; /* Needed to quell the beast that is Message */ $import_notice = null; @@ -1351,7 +1352,6 @@ class Import $message .= ''; - global $import_notice; $import_notice = $message; } diff --git a/libraries/classes/Util.php b/libraries/classes/Util.php index a22d38a3c9..eb32914b81 100644 --- a/libraries/classes/Util.php +++ b/libraries/classes/Util.php @@ -409,16 +409,16 @@ class Util * * * - * @param mixed $a_name the database, table or field name to "backquote" - * or array of it - * @param bool $do_it a flag to bypass this function (used by dump - * functions) + * @param array|string $a_name the database, table or field name to "backquote" + * or array of it + * @param bool $do_it a flag to bypass this function (used by dump + * functions) * - * @return mixed the "backquoted" database, table or field name + * @return mixed the "backquoted" database, table or field name * * @access public */ - public static function backquote($a_name, $do_it = true) + public static function backquote($a_name, ?bool $do_it = true) { return static::backquoteCompat($a_name, 'NONE', $do_it); } // end of the 'backquote()' function @@ -433,12 +433,12 @@ class Util * * * - * @param mixed $a_name the database, table or field name to - * "backquote" or array of it - * @param string $compatibility string compatibility mode (used by dump - * functions) - * @param bool $do_it a flag to bypass this function (used by dump - * functions) + * @param array|string $a_name the database, table or field name to + * "backquote" or array of it + * @param string $compatibility string compatibility mode (used by dump + * functions) + * @param bool $do_it a flag to bypass this function (used by dump + * functions) * * @return mixed the "backquoted" database, table or field name * @@ -446,8 +446,8 @@ class Util */ public static function backquoteCompat( $a_name, - $compatibility = 'MSSQL', - $do_it = true + string $compatibility = 'MSSQL', + ?bool $do_it = true ) { if (is_array($a_name)) { foreach ($a_name as &$data) { diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 0663d4ac3a..6390fc2024 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -17,11 +17,6 @@ parameters: count: 1 path: libraries/classes/Advisor.php - - - message: "#^Parameter \\#1 \\$value of static method PhpMyAdmin\\\\Util\\:\\:formatByteDown\\(\\) expects float\\|int, float\\|string given\\.$#" - count: 1 - path: libraries/classes/Advisor.php - - message: "#^Parameter \\#2 \\$pieces of function implode expects array, array\\|null given\\.$#" count: 1