$options[1]
diff --git a/src/BrowseForeigners.php b/src/BrowseForeigners.php
index f74d960f4f..d078664404 100644
--- a/src/BrowseForeigners.php
+++ b/src/BrowseForeigners.php
@@ -166,9 +166,9 @@ class BrowseForeigners
. htmlspecialchars((string) $_POST['rownumber']) . '">';
}
- $filterValue = (isset($_POST['foreign_filter'])
+ $filterValue = isset($_POST['foreign_filter'])
? htmlspecialchars($_POST['foreign_filter'])
- : '');
+ : '';
$output .= ''
. '
' . "\n"
. 'getSource());
- if ($perms === false || (! ($perms & 2))) {
+ if ($perms === false || ! ($perms & 2)) {
return;
}
@@ -866,11 +866,11 @@ class Config
* sets cookie if value is different from current cookie value,
* or removes if value is equal to default
*
- * @param string $cookie name of cookie to remove
- * @param string $value new cookie value
- * @param string $default default value
- * @param int $validity validity of cookie in seconds (default is one month)
- * @param bool $httponly whether cookie is only for HTTP (and not for scripts)
+ * @param string $cookie name of cookie to remove
+ * @param string $value new cookie value
+ * @param string|null $default default value
+ * @param int|null $validity validity of cookie in seconds (default is one month)
+ * @param bool $httponly whether cookie is only for HTTP (and not for scripts)
*/
public function setCookie(
string $cookie,
@@ -906,7 +906,7 @@ class Config
/* Valid for session */
$validity = 0;
} else {
- $validity = time() + $validity;
+ $validity += time();
}
if (defined('TESTSUITE')) {
diff --git a/src/Config/ConfigFile.php b/src/Config/ConfigFile.php
index a6cdd1c795..482df5a1a7 100644
--- a/src/Config/ConfigFile.php
+++ b/src/Config/ConfigFile.php
@@ -191,11 +191,9 @@ class ConfigFile
}
$defaultValue = $this->getDefault($canonicalPath);
- $removePath = $value === $defaultValue;
if ($this->isInSetup) {
// remove if it has a default value or is empty
- $removePath = $removePath
- || (empty($value) && empty($defaultValue));
+ $removePath = $value === $defaultValue || empty($value) && empty($defaultValue);
} else {
// get original config values not overwritten by user
// preferences to allow for overwriting options set in
@@ -203,8 +201,7 @@ class ConfigFile
$instanceDefaultValue = Core::arrayRead($canonicalPath, $this->baseConfig);
// remove if it has a default value and base config (config.inc.php)
// uses default value
- $removePath = $removePath
- && ($instanceDefaultValue === $defaultValue);
+ $removePath = $value === $defaultValue && $instanceDefaultValue === $defaultValue;
}
if ($removePath) {
diff --git a/src/Config/ServerConfigChecks.php b/src/Config/ServerConfigChecks.php
index e4a9057b3c..23ce39c98f 100644
--- a/src/Config/ServerConfigChecks.php
+++ b/src/Config/ServerConfigChecks.php
@@ -117,7 +117,7 @@ class ServerConfigChecks
$isCookieAuthUsed = 0;
/** @infection-ignore-all */
for ($i = 1; $i <= $serverCnt; $i++) {
- $cookieAuthServer = ($this->cfg->getValue('Servers/' . $i . '/auth_type') === 'cookie');
+ $cookieAuthServer = $this->cfg->getValue('Servers/' . $i . '/auth_type') === 'cookie';
$isCookieAuthUsed |= (int) $cookieAuthServer;
$serverName = $this->performConfigChecksServersGetServerName(
$this->cfg->getServerName($i),
@@ -125,7 +125,7 @@ class ServerConfigChecks
);
$serverName = htmlspecialchars($serverName);
- if ($cookieAuthServer && (mb_strlen($blowfishSecret, '8bit') !== SODIUM_CRYPTO_SECRETBOX_KEYBYTES)) {
+ if ($cookieAuthServer && mb_strlen($blowfishSecret, '8bit') !== SODIUM_CRYPTO_SECRETBOX_KEYBYTES) {
$blowfishSecretSet = true;
$this->cfg->set('blowfish_secret', sodium_crypto_secretbox_keygen());
}
@@ -351,8 +351,8 @@ class ServerConfigChecks
// $cfg['LoginCookieStore']
// LoginCookieValidity must be less or equal to LoginCookieStore
if (
- ($this->cfg->getValue('LoginCookieStore') == 0)
- || ($loginCookieValidity <= $this->cfg->getValue('LoginCookieStore'))
+ $this->cfg->getValue('LoginCookieStore') == 0
+ || $loginCookieValidity <= $this->cfg->getValue('LoginCookieStore')
) {
return;
}
diff --git a/src/Config/Settings/Server.php b/src/Config/Settings/Server.php
index e7a1bd7f37..88b9518d9e 100644
--- a/src/Config/Settings/Server.php
+++ b/src/Config/Settings/Server.php
@@ -1043,7 +1043,7 @@ final class Server
];
}
- public function withSSL(bool $ssl): static
+ public function withSSL(bool $ssl): self
{
$clone = clone $this;
$clone->ssl = $ssl;
diff --git a/src/ConfigStorage/Relation.php b/src/ConfigStorage/Relation.php
index b144bf414a..307eb5f836 100644
--- a/src/ConfigStorage/Relation.php
+++ b/src/ConfigStorage/Relation.php
@@ -768,15 +768,15 @@ class Relation
$value = (string) $value;
if (mb_check_encoding($key, 'utf-8') && ! preg_match('/[\x00-\x08\x0B\x0C\x0E-\x1F\x80-\x9F]/u', $key)) {
- $selected = ($key === $data);
+ $selected = $key === $data;
// show as text if it's valid utf-8
$key = htmlspecialchars($key);
} else {
$key = '0x' . bin2hex($key);
if (str_contains($data, '0x')) {
- $selected = ($key === trim($data));
+ $selected = $key === trim($data);
} else {
- $selected = ($key === '0x' . $data);
+ $selected = $key === '0x' . $data;
}
}
diff --git a/src/ConfigStorage/UserGroups.php b/src/ConfigStorage/UserGroups.php
index d171954ae1..5fe716881f 100644
--- a/src/ConfigStorage/UserGroups.php
+++ b/src/ConfigStorage/UserGroups.php
@@ -268,7 +268,7 @@ class UserGroups
$tabDetails = [];
foreach ($tabs as $tab => $tabName) {
$tabDetail = [];
- $tabDetail['in_array'] = (in_array($tab, $selected) ? ' checked="checked"' : '');
+ $tabDetail['in_array'] = in_array($tab, $selected) ? ' checked="checked"' : '';
$tabDetail['tab'] = $tab;
$tabDetail['tab_name'] = $tabName;
$tabDetails[] = $tabDetail;
diff --git a/src/Controllers/Database/ImportController.php b/src/Controllers/Database/ImportController.php
index 1d7416cc5b..b29b2eb358 100644
--- a/src/Controllers/Database/ImportController.php
+++ b/src/Controllers/Database/ImportController.php
@@ -135,7 +135,7 @@ final class ImportController extends AbstractController
'can_convert_kanji' => Encoding::canConvertKanji(),
'charsets' => $charsets,
'is_foreign_key_check' => ForeignKey::isCheckEnabled(),
- 'user_upload_dir' => Util::userDir(($config->settings['UploadDir'] ?? '')),
+ 'user_upload_dir' => Util::userDir($config->settings['UploadDir'] ?? ''),
'local_files' => Import::getLocalFiles($importList),
]);
}
diff --git a/src/Controllers/Database/StructureController.php b/src/Controllers/Database/StructureController.php
index fbb10c2dba..614efba0e0 100644
--- a/src/Controllers/Database/StructureController.php
+++ b/src/Controllers/Database/StructureController.php
@@ -839,7 +839,7 @@ final class StructureController extends AbstractController
$tblsize = $currentTable['Data_length']
+ $currentTable['Index_length'];
$sumSize += $tblsize;
- [$formattedSize, $unit] = Util::formatByteDown($tblsize, 3, ($tblsize > 0 ? 1 : 0));
+ [$formattedSize, $unit] = Util::formatByteDown($tblsize, 3, $tblsize > 0 ? 1 : 0);
}
return [$currentTable, $formattedSize, $unit, $sumSize];
@@ -864,7 +864,7 @@ final class StructureController extends AbstractController
/** @var int $tblsize */
$tblsize = $currentTable['Data_length'] + $currentTable['Index_length'];
$sumSize += $tblsize;
- [$formattedSize, $unit] = Util::formatByteDown($tblsize, 3, ($tblsize > 0 ? 1 : 0));
+ [$formattedSize, $unit] = Util::formatByteDown($tblsize, 3, $tblsize > 0 ? 1 : 0);
}
return [$currentTable, $formattedSize, $unit, $sumSize];
diff --git a/src/Controllers/Export/ExportController.php b/src/Controllers/Export/ExportController.php
index 0a363a59e1..c7dea8ce7f 100644
--- a/src/Controllers/Export/ExportController.php
+++ b/src/Controllers/Export/ExportController.php
@@ -200,7 +200,7 @@ final class ExportController extends AbstractController
// preference over SQL Query aliases.
$parser = new Parser($GLOBALS['sql_query']);
$aliases = [];
- if (! empty($parser->statements[0]) && ($parser->statements[0] instanceof SelectStatement)) {
+ if (! empty($parser->statements[0]) && $parser->statements[0] instanceof SelectStatement) {
$aliases = $parser->statements[0]->getAliases(Current::$database);
}
diff --git a/src/Controllers/Import/ImportController.php b/src/Controllers/Import/ImportController.php
index a981ccbed5..0f7b464f71 100644
--- a/src/Controllers/Import/ImportController.php
+++ b/src/Controllers/Import/ImportController.php
@@ -481,7 +481,7 @@ final class ImportController extends AbstractController
return;
}
- } elseif (! $GLOBALS['error'] && (empty($GLOBALS['import_text']))) {
+ } elseif (! $GLOBALS['error'] && empty($GLOBALS['import_text'])) {
$GLOBALS['message'] = Message::error(
__(
'No data was received to import. Either no file name was ' .
diff --git a/src/Controllers/Operations/TableController.php b/src/Controllers/Operations/TableController.php
index ec0b813738..8640ab38b9 100644
--- a/src/Controllers/Operations/TableController.php
+++ b/src/Controllers/Operations/TableController.php
@@ -241,13 +241,12 @@ class TableController extends AbstractController
$tableAlters = $this->operations->getTableAltersArray(
$pmaTable,
$createOptions['pack_keys'],
- (empty($createOptions['checksum']) ? '0' : '1'),
- ($createOptions['page_checksum'] ?? ''),
- (empty($createOptions['delay_key_write']) ? '0' : '1'),
+ empty($createOptions['checksum']) ? '0' : '1',
+ $createOptions['page_checksum'] ?? '',
+ empty($createOptions['delay_key_write']) ? '0' : '1',
$createOptions['row_format'] ?? $pmaTable->getRowFormat(),
$newTblStorageEngine,
- (isset($createOptions['transactional'])
- && $createOptions['transactional'] == '0' ? '0' : '1'),
+ isset($createOptions['transactional']) && $createOptions['transactional'] == '0' ? '0' : '1',
$tableCollation,
$tableStorageEngine,
);
diff --git a/src/Controllers/Server/ImportController.php b/src/Controllers/Server/ImportController.php
index e7bb29c2b6..aa2445f6d1 100644
--- a/src/Controllers/Server/ImportController.php
+++ b/src/Controllers/Server/ImportController.php
@@ -116,7 +116,7 @@ final class ImportController extends AbstractController
'can_convert_kanji' => Encoding::canConvertKanji(),
'charsets' => $charsets,
'is_foreign_key_check' => ForeignKey::isCheckEnabled(),
- 'user_upload_dir' => Util::userDir(($config->settings['UploadDir'] ?? '')),
+ 'user_upload_dir' => Util::userDir($config->settings['UploadDir'] ?? ''),
'local_files' => Import::getLocalFiles($importList),
]);
}
diff --git a/src/Controllers/Server/PrivilegesController.php b/src/Controllers/Server/PrivilegesController.php
index e928277ca0..67a81ffdea 100644
--- a/src/Controllers/Server/PrivilegesController.php
+++ b/src/Controllers/Server/PrivilegesController.php
@@ -194,10 +194,10 @@ class PrivilegesController extends AbstractController
if (is_array($GLOBALS['dbname'])) {
foreach ($GLOBALS['dbname'] as $key => $dbName) {
[$GLOBALS['sql_query'][$key], $GLOBALS['message']] = $serverPrivileges->updatePrivileges(
- ($GLOBALS['username'] ?? ''),
- ($GLOBALS['hostname'] ?? ''),
- ($tablename ?? ($routinename ?? '')),
- ($dbName ?? ''),
+ $GLOBALS['username'] ?? '',
+ $GLOBALS['hostname'] ?? '',
+ $tablename ?? $routinename ?? '',
+ $dbName ?? '',
$itemType,
);
}
@@ -205,10 +205,10 @@ class PrivilegesController extends AbstractController
$GLOBALS['sql_query'] = implode("\n", $GLOBALS['sql_query']);
} else {
[$GLOBALS['sql_query'], $GLOBALS['message']] = $serverPrivileges->updatePrivileges(
- ($GLOBALS['username'] ?? ''),
- ($GLOBALS['hostname'] ?? ''),
- ($tablename ?? ($routinename ?? '')),
- ($GLOBALS['dbname'] ?? ''),
+ $GLOBALS['username'] ?? '',
+ $GLOBALS['hostname'] ?? '',
+ $tablename ?? $routinename ?? '',
+ $GLOBALS['dbname'] ?? '',
$itemType,
);
}
@@ -230,8 +230,8 @@ class PrivilegesController extends AbstractController
*/
if ($request->hasBodyParam('revokeall')) {
[$GLOBALS['message'], $GLOBALS['sql_query']] = $serverPrivileges->getMessageAndSqlQueryForPrivilegesRevoke(
- (is_string($GLOBALS['dbname']) ? $GLOBALS['dbname'] : ''),
- ($tablename ?? ($routinename ?? '')),
+ is_string($GLOBALS['dbname']) ? $GLOBALS['dbname'] : '',
+ $tablename ?? $routinename ?? '',
$GLOBALS['username'] ?? '',
$GLOBALS['hostname'] ?? '',
$itemType,
@@ -295,10 +295,10 @@ class PrivilegesController extends AbstractController
&& ! $request->hasQueryParam('showall')
) {
$extraData = $serverPrivileges->getExtraDataForAjaxBehavior(
- ($password ?? ''),
- ($GLOBALS['sql_query'] ?? ''),
- ($GLOBALS['hostname'] ?? ''),
- ($GLOBALS['username'] ?? ''),
+ $password ?? '',
+ $GLOBALS['sql_query'] ?? '',
+ $GLOBALS['hostname'] ?? '',
+ $GLOBALS['username'] ?? '',
);
if (! empty($GLOBALS['message']) && $GLOBALS['message'] instanceof Message) {
diff --git a/src/Controllers/Setup/ValidateController.php b/src/Controllers/Setup/ValidateController.php
index a4fa7933a7..b8827fc652 100644
--- a/src/Controllers/Setup/ValidateController.php
+++ b/src/Controllers/Setup/ValidateController.php
@@ -39,7 +39,7 @@ final class ValidateController
/** @var mixed $valuesParam */
$valuesParam = $request->getParsedBodyParam('values');
$values = json_decode(is_string($valuesParam) ? $valuesParam : '');
- if (! ($values instanceof stdClass)) {
+ if (! $values instanceof stdClass) {
return $response->write((string) json_encode(['success' => false, 'message' => __('Wrong data')]));
}
diff --git a/src/Controllers/Table/ExportController.php b/src/Controllers/Table/ExportController.php
index e5721411dd..cc11332f7f 100644
--- a/src/Controllers/Table/ExportController.php
+++ b/src/Controllers/Table/ExportController.php
@@ -69,7 +69,7 @@ class ExportController extends AbstractController
if (! empty($GLOBALS['sql_query'])) {
$parser = new Parser($GLOBALS['sql_query']);
- if (! empty($parser->statements[0]) && ($parser->statements[0] instanceof SelectStatement)) {
+ if (! empty($parser->statements[0]) && $parser->statements[0] instanceof SelectStatement) {
// Checking if the WHERE clause has to be replaced.
$replaces = [];
if (! empty($GLOBALS['where_clause']) && is_array($GLOBALS['where_clause'])) {
diff --git a/src/Controllers/Table/ImportController.php b/src/Controllers/Table/ImportController.php
index 1b6785974a..94a279c64f 100644
--- a/src/Controllers/Table/ImportController.php
+++ b/src/Controllers/Table/ImportController.php
@@ -160,7 +160,7 @@ final class ImportController extends AbstractController
'can_convert_kanji' => Encoding::canConvertKanji(),
'charsets' => $charsets,
'is_foreign_key_check' => ForeignKey::isCheckEnabled(),
- 'user_upload_dir' => Util::userDir(($config->settings['UploadDir'] ?? '')),
+ 'user_upload_dir' => Util::userDir($config->settings['UploadDir'] ?? ''),
'local_files' => Import::getLocalFiles($importList),
]);
}
diff --git a/src/Controllers/Table/RelationController.php b/src/Controllers/Table/RelationController.php
index 4286abb0a1..3931b840bc 100644
--- a/src/Controllers/Table/RelationController.php
+++ b/src/Controllers/Table/RelationController.php
@@ -106,8 +106,11 @@ final class RelationController extends AbstractController
// (for now, one index name only; we keep the definitions if the
// foreign db is not the same)
if (
- isset($_POST['destination_foreign_db'], $_POST['destination_foreign_table'])
- && isset($_POST['destination_foreign_column'])
+ isset(
+ $_POST['destination_foreign_db'],
+ $_POST['destination_foreign_table'],
+ $_POST['destination_foreign_column'],
+ )
) {
[$html, $previewSqlData, $displayQuery, $seenError] = $table->updateForeignKeys(
$_POST['destination_foreign_db'],
diff --git a/src/Controllers/Table/ReplaceController.php b/src/Controllers/Table/ReplaceController.php
index 813b749ea4..eb6a746c86 100644
--- a/src/Controllers/Table/ReplaceController.php
+++ b/src/Controllers/Table/ReplaceController.php
@@ -517,9 +517,9 @@ final class ReplaceController extends AbstractController
: [$whereClause];
$usingKey = true;
$submitType = $request->getParsedBodyParam('submit_type');
- $isInsert = ($submitType === 'insert'
+ $isInsert = $submitType === 'insert'
|| $submitType === 'showinsert'
- || $submitType === 'insertignore');
+ || $submitType === 'insertignore';
} else {
// new row => use indexes
$loopArray = [];
diff --git a/src/Controllers/Table/SearchController.php b/src/Controllers/Table/SearchController.php
index 86b8542e88..d250fb0b80 100644
--- a/src/Controllers/Table/SearchController.php
+++ b/src/Controllers/Table/SearchController.php
@@ -353,8 +353,8 @@ class SearchController extends AbstractController
*/
public function getColumnProperties(int $searchIndex, int $columnIndex): array
{
- $selectedOperator = ($_POST['criteriaColumnOperators'][$searchIndex] ?? '');
- $enteredValue = ($_POST['criteriaValues'] ?? '');
+ $selectedOperator = $_POST['criteriaColumnOperators'][$searchIndex] ?? '';
+ $enteredValue = $_POST['criteriaValues'] ?? '';
//Gets column's type and collation
$type = $this->columnTypes[$columnIndex];
$collation = $this->columnCollations[$columnIndex];
diff --git a/src/Controllers/Table/Structure/SaveController.php b/src/Controllers/Table/Structure/SaveController.php
index e6291c6097..aade7b5f7d 100644
--- a/src/Controllers/Table/Structure/SaveController.php
+++ b/src/Controllers/Table/Structure/SaveController.php
@@ -167,13 +167,11 @@ final class SaveController extends AbstractController
&& $_POST['field_collation'][$i] !== $_POST['field_collation_orig'][$i]
&& ! in_array($_POST['field_orig'][$i], $columnsWithIndex)
) {
- if ($_POST['field_type_orig'][$i] === 'MEDIUMTEXT') {
- $blobType = 'MEDIUMBLOB';
- } elseif ($_POST['field_type_orig'][$i] === 'LONGTEXT') {
- $blobType = 'LONGBLOB';
- } else {
- $blobType = 'BLOB';
- }
+ $blobType = match ($_POST['field_type_orig'][$i]) {
+ 'MEDIUMTEXT' => 'MEDIUMBLOB',
+ 'LONGTEXT' => 'LONGBLOB',
+ default => 'BLOB',
+ };
$secondaryQuery = 'ALTER TABLE ' . Util::backquote(Current::$table)
. ' CHANGE ' . Util::backquote($_POST['field_orig'][$i])
diff --git a/src/Controllers/Table/StructureController.php b/src/Controllers/Table/StructureController.php
index cc76cc42a3..33f11c17f2 100644
--- a/src/Controllers/Table/StructureController.php
+++ b/src/Controllers/Table/StructureController.php
@@ -309,8 +309,7 @@ class StructureController extends AbstractController
$showTable['Index_length'] = 0;
}
- $isInnoDB = (isset($showTable['Type'])
- && $showTable['Type'] === 'InnoDB');
+ $isInnoDB = isset($showTable['Type']) && $showTable['Type'] === 'InnoDB';
$mergetable = $this->tableObj->isMerge();
diff --git a/src/Controllers/Table/ZoomSearchController.php b/src/Controllers/Table/ZoomSearchController.php
index 18c38ac9e7..0ad0a2ee08 100644
--- a/src/Controllers/Table/ZoomSearchController.php
+++ b/src/Controllers/Table/ZoomSearchController.php
@@ -330,8 +330,8 @@ class ZoomSearchController extends AbstractController
}
$key = array_search($field, $this->columnNames);
- $searchIndex = (isset($_POST['it']) && is_numeric($_POST['it'])
- ? intval($_POST['it']) : 0);
+ $searchIndex = isset($_POST['it']) && is_numeric($_POST['it'])
+ ? intval($_POST['it']) : 0;
$properties = $this->getColumnProperties($searchIndex, $key);
$this->response->addJSON(
@@ -441,8 +441,8 @@ class ZoomSearchController extends AbstractController
*/
public function getColumnProperties(int $searchIndex, int $columnIndex): array
{
- $selectedOperator = ($_POST['criteriaColumnOperators'][$searchIndex] ?? '');
- $enteredValue = ($_POST['criteriaValues'] ?? '');
+ $selectedOperator = $_POST['criteriaColumnOperators'][$searchIndex] ?? '';
+ $enteredValue = $_POST['criteriaValues'] ?? '';
//Gets column's type and collation
$type = $this->columnTypes[$columnIndex];
$collation = $this->columnCollations[$columnIndex];
diff --git a/src/CreateAddField.php b/src/CreateAddField.php
index d2d7c0a312..408cf87561 100644
--- a/src/CreateAddField.php
+++ b/src/CreateAddField.php
@@ -382,7 +382,7 @@ class CreateAddField
// Adds table type, character set, comments and partition definition
if (
! empty($_POST['tbl_storage_engine'])
- && ($_POST['tbl_storage_engine'] !== 'Default')
+ && $_POST['tbl_storage_engine'] !== 'Default'
&& StorageEngine::isValid($_POST['tbl_storage_engine'])
) {
$sqlQuery .= ' ENGINE = ' . $_POST['tbl_storage_engine'];
diff --git a/src/Database/CentralColumns.php b/src/Database/CentralColumns.php
index 6b0a7b9b33..13077d95ce 100644
--- a/src/Database/CentralColumns.php
+++ b/src/Database/CentralColumns.php
@@ -248,11 +248,9 @@ class CentralColumns
* are added to central list otherwise the $field_select is considered as
* list of columns and these columns are added to central list if not already added
*
- * @param string[] $fieldSelect if $isTable is true selected tables list
- * otherwise selected columns list
- * @param bool $isTable if passed array is of tables or columns
- * @param string $table if $isTable is false, then table name to
- * which columns belong
+ * @param string[] $fieldSelect if $isTable is true selected tables list otherwise selected columns list
+ * @param bool $isTable if passed array is of tables or columns
+ * @param string|null $table if $isTable is false, then table name to which columns belong
*
* @return true|Message
*/
diff --git a/src/Database/Routines.php b/src/Database/Routines.php
index 9fa7fd64f3..b7b1f91dc9 100644
--- a/src/Database/Routines.php
+++ b/src/Database/Routines.php
@@ -319,10 +319,13 @@ class Routines
$retval['item_param_opts_num'] = [];
$retval['item_param_opts_text'] = [];
if (
- isset($_POST['item_param_name'], $_POST['item_param_type'])
- && isset($_POST['item_param_length'])
- && isset($_POST['item_param_opts_num'])
- && isset($_POST['item_param_opts_text'])
+ isset(
+ $_POST['item_param_name'],
+ $_POST['item_param_type'],
+ $_POST['item_param_length'],
+ $_POST['item_param_opts_num'],
+ $_POST['item_param_opts_text'],
+ )
&& is_array($_POST['item_param_name'])
&& is_array($_POST['item_param_type'])
&& is_array($_POST['item_param_length'])
diff --git a/src/Database/Search.php b/src/Database/Search.php
index 992bcc47d4..98e1a3ca67 100644
--- a/src/Database/Search.php
+++ b/src/Database/Search.php
@@ -160,8 +160,8 @@ class Search
$allColumns = $this->dbi->getColumns(Current::$database, $table);
$likeClauses = [];
// Based on search type, decide like/regex & '%'/''
- $likeOrRegex = ($this->criteriaSearchType == 5 ? 'REGEXP' : 'LIKE');
- $automaticWildcard = ($this->criteriaSearchType < 4 ? '%' : '');
+ $likeOrRegex = $this->criteriaSearchType == 5 ? 'REGEXP' : 'LIKE';
+ $automaticWildcard = $this->criteriaSearchType < 4 ? '%' : '';
// For "as regular expression" (search option 5), LIKE won't be used
// Usage example: If user is searching for a literal $ in a regexp search,
// they should enter \$ as the value.
@@ -205,7 +205,7 @@ class Search
}
// Use 'OR' if 'at least one word' is to be searched, else use 'AND'
- $implodeStr = ($this->criteriaSearchType == 1 ? ' OR ' : ' AND ');
+ $implodeStr = $this->criteriaSearchType == 1 ? ' OR ' : ' AND ';
return ' WHERE (' . implode(') ' . $implodeStr . ' (', $likeClauses) . ')';
}
diff --git a/src/Display/Results.php b/src/Display/Results.php
index ef6c889be8..6a2b65380f 100644
--- a/src/Display/Results.php
+++ b/src/Display/Results.php
@@ -575,7 +575,7 @@ class Results
return ! ($this->isCount || $this->isExport || $this->isFunction || $this->isAnalyse)
&& $statementInfo->selectFrom
&& ! empty($statementInfo->statement->from)
- && (count($statementInfo->statement->from) === 1)
+ && count($statementInfo->statement->from) === 1
&& ! empty($statementInfo->statement->from[0]->table);
}
@@ -672,7 +672,7 @@ class Results
return [
'page_selector' => $pageSelector,
'number_total_page' => $numberTotalPage,
- 'has_show_all' => $config->settings['ShowAll'] || ($this->unlimNumRows <= 500),
+ 'has_show_all' => $config->settings['ShowAll'] || $this->unlimNumRows <= 500,
'hidden_fields' => $hiddenFields,
'session_max_rows' => $isShowingAll ? $config->settings['MaxRows'] : 'all',
'is_showing_all' => $isShowingAll,
@@ -909,7 +909,7 @@ class Results
];
// Keep the number of rows (25, 50, 100, ...) when changing sort key value
- if (isset($_SESSION['tmpval']) && isset($_SESSION['tmpval']['max_rows'])) {
+ if (isset($_SESSION['tmpval'], $_SESSION['tmpval']['max_rows'])) {
$hiddenFields['session_max_rows'] = $_SESSION['tmpval']['max_rows'];
}
@@ -1339,7 +1339,7 @@ class Results
$sortOrder = '';
// check if this is the first clause,
// if it is then we have to add "order by"
- $isFirstClause = ($index === 0);
+ $isFirstClause = $index === 0;
$nameToUseInSort = $expression;
$sortTableNew = $sortTable;
// Test to detect if the column name is a standard name
@@ -1846,7 +1846,7 @@ class Results
while ($GLOBALS['row'] = $dtResult->fetchRow()) {
// add repeating headers
if (
- ($rowNumber !== 0) && ($_SESSION['tmpval']['repeat_cells'] > 0)
+ $rowNumber !== 0 && $_SESSION['tmpval']['repeat_cells'] > 0
&& ($rowNumber % $_SESSION['tmpval']['repeat_cells']) === 0
) {
$tableBodyHtml .= $this->getRepeatingHeaders();
@@ -1881,7 +1881,7 @@ class Results
if (
$displayParts->hasEditLink
- || ($displayParts->deleteLink !== DeleteLinkEnum::NO_DELETE)
+ || $displayParts->deleteLink !== DeleteLinkEnum::NO_DELETE
) {
$expressions = [];
@@ -1933,8 +1933,8 @@ class Results
// 1.3 Displays the links at left if required
if (
- ($config->settings['RowActionLinks'] === self::POSITION_LEFT)
- || ($config->settings['RowActionLinks'] === self::POSITION_BOTH)
+ $config->settings['RowActionLinks'] === self::POSITION_LEFT
+ || $config->settings['RowActionLinks'] === self::POSITION_BOTH
) {
$tableBodyHtml .= $this->template->render('display/results/checkbox_and_links', [
'position' => self::POSITION_LEFT,
@@ -2170,8 +2170,8 @@ class Results
// See if this column should get highlight because it's used in the
// where-query.
- $conditionField = (isset($this->highlightColumns[$meta->name])
- || isset($this->highlightColumns[Util::backquote($meta->name)]));
+ $conditionField = isset($this->highlightColumns[$meta->name])
+ || isset($this->highlightColumns[Util::backquote($meta->name)]);
// Wrap MIME-transformations. [MIME]
$transformationPlugin = null;
@@ -2214,7 +2214,7 @@ class Results
if (
! empty($this->transformationInfo[$dbLower][$tblLower][$nameLower])
&& isset($row[$i])
- && (trim($row[$i]) !== '')
+ && trim($row[$i]) !== ''
&& ! $_SESSION['tmpval']['hide_transformation']
) {
/** @psalm-suppress UnresolvableInclude */
@@ -3376,7 +3376,7 @@ class Results
$sortedColumnIndex = false;
foreach ($this->fieldsMeta as $key => $meta) {
- if (($meta->table === $sortTable) && ($meta->name === $sortColumn)) {
+ if ($meta->table === $sortTable && $meta->name === $sortColumn) {
$sortedColumnIndex = $key;
break;
}
@@ -3485,7 +3485,7 @@ class Results
} else {
$lastShownRec = $firstShownRec + $total - 1;
}
- } elseif (($_SESSION['tmpval']['max_rows'] === self::ALL_ROWS) || ($posNext > $total)) {
+ } elseif ($_SESSION['tmpval']['max_rows'] === self::ALL_ROWS || $posNext > $total) {
$firstShownRec = $_SESSION['tmpval']['pos'];
$lastShownRec = $total - 1;
} else {
@@ -3495,7 +3495,7 @@ class Results
$messageViewWarning = false;
$table = new Table($this->table, $this->db, $this->dbi);
- if ($table->isView() && ($total == Config::getInstance()->settings['MaxExactCountViews'])) {
+ if ($table->isView() && $total == Config::getInstance()->settings['MaxExactCountViews']) {
$message = Message::notice(
__(
'This view has at least this number of rows. Please refer to %sdocumentation%s.',
@@ -3683,7 +3683,7 @@ class Results
// (most probably PROCEDURE ANALYSE()) it makes no sense to
// display the Export link).
if (
- ($statementInfo->queryType === self::QUERY_TYPE_SELECT)
+ $statementInfo->queryType === self::QUERY_TYPE_SELECT
&& ! $statementInfo->isProcedure
) {
if (count($statementInfo->selectTables) === 1) {
diff --git a/src/Error/ErrorHandler.php b/src/Error/ErrorHandler.php
index 88116bf2e9..56ac648f44 100644
--- a/src/Error/ErrorHandler.php
+++ b/src/Error/ErrorHandler.php
@@ -431,7 +431,7 @@ class ErrorHandler
// restore saved errors
foreach ($_SESSION['errors'] as $hash => $error) {
- if (! ($error instanceof Error) || isset($this->errors[$hash])) {
+ if (! $error instanceof Error || isset($this->errors[$hash])) {
continue;
}
diff --git a/src/Export/Export.php b/src/Export/Export.php
index 5cd77079f8..8edce4b4b2 100644
--- a/src/Export/Export.php
+++ b/src/Export/Export.php
@@ -391,7 +391,7 @@ class Export
$doNotSaveItOver = $_POST['quick_export_onserver_overwrite'] !== 'saveitover';
}
- $saveFilename = Util::userDir((Config::getInstance()->settings['SaveDir'] ?? ''))
+ $saveFilename = Util::userDir(Config::getInstance()->settings['SaveDir'] ?? '')
. preg_replace('@[/\\\\]@', '_', $filename);
if (
diff --git a/src/Export/Options.php b/src/Export/Options.php
index d904e4d303..548b1c21ce 100644
--- a/src/Export/Options.php
+++ b/src/Export/Options.php
@@ -184,7 +184,7 @@ final class Options
'exec_time_limit' => $config->settings['ExecTimeLimit'],
'rows' => $rows,
'has_save_dir' => ! empty($config->settings['SaveDir']),
- 'save_dir' => Util::userDir(($config->settings['SaveDir'] ?? '')),
+ 'save_dir' => Util::userDir($config->settings['SaveDir'] ?? ''),
'export_is_checked' => $this->checkboxCheck('quick_export_onserver'),
'export_overwrite_is_checked' => $this->checkboxCheck('quick_export_onserver_overwrite'),
'has_aliases' => $hasAliases,
diff --git a/src/File.php b/src/File.php
index 3d34a11c48..b901523fdb 100644
--- a/src/File.php
+++ b/src/File.php
@@ -328,8 +328,8 @@ class File
/**
* sets the name if the file to the one selected in the tbl_change form
*
- * @param string $key the md5 hash of the column name
- * @param string $rownumber number of row to process
+ * @param string $key the md5 hash of the column name
+ * @param string|null $rownumber number of row to process
*/
public function setSelectedFromTblChangeRequest(
string $key,
diff --git a/src/Html/Generator.php b/src/Html/Generator.php
index 96c19de1f4..c01adb20a5 100644
--- a/src/Html/Generator.php
+++ b/src/Html/Generator.php
@@ -39,7 +39,6 @@ use function htmlspecialchars;
use function implode;
use function in_array;
use function ini_get;
-use function intval;
use function is_array;
use function is_string;
use function json_encode;
@@ -82,9 +81,9 @@ class Generator
/**
* Get a link to variable documentation
*
- * @param string $name The variable name
- * @param bool $useMariaDB Use only MariaDB documentation
- * @param string $text (optional) The text for the link
+ * @param string $name The variable name
+ * @param bool $useMariaDB Use only MariaDB documentation
+ * @param string|null $text (optional) The text for the link
*
* @return string link or empty string
*/
@@ -278,7 +277,7 @@ class Generator
// and the column does not have the
// ON UPDATE DEFAULT TIMESTAMP attribute.
if (
- ($trueType === 'timestamp')
+ $trueType === 'timestamp'
&& $firstTimestamp
&& ($defaultValue === null || $defaultValue === '')
&& $extra !== 'on update CURRENT_TIMESTAMP'
@@ -1051,9 +1050,6 @@ class Generator
string $name = 'pos',
array $classes = [],
): string {
- // This is often coming from $cfg['MaxTableList'] and
- // people sometimes set it to empty string
- $maxCount = intval($maxCount);
if ($maxCount <= 0) {
$maxCount = 250;
}
diff --git a/src/Import/Import.php b/src/Import/Import.php
index bddc0e3ec5..6f29e12f9d 100644
--- a/src/Import/Import.php
+++ b/src/Import/Import.php
@@ -162,7 +162,7 @@ class Import
$GLOBALS['msg'] .= __('MySQL returned an empty result set (i.e. zero rows).');
}
- if (($aNumRows > 0) || $isUseQuery) {
+ if ($aNumRows > 0 || $isUseQuery) {
$sqlData[] = $sql;
}
}
@@ -1112,7 +1112,7 @@ class Import
$tempSQLStr .= (string) $tables[$i][self::ROWS][$j][$k];
} else {
if ($analyses != null) {
- $isVarchar = ($analyses[$i][self::TYPES][$colCount] === self::VARCHAR);
+ $isVarchar = $analyses[$i][self::TYPES][$colCount] === self::VARCHAR;
} else {
$isVarchar = ! is_numeric($tables[$i][self::ROWS][$j][$k]);
}
@@ -1348,10 +1348,10 @@ class Import
// Check if query is supported.
if (
- ! (($statement instanceof InsertStatement)
- || ($statement instanceof UpdateStatement)
- || ($statement instanceof DeleteStatement)
- || ($statement instanceof ReplaceStatement))
+ ! ($statement instanceof InsertStatement
+ || $statement instanceof UpdateStatement
+ || $statement instanceof DeleteStatement
+ || $statement instanceof ReplaceStatement)
) {
return false;
}
@@ -1455,7 +1455,7 @@ class Import
: '';
return $fileListing->getFileSelectOptions(
- Util::userDir((Config::getInstance()->settings['UploadDir'] ?? '')),
+ Util::userDir(Config::getInstance()->settings['UploadDir'] ?? ''),
$matcher,
$active,
);
diff --git a/src/InsertEdit.php b/src/InsertEdit.php
index adb956349e..f8e1d3792e 100644
--- a/src/InsertEdit.php
+++ b/src/InsertEdit.php
@@ -250,11 +250,11 @@ class InsertEdit
$config = Config::getInstance();
switch ($which) {
case 'function':
- $params['ShowFunctionFields'] = ($isShow ? 0 : 1);
+ $params['ShowFunctionFields'] = $isShow ? 0 : 1;
$params['ShowFieldTypesInDataEditView'] = $config->settings['ShowFieldTypesInDataEditView'];
break;
case 'type':
- $params['ShowFieldTypesInDataEditView'] = ($isShow ? 0 : 1);
+ $params['ShowFieldTypesInDataEditView'] = $isShow ? 0 : 1;
$params['ShowFunctionFields'] = $config->settings['ShowFunctionFields'];
break;
}
@@ -486,7 +486,7 @@ class InsertEdit
private function getSelectOptionForUpload(string $vkey, string $fieldHashMd5): string
{
$files = $this->fileListing->getFileSelectOptions(
- Util::userDir((Config::getInstance()->settings['UploadDir'] ?? '')),
+ Util::userDir(Config::getInstance()->settings['UploadDir'] ?? ''),
);
if ($files === false) {
diff --git a/src/IpAllowDeny.php b/src/IpAllowDeny.php
index 0c18d4923c..f78ce8d16f 100644
--- a/src/IpAllowDeny.php
+++ b/src/IpAllowDeny.php
@@ -91,7 +91,7 @@ class IpAllowDeny
// perform a range match
for ($i = 0; $i < 4; $i++) {
if (preg_match('|\[([0-9]+)\-([0-9]+)\]|', $maskocts[$i], $regs)) {
- if (($ipocts[$i] > $regs[2]) || ($ipocts[$i] < $regs[1])) {
+ if ($ipocts[$i] > $regs[2] || $ipocts[$i] < $regs[1]) {
$result = false;
}
} elseif ($maskocts[$i] !== $ipocts[$i]) {
@@ -157,7 +157,7 @@ class IpAllowDeny
$lastHex = bin2hex((string) inet_pton($lastIp));
// check if the IP to test is within the range
- $result = ($ipHex >= $firstHex && $ipHex <= $lastHex);
+ $result = $ipHex >= $firstHex && $ipHex <= $lastHex;
}
return $result;
@@ -200,7 +200,7 @@ class IpAllowDeny
}
// check if the IP to test is within the range
- $result = ($ipHex >= $firstHex && $ipHex <= $lastHex);
+ $result = $ipHex >= $firstHex && $ipHex <= $lastHex;
}
return $result;
@@ -269,8 +269,8 @@ class IpAllowDeny
// check for username
if (
- ($ruleData[1] !== '%') //wildcarded first
- && (! hash_equals($ruleData[1], $username))
+ $ruleData[1] !== '%' //wildcarded first
+ && ! hash_equals($ruleData[1], $username)
) {
continue;
}
diff --git a/src/Linter.php b/src/Linter.php
index 54847ba5de..941bef2445 100644
--- a/src/Linter.php
+++ b/src/Linter.php
@@ -31,7 +31,7 @@ class Linter
*/
public static function getLines(string|UtfString $str): array
{
- if ((! ($str instanceof UtfString))) {
+ if (! $str instanceof UtfString) {
// If the lexer uses UtfString for processing then the position will
// represent the position of the character and not the position of
// the byte.
diff --git a/src/Message.php b/src/Message.php
index 81be1335cb..0f22a41ee0 100644
--- a/src/Message.php
+++ b/src/Message.php
@@ -591,13 +591,11 @@ class Message implements Stringable
*/
public function getMessageWithIcon(string $message): string
{
- if ($this->getLevel() === 'error') {
- $image = 's_error';
- } elseif ($this->getLevel() === 'success') {
- $image = 's_success';
- } else {
- $image = 's_notice';
- }
+ $image = match ($this->getLevel()) {
+ 'error' => 's_error',
+ 'success' => 's_success',
+ default =>'s_notice',
+ };
return self::notice(Html\Generator::getImage($image)) . ' ' . $message;
}
diff --git a/src/Navigation/Nodes/NodeTable.php b/src/Navigation/Nodes/NodeTable.php
index e8cc2653b0..8f7adaf37f 100644
--- a/src/Navigation/Nodes/NodeTable.php
+++ b/src/Navigation/Nodes/NodeTable.php
@@ -193,7 +193,7 @@ class NodeTable extends NodeDatabaseChild
'key' => $arr['Key'],
'type' => Util::extractColumnSpec($arr['Type'])['type'],
'default' => $arr['Default'],
- 'nullable' => ($arr['Null'] === 'NO' ? '' : 'nullable'),
+ 'nullable' => $arr['Null'] === 'NO' ? '' : 'nullable',
];
$count++;
}
diff --git a/src/Operations.php b/src/Operations.php
index 06bcda7f91..e3e65dd557 100644
--- a/src/Operations.php
+++ b/src/Operations.php
@@ -198,7 +198,7 @@ class Operations
$table,
$newDatabaseName->getName(),
$table,
- ($copyMode ?? 'data'),
+ $copyMode ?? 'data',
$move,
'db_copy',
isset($_POST['drop_if_exists']) && $_POST['drop_if_exists'] === 'true',
diff --git a/src/Plugins.php b/src/Plugins.php
index fbece5ba94..414fa7e3c6 100644
--- a/src/Plugins.php
+++ b/src/Plugins.php
@@ -586,7 +586,7 @@ class Plugins
// check for hidden properties
$noOptions = true;
foreach ($propertyMainGroup->getProperties() as $propertyItem) {
- if (! ($propertyItem instanceof HiddenPropertyItem)) {
+ if (! $propertyItem instanceof HiddenPropertyItem) {
$noOptions = false;
break;
}
diff --git a/src/Plugins/Export/ExportCodegen.php b/src/Plugins/Export/ExportCodegen.php
index 23afc23e1d..96d1d92b23 100644
--- a/src/Plugins/Export/ExportCodegen.php
+++ b/src/Plugins/Export/ExportCodegen.php
@@ -29,12 +29,10 @@ use function ucfirst;
*/
class ExportCodegen extends ExportPlugin
{
- /**
- * CodeGen Formats
- *
- * @var mixed[]
- */
- private array $cgFormats = [];
+ private const CODEGEN_FORMATS = [
+ self::HANDLER_NHIBERNATE_CS => 'NHibernate C# DO',
+ self::HANDLER_NHIBERNATE_XML => 'NHibernate XML',
+ ];
private const HANDLER_NHIBERNATE_CS = 0;
private const HANDLER_NHIBERNATE_XML = 1;
@@ -45,17 +43,6 @@ class ExportCodegen extends ExportPlugin
return 'codegen';
}
- /**
- * Initialize the local variables that are used for export CodeGen.
- */
- protected function init(): void
- {
- $this->setCgFormats([
- self::HANDLER_NHIBERNATE_CS => 'NHibernate C# DO',
- self::HANDLER_NHIBERNATE_XML => 'NHibernate XML',
- ]);
- }
-
protected function setProperties(): ExportPluginProperties
{
$exportPluginProperties = new ExportPluginProperties();
@@ -78,7 +65,7 @@ class ExportCodegen extends ExportPlugin
'format',
__('Format:'),
);
- $leaf->setValues($this->getCgFormats());
+ $leaf->setValues(self::CODEGEN_FORMATS);
$generalOptions->addProperty($leaf);
// add the main group to the root group
$exportSpecificOptions->addProperty($generalOptions);
@@ -359,24 +346,4 @@ class ExportCodegen extends ExportPlugin
return implode("\n", $lines);
}
-
- /**
- * Getter for CodeGen formats
- *
- * @return mixed[]
- */
- private function getCgFormats(): array
- {
- return $this->cgFormats;
- }
-
- /**
- * Setter for CodeGen formats
- *
- * @param mixed[] $cgFormats contains CodeGen Formats
- */
- private function setCgFormats(array $cgFormats): void
- {
- $this->cgFormats = $cgFormats;
- }
}
diff --git a/src/Plugins/Export/ExportSql.php b/src/Plugins/Export/ExportSql.php
index 48e0e5f038..2ff4e64c0d 100644
--- a/src/Plugins/Export/ExportSql.php
+++ b/src/Plugins/Export/ExportSql.php
@@ -1527,7 +1527,7 @@ class ExportSql extends ExportPlugin
/* Avoid operation on ARCHIVE tables as those can not be altered */
if (
- (! empty($statement->fields) && is_array($statement->fields))
+ ! empty($statement->fields) && is_array($statement->fields)
&& (empty($engine) || strtoupper($engine) !== 'ARCHIVE')
) {
@@ -1668,7 +1668,7 @@ class ExportSql extends ExportPlugin
. implode(',' . "\n" . ' MODIFY ', $autoIncrement);
if (
isset($GLOBALS['sql_auto_increment'])
- && ($statement->entityOptions->has('AUTO_INCREMENT') !== false)
+ && $statement->entityOptions->has('AUTO_INCREMENT') !== false
&& (! isset($GLOBALS['table_data']) || in_array($table, $GLOBALS['table_data']))
) {
$sqlAutoIncrementsQuery .= ', AUTO_INCREMENT='
@@ -2485,7 +2485,7 @@ class ExportSql extends ExportPlugin
}
// Replacing new values.
- if (($statement->name->database !== $newDatabase) || ($statement->name->table !== $newTable)) {
+ if ($statement->name->database !== $newDatabase || $statement->name->table !== $newTable) {
$statement->name->database = $newDatabase;
$statement->name->table = $newTable;
$statement->name->expr = ''; // Force rebuild.
diff --git a/src/Plugins/Export/Helpers/Pdf.php b/src/Plugins/Export/Helpers/Pdf.php
index 46ab7fb2e7..cb61816d19 100644
--- a/src/Plugins/Export/Helpers/Pdf.php
+++ b/src/Plugins/Export/Helpers/Pdf.php
@@ -752,7 +752,7 @@ class Pdf extends PdfLib
foreach ($colFits as $key => $val) {
$stringWidth = $this->GetStringWidth($row[$key] ?? 'NULL');
$stringWidth += 6;
- if ($adjustingMode && ($stringWidth > $sColWidth)) {
+ if ($adjustingMode && $stringWidth > $sColWidth) {
// any column whose data's width is bigger than
// the start width is now discarded
unset($colFits[$key]);
diff --git a/src/Plugins/Import/ImportMediawiki.php b/src/Plugins/Import/ImportMediawiki.php
index 2c17c2b15a..3f91b7531f 100644
--- a/src/Plugins/Import/ImportMediawiki.php
+++ b/src/Plugins/Import/ImportMediawiki.php
@@ -235,7 +235,7 @@ class ImportMediawiki extends ImportPlugin
$curTableName = '';
}
// What's after the row tag is now only attributes
- } elseif (($firstCharacter === '|') || ($firstCharacter === '!')) {
+ } elseif ($firstCharacter === '|' || $firstCharacter === '!') {
// Check cell elements
// Header cells
diff --git a/src/Plugins/Transformations/Abs/ExternalTransformationsPlugin.php b/src/Plugins/Transformations/Abs/ExternalTransformationsPlugin.php
index 7f82ad8292..80d61c7f51 100644
--- a/src/Plugins/Transformations/Abs/ExternalTransformationsPlugin.php
+++ b/src/Plugins/Transformations/Abs/ExternalTransformationsPlugin.php
@@ -110,11 +110,7 @@ abstract class ExternalTransformationsPlugin extends TransformationsPlugin
$cfg = Config::getInstance()->settings;
$options = $this->getOptions($options, $cfg['DefaultTransformations']['External']);
- if (isset($allowedPrograms[$options[0]])) {
- $program = $allowedPrograms[$options[0]];
- } else {
- $program = $allowedPrograms[0];
- }
+ $program = $allowedPrograms[$options[0]] ?? $allowedPrograms[0];
if (isset($options[1]) && strlen((string) $options[1]) > 0) {
trigger_error(sprintf(
diff --git a/src/Plugins/Transformations/Input/Text_Plain_Iptolong.php b/src/Plugins/Transformations/Input/Text_Plain_Iptolong.php
index 39dd170759..5ca60b1056 100644
--- a/src/Plugins/Transformations/Input/Text_Plain_Iptolong.php
+++ b/src/Plugins/Transformations/Input/Text_Plain_Iptolong.php
@@ -30,11 +30,11 @@ class Text_Plain_Iptolong extends IOTransformationsPlugin
/**
* Does the actual work of each specific transformations plugin.
*
- * @param string $buffer text to be transformed. a binary string containing
- * an IP address, as returned from MySQL's INET6_ATON
- * function
- * @param mixed[] $options transformation options
- * @param FieldMetadata $meta meta information
+ * @param string $buffer text to be transformed. a binary string containing
+ * an IP address, as returned from MySQL's INET6_ATON
+ * function
+ * @param mixed[] $options transformation options
+ * @param FieldMetadata|null $meta meta information
*
* @return string IP address
*/
diff --git a/src/Plugins/Transformations/Output/Text_Plain_Binarytoip.php b/src/Plugins/Transformations/Output/Text_Plain_Binarytoip.php
index 2928c73dcb..3c9e1e5e5b 100644
--- a/src/Plugins/Transformations/Output/Text_Plain_Binarytoip.php
+++ b/src/Plugins/Transformations/Output/Text_Plain_Binarytoip.php
@@ -42,7 +42,7 @@ class Text_Plain_Binarytoip extends TransformationsPlugin
*/
public function applyTransformation(string $buffer, array $options = [], FieldMetadata|null $meta = null): string
{
- $isBinary = ($meta !== null && $meta->isBinary);
+ $isBinary = $meta !== null && $meta->isBinary;
return FormatConverter::binaryToIp($buffer, $isBinary);
}
diff --git a/src/Server/Privileges.php b/src/Server/Privileges.php
index 359f0966aa..371084a4ea 100644
--- a/src/Server/Privileges.php
+++ b/src/Server/Privileges.php
@@ -770,10 +770,10 @@ class Privileges
if ($message === null) {
$hashingFunction = 'PASSWORD';
$serverVersion = $this->dbi->getVersion();
- $authenticationPlugin = ($_POST['authentication_plugin'] ?? $this->getCurrentAuthenticationPlugin(
+ $authenticationPlugin = $_POST['authentication_plugin'] ?? $this->getCurrentAuthenticationPlugin(
$username,
$hostname,
- ));
+ );
// Use 'ALTER USER ...' syntax for MySQL 5.7.6+
if (Compatibility::isMySqlOrPerconaDb() && $serverVersion >= 50706) {
@@ -1869,7 +1869,7 @@ class Privileges
$userDefaults = ['User' => '', 'Host' => '%', 'Password' => '?', 'Grant_priv' => 'N', 'privs' => ['USAGE']];
$dbRights = [];
- while (($row = $result->fetchAssoc())) {
+ while ($row = $result->fetchAssoc()) {
/** @psalm-var array{User: string, Host: string} $row */
$dbRights[$row['User']][$row['Host']] = array_merge($userDefaults, $row);
}
@@ -2303,7 +2303,7 @@ class Privileges
$passwordSetShow,
$alterRealSqlQuery,
$alterSqlQuery,
- ] = $this->getSqlQueriesForDisplayAndAddUser($username, $hostname, ($password ?? ''));
+ ] = $this->getSqlQueriesForDisplayAndAddUser($username, $hostname, $password ?? '');
if (empty($_POST['change_copy'])) {
$error = false;
diff --git a/src/Server/Status/Data.php b/src/Server/Status/Data.php
index 07b316c37b..6adb58fb83 100644
--- a/src/Server/Status/Data.php
+++ b/src/Server/Status/Data.php
@@ -230,9 +230,11 @@ class Data
{
// Key_buffer_fraction
if (
- isset($serverStatus['Key_blocks_unused'], $serverVariables['key_cache_block_size'])
- && isset($serverVariables['key_buffer_size'])
- && $serverVariables['key_buffer_size'] != 0
+ isset(
+ $serverStatus['Key_blocks_unused'],
+ $serverVariables['key_cache_block_size'],
+ $serverVariables['key_buffer_size'],
+ ) && $serverVariables['key_buffer_size'] != 0
) {
$serverStatus['Key_buffer_fraction_%'] = 100
- $serverStatus['Key_blocks_unused']
diff --git a/src/Server/Status/Processes.php b/src/Server/Status/Processes.php
index c870ea3267..7af4e55930 100644
--- a/src/Server/Status/Processes.php
+++ b/src/Server/Status/Processes.php
@@ -108,7 +108,7 @@ final class Processes
foreach ($sortableColumns as $columnKey => $column) {
$isSorted = $orderByField !== ''
&& $sortOrder !== ''
- && ($orderByField == $column['order_by_field']);
+ && $orderByField == $column['order_by_field'];
$column['sort_order'] = 'ASC';
if ($isSorted && $sortOrder === 'ASC') {
diff --git a/src/Sql.php b/src/Sql.php
index 5062df5511..ee82f41781 100644
--- a/src/Sql.php
+++ b/src/Sql.php
@@ -343,8 +343,8 @@ class Sql
|| $statementInfo->isAnalyse)
&& $statementInfo->selectFrom
&& ($statementInfo->selectExpression === []
- || ((count($statementInfo->selectExpression) === 1)
- && ($statementInfo->selectExpression[0] === '*')))
+ || (count($statementInfo->selectExpression) === 1
+ && $statementInfo->selectExpression[0] === '*'))
&& count($statementInfo->selectTables) === 1;
}
diff --git a/src/StorageEngine.php b/src/StorageEngine.php
index ea36fab7e2..bafa85bf12 100644
--- a/src/StorageEngine.php
+++ b/src/StorageEngine.php
@@ -73,7 +73,7 @@ class StorageEngine
$this->engine = $engine;
$this->title = $storageEngines[$engine]['Engine'];
- $this->comment = ($storageEngines[$engine]['Comment'] ?? '');
+ $this->comment = $storageEngines[$engine]['Comment'] ?? '';
$this->support = match ($storageEngines[$engine]['Support']) {
'DEFAULT' => self::SUPPORT_DEFAULT,
'YES' => self::SUPPORT_YES,
diff --git a/src/Table/Table.php b/src/Table/Table.php
index 71f17fff35..87ff8a7a09 100644
--- a/src/Table/Table.php
+++ b/src/Table/Table.php
@@ -657,7 +657,7 @@ class Table implements Stringable
$rowCount = null;
if (! $forceExact) {
- if (($cache->getCachedTableContent($this->dbName, $this->name, 'Rows') === null) && ! $isView) {
+ if ($cache->getCachedTableContent($this->dbName, $this->name, 'Rows') === null && ! $isView) {
$this->dbi->getTablesFull($this->dbName, $this->name);
}
@@ -2138,7 +2138,7 @@ class Table implements Stringable
// this is an alteration and the old constraint has been dropped
// without creation of a new one
- if (! $drop || ($tmpErrorCreate === '' || $tmpErrorCreate === false)) {
+ if (! $drop || $tmpErrorCreate === '' || $tmpErrorCreate === false) {
continue;
}
diff --git a/src/Tracking/Tracker.php b/src/Tracking/Tracker.php
index 0c62076b64..d680683617 100644
--- a/src/Tracking/Tracker.php
+++ b/src/Tracking/Tracker.php
@@ -360,9 +360,9 @@ class Tracker
* Gets the newest version of a tracking job
* (in other words: gets the HEAD version).
*
- * @param string $dbname name of database
- * @param string $tablename name of table
- * @param string $statement tracked statement
+ * @param string $dbname name of database
+ * @param string $tablename name of table
+ * @param string|null $statement tracked statement
*
* @return int (-1 if no version exists | > 0 if a version exists)
*/
diff --git a/src/Transformations.php b/src/Transformations.php
index 9b58bf74c5..c22c25ca3c 100644
--- a/src/Transformations.php
+++ b/src/Transformations.php
@@ -375,13 +375,12 @@ class Transformations
$transformation = mb_strtolower($transformation);
// Do we have any parameter to set?
- $hasValue = (
+ $hasValue =
strlen($mimetype) > 0 ||
strlen($transformation) > 0 ||
strlen($transformationOpts) > 0 ||
strlen($inputTransform) > 0 ||
- strlen($inputTransformOpts) > 0
- );
+ strlen($inputTransformOpts) > 0;
$testQry = '
SELECT `mimetype`,
@@ -473,7 +472,7 @@ class Transformations
. Util::backquote($browserTransformationFeature->columnInfo)
. ' WHERE ';
- if (($column != '') && ($table != '')) {
+ if ($column != '' && $table != '') {
$deleteSql .= '`db_name` = \'' . $db . '\' AND '
. '`table_name` = \'' . $table . '\' AND '
. '`column_name` = \'' . $column . '\' ';
diff --git a/src/Twig/AssetExtension.php b/src/Twig/AssetExtension.php
index e47e0703db..132a5ac610 100644
--- a/src/Twig/AssetExtension.php
+++ b/src/Twig/AssetExtension.php
@@ -23,7 +23,7 @@ final class AssetExtension extends AbstractExtension
{
if ($this->themeManager === null) {
$themeManager = ContainerBuilder::getContainer()->get(ThemeManager::class);
- if (! ($themeManager instanceof ThemeManager)) {
+ if (! $themeManager instanceof ThemeManager) {
return '';
}
diff --git a/src/TwoFactor.php b/src/TwoFactor.php
index cdd77001a8..b167e04e4c 100644
--- a/src/TwoFactor.php
+++ b/src/TwoFactor.php
@@ -59,7 +59,7 @@ class TwoFactor
$this->userPreferences = new UserPreferences($dbi, new Relation($dbi), new Template());
$this->available = $this->getAvailableBackends();
$this->config = $this->readConfig();
- $this->writable = ($this->config['type'] === 'db');
+ $this->writable = $this->config['type'] === 'db';
$this->backend = $this->getBackendForCurrentUser();
}
diff --git a/src/UserPassword.php b/src/UserPassword.php
index c91ab84871..dc83d94d7c 100644
--- a/src/UserPassword.php
+++ b/src/UserPassword.php
@@ -142,7 +142,7 @@ class UserPassword
return 'ALTER USER ' . $dbi->quoteString($username)
. '@' . $dbi->quoteString($hostname)
. ' IDENTIFIED WITH ' . $authPlugin . ' BY '
- . ($password === '' ? "''" : '' . $dbi->quoteString($password) . '');
+ . ($password === '' ? "''" : $dbi->quoteString($password));
}
$sqlQuery = 'ALTER USER ' . $dbi->quoteString($username)
diff --git a/src/Util.php b/src/Util.php
index ae10b1c37a..d1d42ef7c3 100644
--- a/src/Util.php
+++ b/src/Util.php
@@ -129,8 +129,8 @@ class Util
*
* checks if the string is quoted and removes this quotes
*
- * @param string $quotedString string to remove quotes from
- * @param string $quote type of quote to remove
+ * @param string $quotedString string to remove quotes from
+ * @param string|null $quote type of quote to remove
*
* @return string unquoted string
*/
@@ -387,7 +387,7 @@ class Util
/* l10n: Thousands separator */
__(','),
);
- if (($originalValue != 0) && (floatval($value) == 0)) {
+ if ($originalValue != 0 && floatval($value) == 0) {
return ' <' . (1 / 10 ** $digitsRight);
}
@@ -746,7 +746,7 @@ class Util
$i = $pageNow;
$dist = 1;
while ($i < $x) {
- $dist = 2 * $dist;
+ $dist *= 2;
$i = $pageNow + $dist;
if ($i <= 0 || $i > $x) {
continue;
@@ -758,7 +758,7 @@ class Util
$i = $pageNow;
$dist = 1;
while ($i > 0) {
- $dist = 2 * $dist;
+ $dist *= 2;
$i = $pageNow - $dist;
if ($i <= 0 || $i > $x) {
continue;
@@ -961,11 +961,11 @@ class Util
}
$printType = (string) preg_replace('@zerofill@', '', $printType, -1, $zerofillCount);
- $zerofill = ($zerofillCount > 0);
+ $zerofill = $zerofillCount > 0;
$printType = (string) preg_replace('@unsigned@', '', $printType, -1, $unsignedCount);
- $unsigned = ($unsignedCount > 0);
+ $unsigned = $unsignedCount > 0;
$printType = (string) preg_replace('@\/\*!100301 compressed\*\/@', '', $printType, -1, $compressedCount);
- $compressed = ($compressedCount > 0);
+ $compressed = $compressedCount > 0;
$printType = trim($printType);
}
diff --git a/src/Utils/ForeignKey.php b/src/Utils/ForeignKey.php
index f39045aab1..1e269974fc 100644
--- a/src/Utils/ForeignKey.php
+++ b/src/Utils/ForeignKey.php
@@ -23,7 +23,7 @@ final class ForeignKey
public static function isSupported(string $engine): bool
{
$engine = strtoupper($engine);
- if (($engine === 'INNODB') || ($engine === 'PBXT')) {
+ if ($engine === 'INNODB' || $engine === 'PBXT') {
return true;
}
diff --git a/src/ZipExtension.php b/src/ZipExtension.php
index feff1543fb..29cd8b41e7 100644
--- a/src/ZipExtension.php
+++ b/src/ZipExtension.php
@@ -240,11 +240,11 @@ class ZipExtension
}
$time = $timearray['year'] - 1980 << 25
- | ($timearray['mon'] << 21)
- | ($timearray['mday'] << 16)
- | ($timearray['hours'] << 11)
- | ($timearray['minutes'] << 5)
- | ($timearray['seconds'] >> 1);
+ | $timearray['mon'] << 21
+ | $timearray['mday'] << 16
+ | $timearray['hours'] << 11
+ | $timearray['minutes'] << 5
+ | $timearray['seconds'] >> 1;
$hexdtime = pack('V', $time);
diff --git a/tests/classes/Plugins/Export/ExportCodegenTest.php b/tests/classes/Plugins/Export/ExportCodegenTest.php
index 562e9c2264..3d2beca22d 100644
--- a/tests/classes/Plugins/Export/ExportCodegenTest.php
+++ b/tests/classes/Plugins/Export/ExportCodegenTest.php
@@ -17,7 +17,6 @@ use PhpMyAdmin\Tests\AbstractTestCase;
use PhpMyAdmin\Transformations;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
-use ReflectionClass;
use ReflectionMethod;
use ReflectionProperty;
@@ -56,19 +55,6 @@ class ExportCodegenTest extends AbstractTestCase
unset($this->object);
}
- public function testInitSpecificVariables(): void
- {
- $method = new ReflectionMethod(ExportCodegen::class, 'init');
- $method->invoke($this->object, null);
-
- $attrCgFormats = new ReflectionProperty(ExportCodegen::class, 'cgFormats');
-
- $this->assertEquals(
- ['NHibernate C# DO', 'NHibernate XML'],
- $attrCgFormats->getValue($this->object),
- );
- }
-
public function testSetProperties(): void
{
$method = new ReflectionMethod(ExportCodegen::class, 'setProperties');
@@ -312,24 +298,4 @@ class ExportCodegenTest extends AbstractTestCase
$result,
);
}
-
- /**
- * Test for
- * - PhpMyAdmin\Plugins\Export\ExportCodegen::getCgFormats
- * - PhpMyAdmin\Plugins\Export\ExportCodegen::setCgFormats
- */
- public function testSetGetCgFormats(): void
- {
- $reflection = new ReflectionClass(ExportCodegen::class);
-
- $getter = $reflection->getMethod('getCgFormats');
- $setter = $reflection->getMethod('setCgFormats');
-
- $setter->invoke($this->object, [1, 2]);
-
- $this->assertEquals(
- [1, 2],
- $getter->invoke($this->object),
- );
- }
}