From 3c74f22e893348ece4bfc20efa649db58a90e767 Mon Sep 17 00:00:00 2001 From: William Desportes Date: Sat, 22 Jun 2019 18:27:36 +0200 Subject: [PATCH] Minor code improvements Signed-off-by: William Desportes --- libraries/classes/Sql.php | 8 ++++---- libraries/classes/VersionInformation.php | 7 +++---- test/classes/TrackerTest.php | 3 +-- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/libraries/classes/Sql.php b/libraries/classes/Sql.php index 93e9ed2d8e..b4d74ffa58 100644 --- a/libraries/classes/Sql.php +++ b/libraries/classes/Sql.php @@ -679,7 +679,7 @@ class Sql } $response = Response::getInstance(); - $response->setRequestStatus($retval == true); + $response->setRequestStatus($retval === true); exit; } @@ -1675,12 +1675,12 @@ class Sql */ private function getHtmlForPreviousUpdateQuery( ?string $displayQuery, - $showSql, + bool $showSql, $sqlData, $displayMessage ): string { $output = ''; - if (isset($displayQuery) && ($showSql == true) && empty($sqlData)) { + if (isset($displayQuery) && ($showSql === true) && empty($sqlData)) { $output = Util::getMessage( $displayMessage, $displayQuery, @@ -1956,7 +1956,7 @@ class Sql $previousUpdateQueryHtml = $this->getHtmlForPreviousUpdateQuery( isset($disp_query) ? $disp_query : null, - $GLOBALS['cfg']['ShowSQL'], + (bool) $GLOBALS['cfg']['ShowSQL'], isset($sql_data) ? $sql_data : null, isset($disp_message) ? $disp_message : null ); diff --git a/libraries/classes/VersionInformation.php b/libraries/classes/VersionInformation.php index 95799bb1e1..e6f42dbfad 100644 --- a/libraries/classes/VersionInformation.php +++ b/libraries/classes/VersionInformation.php @@ -9,7 +9,6 @@ declare(strict_types=1); namespace PhpMyAdmin; -use PhpMyAdmin\Util; use PhpMyAdmin\Utils\HttpRequest; use \stdClass; @@ -146,7 +145,7 @@ class VersionInformation $phpVersions = $release->php_versions; $phpConditions = explode(",", $phpVersions); foreach ($phpConditions as $phpCondition) { - if (! $this->evaluateVersionCondition("PHP", $phpCondition)) { + if (! $this->evaluateVersionCondition('PHP', $phpCondition)) { continue 2; } } @@ -181,7 +180,7 @@ class VersionInformation * * @return boolean whether the condition is met */ - public function evaluateVersionCondition($type, $condition) + public function evaluateVersionCondition(string $type, string $condition) { $operator = null; $version = null; @@ -209,7 +208,7 @@ class VersionInformation $myVersion = $this->getMySQLVersion(); } - if ($myVersion != null && $operator != null) { + if ($myVersion !== null && $operator !== null) { return version_compare($myVersion, $version, $operator); } return false; diff --git a/test/classes/TrackerTest.php b/test/classes/TrackerTest.php index 19bc8a2b3c..971250351e 100644 --- a/test/classes/TrackerTest.php +++ b/test/classes/TrackerTest.php @@ -13,7 +13,6 @@ use PhpMyAdmin\DatabaseInterface; use PhpMyAdmin\Tests\PmaTestCase; use PhpMyAdmin\Tracker; use PhpMyAdmin\Util; -use PHPUnit\Framework\Assert; use ReflectionClass; use ReflectionMethod; use ReflectionProperty; @@ -450,7 +449,7 @@ class TrackerTest extends PmaTestCase $result = null; - if ($type == null) { + if ($type === null) { $method = new ReflectionMethod('PhpMyAdmin\Tracker', '_changeTracking'); $method->setAccessible(true); $result = $method->invoke(