Merge pull request #18906 from kamil-tekiela/Small-fixes-from-phpStorm

Small fixes from PHPStorm
This commit is contained in:
Maurício Meneghini Fauth 2024-01-12 14:33:58 -03:00 committed by GitHub
commit f42bd22ddd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
64 changed files with 183 additions and 264 deletions

View File

@ -10150,11 +10150,9 @@
</MixedArrayAccess>
<MixedArrayOffset>
<code>$allowedPrograms[$options[0]]</code>
<code>$allowedPrograms[$options[0]]</code>
</MixedArrayOffset>
<MixedAssignment>
<code>$program</code>
<code>$program</code>
</MixedAssignment>
<MixedOperand>
<code>$options[1]</code>

View File

@ -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 .= '<div class="col-auto">'
. '<label class="form-label" for="input_foreign_filter">' . __('Search:') . '</label></div>' . "\n"
. '<div class="col-auto"><input class="form-control" type="text" name="foreign_filter" '

View File

@ -633,7 +633,7 @@ class Config
}
$perms = @fileperms($this->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')) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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),
]);
}

View File

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

View File

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

View File

@ -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 ' .

View File

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

View File

@ -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),
]);
}

View File

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

View File

@ -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')]));
}

View File

@ -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'])) {

View File

@ -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),
]);
}

View File

@ -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'],

View File

@ -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 = [];

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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
*/

View File

@ -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'])

View File

@ -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) . ')';
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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',

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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
*/

View File

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

View File

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

View File

@ -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']

View File

@ -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') {

View File

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

View File

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

View File

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

View File

@ -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)
*/

View File

@ -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 . '\' ';

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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