diff --git a/libraries/classes/Config/ServerConfigChecks.php b/libraries/classes/Config/ServerConfigChecks.php index 1adf128e3b..9c93792e48 100644 --- a/libraries/classes/Config/ServerConfigChecks.php +++ b/libraries/classes/Config/ServerConfigChecks.php @@ -348,14 +348,12 @@ class ServerConfigChecks * @param bool $cookieAuthUsed Cookie auth is used * @param bool $blowfishSecretSet Blowfish secret set * @param string $blowfishSecret Blowfish secret - * - * @return void */ protected function performConfigChecksCookieAuthUsed( $cookieAuthUsed, $blowfishSecretSet, $blowfishSecret - ) { + ): void { // $cfg['blowfish_secret'] // it's required for 'cookie' authentication if (! $cookieAuthUsed) { @@ -375,38 +373,42 @@ class ServerConfigChecks . 'remember it.' )) ); - } else { - $blowfishWarnings = []; - // check length - if (strlen($blowfishSecret) < 32) { - // too short key - $blowfishWarnings[] = __( - 'Key is too short, it should have at least 32 characters.' - ); - } - // check used characters - $hasDigits = (bool) preg_match('/\d/', $blowfishSecret); - $hasChars = (bool) preg_match('/\S/', $blowfishSecret); - $hasNonword = (bool) preg_match('/\W/', $blowfishSecret); - if (! $hasDigits || ! $hasChars || ! $hasNonword) { - $blowfishWarnings[] = Sanitize::sanitizeMessage( - __( - 'Key should contain letters, numbers [em]and[/em] ' - . 'special characters.' - ) - ); - } - - if (! empty($blowfishWarnings)) { - SetupIndex::messagesSet( - 'error', - 'blowfish_warnings' . count($blowfishWarnings), - Descriptions::get('blowfish_secret'), - implode('
', $blowfishWarnings) - ); - } + return; } + + $blowfishWarnings = []; + // check length + if (strlen($blowfishSecret) < 32) { + // too short key + $blowfishWarnings[] = __( + 'Key is too short, it should have at least 32 characters.' + ); + } + + // check used characters + $hasDigits = (bool) preg_match('/\d/', $blowfishSecret); + $hasChars = (bool) preg_match('/\S/', $blowfishSecret); + $hasNonword = (bool) preg_match('/\W/', $blowfishSecret); + if (! $hasDigits || ! $hasChars || ! $hasNonword) { + $blowfishWarnings[] = Sanitize::sanitizeMessage( + __( + 'Key should contain letters, numbers [em]and[/em] ' + . 'special characters.' + ) + ); + } + + if (empty($blowfishWarnings)) { + return; + } + + SetupIndex::messagesSet( + 'error', + 'blowfish_warnings' . count($blowfishWarnings), + Descriptions::get('blowfish_secret'), + implode('
', $blowfishWarnings) + ); } /** diff --git a/libraries/classes/Controllers/LicenseController.php b/libraries/classes/Controllers/LicenseController.php index 1f5c7d4f2f..05acec4a71 100644 --- a/libraries/classes/Controllers/LicenseController.php +++ b/libraries/classes/Controllers/LicenseController.php @@ -26,15 +26,17 @@ class LicenseController extends AbstractController // Check if the file is available, some distributions remove these. if (@is_readable($filename)) { readfile($filename); - } else { - printf( - __( - 'The %s file is not available on this system, please visit ' . - '%s for more information.' - ), - $filename, - 'https://www.phpmyadmin.net/' - ); + + return; } + + printf( + __( + 'The %s file is not available on this system, please visit ' . + '%s for more information.' + ), + $filename, + 'https://www.phpmyadmin.net/' + ); } } diff --git a/libraries/classes/Controllers/Preferences/NavigationController.php b/libraries/classes/Controllers/Preferences/NavigationController.php index e696f694f0..cd6a5db07e 100644 --- a/libraries/classes/Controllers/Preferences/NavigationController.php +++ b/libraries/classes/Controllers/Preferences/NavigationController.php @@ -115,8 +115,10 @@ class NavigationController extends AbstractController if ($this->response->isAjax()) { $this->response->addJSON('disableNaviSettings', true); - } else { - define('PMA_DISABLE_NAVI_SETTINGS', true); + + return; } + + define('PMA_DISABLE_NAVI_SETTINGS', true); } } diff --git a/libraries/classes/Plugins/Import/Upload/UploadProgress.php b/libraries/classes/Plugins/Import/Upload/UploadProgress.php index 7545235559..9d46d11efb 100644 --- a/libraries/classes/Plugins/Import/Upload/UploadProgress.php +++ b/libraries/classes/Plugins/Import/Upload/UploadProgress.php @@ -70,10 +70,10 @@ class UploadProgress implements UploadInterface } if ($status) { + $ret['finished'] = false; + if ($status['bytes_uploaded'] == $status['bytes_total']) { $ret['finished'] = true; - } else { - $ret['finished'] = false; } $ret['total'] = $status['bytes_total']; diff --git a/libraries/classes/Plugins/ImportPlugin.php b/libraries/classes/Plugins/ImportPlugin.php index 1d5a4d3650..2adc5b32a6 100644 --- a/libraries/classes/Plugins/ImportPlugin.php +++ b/libraries/classes/Plugins/ImportPlugin.php @@ -73,12 +73,12 @@ abstract class ImportPlugin */ protected function getDbnameAndOptions($currentDb, $defaultDb) { + $db_name = $defaultDb; + $options = null; + if (strlen((string) $currentDb) > 0) { $db_name = $currentDb; $options = ['create_db' => false]; - } else { - $db_name = $defaultDb; - $options = null; } return [ diff --git a/libraries/classes/Plugins/Schema/Dia/Dia.php b/libraries/classes/Plugins/Schema/Dia/Dia.php index 82aaf4baa4..18d1a3165e 100644 --- a/libraries/classes/Plugins/Schema/Dia/Dia.php +++ b/libraries/classes/Plugins/Schema/Dia/Dia.php @@ -78,10 +78,10 @@ class Dia extends XMLWriter $rightMargin, $orientation ) { + $isPortrait = 'false'; + if ($orientation === 'P') { $isPortrait = 'true'; - } else { - $isPortrait = 'false'; } $this->startElement('dia:diagram'); diff --git a/libraries/classes/Server/SysInfo/WindowsNt.php b/libraries/classes/Server/SysInfo/WindowsNt.php index 0d82800c8f..6a4e354667 100644 --- a/libraries/classes/Server/SysInfo/WindowsNt.php +++ b/libraries/classes/Server/SysInfo/WindowsNt.php @@ -34,11 +34,13 @@ class WindowsNt extends Base { if (! class_exists('COM')) { $this->wmi = null; - } else { - // initialize the wmi object - $objLocator = new COM('WbemScripting.SWbemLocator'); - $this->wmi = $objLocator->ConnectServer(); + + return; } + + // initialize the wmi object + $objLocator = new COM('WbemScripting.SWbemLocator'); + $this->wmi = $objLocator->ConnectServer(); } /** diff --git a/libraries/classes/Setup/ConfigGenerator.php b/libraries/classes/Setup/ConfigGenerator.php index a7b17fbc06..6c992d3ae5 100644 --- a/libraries/classes/Setup/ConfigGenerator.php +++ b/libraries/classes/Setup/ConfigGenerator.php @@ -99,18 +99,18 @@ class ConfigGenerator . var_export($var_value, true) . ';' . $crlf; } - $ret = ''; if (self::isZeroBasedArray($var_value)) { - $ret = "\$cfg['" . $var_name . "'] = " + return "\$cfg['" . $var_name . "'] = " . self::exportZeroBasedArray($var_value, $crlf) . ';' . $crlf; - } else { - // string keys: $cfg[key][subkey] = value - foreach ($var_value as $k => $v) { - $k = preg_replace('/[^A-Za-z0-9_]/', '_', $k); - $ret .= "\$cfg['" . $var_name . "']['" . $k . "'] = " - . var_export($v, true) . ';' . $crlf; - } + } + + $ret = ''; + // string keys: $cfg[key][subkey] = value + foreach ($var_value as $k => $v) { + $k = preg_replace('/[^A-Za-z0-9_]/', '_', $k); + $ret .= "\$cfg['" . $var_name . "']['" . $k . "'] = " + . var_export($v, true) . ';' . $crlf; } return $ret; @@ -152,13 +152,13 @@ class ConfigGenerator $ret = 'array('; if (count($retv) <= 4) { // up to 4 values - one line - $ret .= implode(', ', $retv); - } else { - // more than 4 values - value per line - $imax = count($retv); - for ($i = 0; $i < $imax; $i++) { - $ret .= ($i > 0 ? ',' : '') . $crlf . ' ' . $retv[$i]; - } + return $ret . implode(', ', $retv) . ')'; + } + + // more than 4 values - value per line + $imax = count($retv); + for ($i = 0; $i < $imax; $i++) { + $ret .= ($i > 0 ? ',' : '') . $crlf . ' ' . $retv[$i]; } return $ret . ')';