Some code improvements suggested by Scrutinizer
Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
parent
2a5adfe1d4
commit
01cd7dc33b
@ -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 = '<form action="openid.php" method="post">
|
||||
OpenID: <input type="text" name="identifier"><br>
|
||||
|
||||
@ -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
|
||||
*/
|
||||
|
||||
@ -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();
|
||||
|
||||
/**
|
||||
|
||||
@ -382,7 +382,6 @@ class StructureController extends AbstractController
|
||||
$overhead = '';
|
||||
$input_class = ['checkall'];
|
||||
|
||||
$table_is_view = false;
|
||||
// Sets parameters for links
|
||||
$tableUrlParams = [
|
||||
'db' => $this->db,
|
||||
|
||||
@ -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?
|
||||
|
||||
@ -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']) {
|
||||
|
||||
@ -1224,7 +1224,6 @@ class StructureController extends AbstractController
|
||||
$this->db,
|
||||
$this->table
|
||||
);
|
||||
$columns_list = [];
|
||||
|
||||
$titles = [
|
||||
'Change' => Generator::getIcon('b_edit', __('Change')),
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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 .= '</ul></ul>';
|
||||
|
||||
global $import_notice;
|
||||
$import_notice = $message;
|
||||
}
|
||||
|
||||
|
||||
@ -409,16 +409,16 @@ class Util
|
||||
*
|
||||
* </code>
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* </code>
|
||||
*
|
||||
* @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) {
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user