Minor code improvements

Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
William Desportes 2019-06-22 18:27:36 +02:00
parent d9f2428032
commit 3c74f22e89
No known key found for this signature in database
GPG Key ID: 90A0EF1B8251A889
3 changed files with 8 additions and 10 deletions

View File

@ -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
);

View File

@ -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;

View File

@ -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(