Merge pull request #20023 from kamil-tekiela/Some-rector-fixes

Some rector fixes
This commit is contained in:
Maurício Meneghini Fauth 2026-01-14 16:54:05 -03:00 committed by GitHub
commit edf7b02f64
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
34 changed files with 113 additions and 254 deletions

View File

@ -516,12 +516,6 @@ parameters:
count: 4
path: src/Config/FormDisplay.php
-
message: '#^Call to function array_search\(\) requires parameter \#3 to be set\.$#'
identifier: function.strict
count: 4
path: src/Config/FormDisplay.php
-
message: '#^Call to function function_exists\(\) with ''bzcompress''\|''gzcompress''\|''gzencode'' will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
@ -582,12 +576,6 @@ parameters:
count: 1
path: src/Config/FormDisplay.php
-
message: '#^Parameter \#1 \$canonicalPath of method PhpMyAdmin\\Config\\ConfigFile\:\:getDefault\(\) expects string, mixed given\.$#'
identifier: argument.type
count: 1
path: src/Config/FormDisplay.php
-
message: '#^Parameter \#1 \$optionName of method PhpMyAdmin\\Config\\Form\:\:getOptionType\(\) expects string, \(int\|string\) given\.$#'
identifier: argument.type
@ -612,12 +600,6 @@ parameters:
count: 1
path: src/Config/FormDisplay.php
-
message: '#^Parameter \#1 \$path of static method PhpMyAdmin\\Config\\Descriptions\:\:get\(\) expects string, mixed given\.$#'
identifier: argument.type
count: 1
path: src/Config/FormDisplay.php
-
message: '#^Parameter \#1 \$value of method PhpMyAdmin\\Config\\FormDisplay\:\:validateSelect\(\) expects bool\|string, mixed given\.$#'
identifier: argument.type
@ -1251,12 +1233,6 @@ parameters:
count: 1
path: src/ConfigStorage/Relation.php
-
message: '#^Call to function array_search\(\) requires parameter \#3 to be set\.$#'
identifier: function.strict
count: 1
path: src/ConfigStorage/Relation.php
-
message: '#^Construct empty\(\) is not allowed\. Use more strict comparison\.$#'
identifier: empty.notAllowed
@ -1752,12 +1728,6 @@ parameters:
count: 1
path: src/Controllers/Database/StructureController.php
-
message: '#^Call to function array_search\(\) requires parameter \#3 to be set\.$#'
identifier: function.strict
count: 4
path: src/Controllers/Database/StructureController.php
-
message: '#^Cannot access offset ''table_limit_offset'' on mixed\.$#'
identifier: offsetAccess.nonOffsetAccessible
@ -2292,12 +2262,6 @@ parameters:
count: 1
path: src/Controllers/Server/Databases/CreateController.php
-
message: '#^Call to function array_search\(\) requires parameter \#3 to be set\.$#'
identifier: function.strict
count: 4
path: src/Controllers/Server/DatabasesController.php
-
message: '#^Cannot access offset ''DEFAULT_COLLATION_NAME'' on mixed\.$#'
identifier: offsetAccess.nonOffsetAccessible
@ -3696,12 +3660,6 @@ parameters:
count: 1
path: src/Controllers/Table/ZoomSearchController.php
-
message: '#^Call to function array_search\(\) requires parameter \#3 to be set\.$#'
identifier: function.strict
count: 2
path: src/Controllers/Table/ZoomSearchController.php
-
message: '#^Cannot access offset 0 on mixed\.$#'
identifier: offsetAccess.nonOffsetAccessible
@ -8571,12 +8529,6 @@ parameters:
count: 1
path: src/Plugins/Auth/AuthenticationCookie.php
-
message: '#^Only booleans are allowed in an if condition, string given\.$#'
identifier: if.condNotBoolean
count: 1
path: src/Plugins/Auth/AuthenticationCookie.php
-
message: '#^Parameter \#1 \$encryptedData of method PhpMyAdmin\\Plugins\\Auth\\AuthenticationCookie\:\:cookieDecrypt\(\) expects string, mixed given\.$#'
identifier: argument.type
@ -9234,12 +9186,6 @@ parameters:
count: 1
path: src/Plugins/Export/ExportXml.php
-
message: '#^Foreach overwrites \$table with its value variable\.$#'
identifier: foreach.valueOverwrite
count: 1
path: src/Plugins/Export/ExportXml.php
-
message: '#^Parameter \#1 \$string of function htmlspecialchars expects string, string\|null given\.$#'
identifier: argument.type
@ -10095,12 +10041,6 @@ parameters:
count: 2
path: src/Plugins/Schema/Dia/RelationStatsDia.php
-
message: '#^Call to function array_search\(\) requires parameter \#3 to be set\.$#'
identifier: function.strict
count: 1
path: src/Plugins/Schema/Dia/RelationStatsDia.php
-
message: '#^Loose comparison via "\!\=" is not allowed\.$#'
identifier: notEqual.notAllowed
@ -10494,12 +10434,6 @@ parameters:
count: 2
path: src/Plugins/Schema/Pdf/TableStatsPdf.php
-
message: '#^Call to function array_search\(\) requires parameter \#3 to be set\.$#'
identifier: function.strict
count: 1
path: src/Plugins/Schema/RelationStats.php
-
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
identifier: equal.notAllowed

View File

@ -151,7 +151,7 @@
<code><![CDATA[$c]]></code>
</MixedArgument>
<MixedArgumentTypeCoercion>
<code><![CDATA[$k]]></code>
<code><![CDATA[$persistKey]]></code>
</MixedArgumentTypeCoercion>
<MixedArrayAccess>
<code><![CDATA[$_SESSION[$this->id]['Servers'][$i + 1]]]></code>
@ -163,8 +163,8 @@
<MixedAssignment>
<code><![CDATA[$_SESSION[$this->id]['Servers'][$i]]]></code>
<code><![CDATA[$c]]></code>
<code><![CDATA[$c[$k]]]></code>
<code><![CDATA[$c[$mapTo]]]></code>
<code><![CDATA[$c[$persistKey]]]></code>
<code><![CDATA[$defaultValue]]></code>
<code><![CDATA[$host]]></code>
<code><![CDATA[$instanceDefaultValue]]></code>
@ -238,10 +238,8 @@
<code><![CDATA[Config::getInstance()]]></code>
</DeprecatedMethod>
<MixedArgument>
<code><![CDATA[$canonicalPath]]></code>
<code><![CDATA[$errorList]]></code>
<code><![CDATA[$ip]]></code>
<code><![CDATA[$this->systemPaths[$systemPath]]]></code>
<code><![CDATA[$userPrefsDisallow ?? []]]></code>
<code><![CDATA[$val]]></code>
<code><![CDATA[$validators[$path]]]></code>
@ -266,15 +264,14 @@
<code><![CDATA[$this->translatedPaths[$workPath]]]></code>
</MixedArrayTypeCoercion>
<MixedAssignment>
<code><![CDATA[$canonicalPath]]></code>
<code><![CDATA[$errorList]]></code>
<code><![CDATA[$errorList]]></code>
<code><![CDATA[$ip]]></code>
<code><![CDATA[$opts['errors']]]></code>
<code><![CDATA[$postValue]]></code>
<code><![CDATA[$proxies['-' . $i]]]></code>
<code><![CDATA[$userPrefsDisallow]]></code>
<code><![CDATA[$v]]></code>
<code><![CDATA[$v]]></code>
<code><![CDATA[$val]]></code>
<code><![CDATA[$value]]></code>
<code><![CDATA[$value]]></code>
@ -6114,7 +6111,6 @@
</PossiblyNullReference>
<PossiblyUnusedReturnValue>
<code><![CDATA[bool]]></code>
<code><![CDATA[bool]]></code>
</PossiblyUnusedReturnValue>
<RiskyTruthyFalsyComparison>
<code><![CDATA[empty($column->collation)]]></code>

View File

@ -107,7 +107,7 @@ final class Collation
*/
private function buildDescription(): string
{
$parts = explode('_', $this->getName());
$parts = explode('_', $this->name);
$name = __('Unknown');
$variant = null;

View File

@ -170,13 +170,13 @@ class TwigLintCommand extends Command
$nodeTree = $twig->parse($twig->tokenize(new Source($template, $file)));
$twig->compile($nodeTree);
$twig->setLoader($realLoader);
} catch (Error $e) {
} catch (Error $error) {
$twig->setLoader($realLoader);
return [
'template' => $template,
'file' => $file,
'exception' => $e,
'exception' => $error,
];
}

View File

@ -471,8 +471,8 @@ class ConfigFile
array_keys($this->persistKeys),
array_keys($c),
);
foreach ($persistKeys as $k) {
$c[$k] = $this->getDefault($this->getCanonicalPath($k));
foreach ($persistKeys as $persistKey) {
$c[$persistKey] = $this->getDefault($this->getCanonicalPath($persistKey));
}
foreach ($this->cfgUpdateReadMapping as $mapTo => $mapFrom) {

View File

@ -72,7 +72,7 @@ class FormDisplay
* Server paths change indexes so we define maps from current server
* path to the first one, indexed by work path
*
* @var mixed[]
* @var string[]
*/
private array $systemPaths = [];
@ -172,7 +172,7 @@ class FormDisplay
$paths[] = $form->name;
// collect values and paths
foreach ($form->fields as $path) {
$workPath = array_search($path, $this->systemPaths);
$workPath = array_search($path, $this->systemPaths, true);
$values[$path] = $this->configFile->getValue($workPath);
$paths[] = $path;
}
@ -185,7 +185,7 @@ class FormDisplay
if (is_array($errors) && $errors !== []) {
$this->errors = [];
foreach ($errors as $path => $errorList) {
$workPath = array_search($path, $this->systemPaths);
$workPath = array_search($path, $this->systemPaths, true);
// field error
if (! $workPath) {
// form error, fix path
@ -262,7 +262,7 @@ class FormDisplay
];
foreach ($form->fields as $field => $path) {
$workPath = array_search($path, $this->systemPaths);
$workPath = array_search($path, $this->systemPaths, true);
$translatedPath = $this->translatedPaths[$workPath];
// always true/false for user preferences display
// otherwise null
@ -562,7 +562,7 @@ class FormDisplay
: false;
// grab POST values
foreach ($form->fields as $field => $systemPath) {
$workPath = array_search($systemPath, $this->systemPaths);
$workPath = array_search($systemPath, $this->systemPaths, true);
$key = $this->translatedPaths[$workPath];
$type = $form->getOptionType($field);
@ -828,13 +828,13 @@ class FormDisplay
*/
private function fillPostArrayParameters(array $postValues, string $key): void
{
foreach ($postValues as $v) {
$v = Util::requestString($v);
if ($v === '') {
foreach ($postValues as $postValue) {
$postValue = Util::requestString($postValue);
if ($postValue === '') {
continue;
}
$_POST[$key][] = $v;
$_POST[$key][] = $postValue;
}
}

View File

@ -18,12 +18,12 @@ use function is_int;
abstract class BaseForm extends FormDisplay
{
/**
* @param ConfigFile $cf Config file instance
* @param int|null $serverId 0 if new server, validation; >= 1 if editing a server
* @param ConfigFile $configFile Config file instance
* @param int|null $serverId 0 if new server, validation; >= 1 if editing a server
*/
final public function __construct(ConfigFile $cf, int|null $serverId = null)
final public function __construct(ConfigFile $configFile, int|null $serverId = null)
{
parent::__construct($cf);
parent::__construct($configFile);
foreach (static::getForms() as $formName => $form) {
$this->registerForm($formName, $form, $serverId);

View File

@ -51,11 +51,11 @@ class BaseFormList
return null;
}
/** @param ConfigFile $cf Config file instance */
final public function __construct(ConfigFile $cf)
/** @param ConfigFile $configFile Config file instance */
final public function __construct(ConfigFile $configFile)
{
foreach (static::$all as $class) {
$this->forms[] = new $class($cf);
$this->forms[] = new $class($configFile);
}
}

View File

@ -83,16 +83,16 @@ class PageSettings
* Process response to form
*
* @param FormDisplay $formDisplay Form
* @param ConfigFile $cf Configuration file
* @param ConfigFile $configFile Configuration file
*/
private function processPageSettings(FormDisplay $formDisplay, ConfigFile $cf): Message|null
private function processPageSettings(FormDisplay $formDisplay, ConfigFile $configFile): Message|null
{
if (! $formDisplay->process(false) || $formDisplay->hasErrors()) {
return null;
}
// save settings
$result = $this->userPreferences->save($cf->getConfigArray());
$result = $this->userPreferences->save($configFile->getConfigArray());
if ($result === true) {
// reload page
$response = ResponseRenderer::getInstance();

View File

@ -49,17 +49,17 @@ readonly class UserPreferences
/**
* Common initialization for user preferences modification pages
*
* @param ConfigFile $cf Config file instance
* @param ConfigFile $configFile Config file instance
*/
public function pageInit(ConfigFile $cf): void
public function pageInit(ConfigFile $configFile): void
{
$formsAllKeys = UserFormList::getFields();
$cf->resetConfigData(); // start with a clean instance
$cf->setAllowedKeys($formsAllKeys);
$cf->setCfgUpdateReadMapping(
$configFile->resetConfigData(); // start with a clean instance
$configFile->setAllowedKeys($formsAllKeys);
$configFile->setCfgUpdateReadMapping(
['Server/hide_db' => 'Servers/1/hide_db', 'Server/only_db' => 'Servers/1/only_db'],
);
$cf->updateWithGlobalConfig($this->config->settings);
$configFile->updateWithGlobalConfig($this->config->settings);
}
/**

View File

@ -58,17 +58,17 @@ class Validator
/**
* Returns validator list
*
* @param ConfigFile $cf Config file instance
* @param ConfigFile $configFile Config file instance
*
* @return mixed[]
*/
public static function getValidators(ConfigFile $cf): array
public static function getValidators(ConfigFile $configFile): array
{
if (self::$validators !== null) {
return self::$validators;
}
self::$validators = $cf->getDbEntry('_validators', []);
self::$validators = $configFile->getDbEntry('_validators', []);
$config = Config::getInstance();
if ($config->isSetup()) {
return self::$validators;
@ -78,7 +78,7 @@ class Validator
// preferences we need original config values not overwritten
// by user preferences, creating a new PhpMyAdmin\Config instance is a
// better idea than hacking into its code
$uvs = $cf->getDbEntry('_userValidators', []);
$uvs = $configFile->getDbEntry('_userValidators', []);
foreach ($uvs as $field => $uvList) {
$uvList = (array) $uvList;
foreach ($uvList as &$uv) {
@ -115,7 +115,7 @@ class Validator
* cleanup in HTML document
* o false - when no validators match name(s) given by $validator_id
*
* @param ConfigFile $cf Config file instance
* @param ConfigFile $configFile Config file instance
* @param string|string[] $validatorId ID of validator(s) to run
* @param mixed[] $values Values to validate
* @param bool $isPostSource tells whether $values are directly from POST request
@ -123,17 +123,17 @@ class Validator
* @return mixed[]|bool
*/
public static function validate(
ConfigFile $cf,
ConfigFile $configFile,
string|array $validatorId,
array $values,
bool $isPostSource,
): bool|array {
// find validators
$validatorId = (array) $validatorId;
$validators = self::getValidators($cf);
$validators = self::getValidators($configFile);
$vids = [];
foreach ($validatorId as &$vid) {
$vid = $cf->getCanonicalPath($vid);
$vid = $configFile->getCanonicalPath($vid);
if (! isset($validators[$vid])) {
continue;
}
@ -151,7 +151,7 @@ class Validator
foreach ($values as $k => $v) {
$k2 = $isPostSource ? str_replace('-', '/', $k) : $k;
$k2 = mb_strpos($k2, '/')
? $cf->getCanonicalPath($k2)
? $configFile->getCanonicalPath($k2)
: $k2;
$keyMap[$k2] = $k;
$arguments[$k2] = $v;

View File

@ -1219,7 +1219,7 @@ class Relation
{
$foreigner = [];
foreach ($foreignKeysData as $oneKey) {
$columnIndex = array_search($column, $oneKey->indexList);
$columnIndex = array_search($column, $oneKey->indexList, true);
if ($columnIndex !== false) {
$foreigner['foreign_field'] = $oneKey->refIndexList[$columnIndex];
$foreigner['foreign_db'] = $oneKey->refDbName ?? Current::$database;

View File

@ -112,7 +112,7 @@ final readonly class RelationParameters
try {
$db = DatabaseName::from($params[self::DATABASE] ?? null);
} catch (InvalidDatabaseName) {
return new self($user, null);
return new self($user);
}
$bookmarkFeature = null;

View File

@ -590,11 +590,11 @@ final class StructureController implements InvocableController
if ($replicaInfo['status']) {
$nbServReplicaDoDb = count($replicaInfo['Do_DB']);
$nbServReplicaIgnoreDb = count($replicaInfo['Ignore_DB']);
$searchDoDBInTruename = array_search($table, $replicaInfo['Do_DB']);
$searchDoDBInDB = array_search(Current::$database, $replicaInfo['Do_DB']);
$searchDoDBInTruename = array_search($table, $replicaInfo['Do_DB'], true);
$searchDoDBInDB = array_search(Current::$database, $replicaInfo['Do_DB'], true);
$searchDb = array_search(Current::$database, $replicaInfo['Ignore_DB']);
$searchTable = array_search($table, $replicaInfo['Ignore_Table']);
$searchDb = array_search(Current::$database, $replicaInfo['Ignore_DB'], true);
$searchTable = array_search($table, $replicaInfo['Ignore_Table'], true);
$ignored = (is_string($searchTable) && $searchTable !== '')
|| (is_string($searchDb) && $searchDb !== '')
|| $this->hasTable($replicaInfo['Wild_Ignore_Table'], $table);

View File

@ -182,11 +182,11 @@ final class DatabasesController implements InvocableController
];
if ($primaryInfo['status']) {
$key = array_search($database['SCHEMA_NAME'], $primaryInfo['Ignore_DB']);
$key = array_search($database['SCHEMA_NAME'], $primaryInfo['Ignore_DB'], true);
$replication['primary']['is_replicated'] = false;
if ((string) $key === '') {
$key = array_search($database['SCHEMA_NAME'], $primaryInfo['Do_DB']);
$key = array_search($database['SCHEMA_NAME'], $primaryInfo['Do_DB'], true);
if ((string) $key !== '' || count($primaryInfo['Do_DB']) === 0) {
$replication['primary']['is_replicated'] = true;
@ -195,11 +195,11 @@ final class DatabasesController implements InvocableController
}
if ($replicaInfo['status']) {
$key = array_search($database['SCHEMA_NAME'], $replicaInfo['Ignore_DB']);
$key = array_search($database['SCHEMA_NAME'], $replicaInfo['Ignore_DB'], true);
$replication['replica']['is_replicated'] = false;
if ((string) $key === '') {
$key = array_search($database['SCHEMA_NAME'], $replicaInfo['Do_DB']);
$key = array_search($database['SCHEMA_NAME'], $replicaInfo['Do_DB'], true);
if ((string) $key !== '' || count($replicaInfo['Do_DB']) === 0) {
$replication['replica']['is_replicated'] = true;

View File

@ -251,7 +251,7 @@ final readonly class ChartController implements InvocableController
}
$this->response->setRequestStatus(true);
$this->response->addJSON('message', null);
$this->response->addJSON('message');
$this->response->addJSON('chartData', json_encode($sanitizedData));
}
}

View File

@ -260,7 +260,7 @@ final class ZoomSearchController implements InvocableController
$properties[$i] = $this->getColumnProperties(
$i,
(int) array_search($criteriaColumnNames[$i], $this->columnNames),
(int) array_search($criteriaColumnNames[$i], $this->columnNames, true),
);
}
@ -326,7 +326,7 @@ final class ZoomSearchController implements InvocableController
return;
}
$key = array_search($field, $this->columnNames);
$key = array_search($field, $this->columnNames, true);
$searchIndex = isset($_POST['it']) && is_numeric($_POST['it'])
? (int) $_POST['it'] : 0;

View File

@ -673,6 +673,7 @@ class Core
case 'b':
case 'i':
case 'd':
case 'N':
/* bool, integer or double */
// skip value to separator
$i = strpos($data, ';', $i);
@ -691,15 +692,6 @@ class Core
// remember nesting
$depth++;
break;
case 'N':
/* null */
// skip to end
$i = strpos($data, ';', $i);
if ($i === false) {
return null;
}
break;
default:
/* any other elements are not wanted */

View File

@ -246,7 +246,7 @@ class Header
$this->scripts->addFile('error_report.js');
}
if ($this->config->config->enable_drag_drop_import === true) {
if ($this->config->config->enable_drag_drop_import) {
$this->scripts->addFile('drag_drop_import.js');
}

View File

@ -120,7 +120,7 @@ class Pdf extends TCPDF
/**
* Improved with alias expanding.
*/
public function _putpages(): void
protected function _putpages(): void
{
if ($this->alias !== []) {
$nbPages = count($this->pages);

View File

@ -291,7 +291,7 @@ class AuthenticationCookie extends AuthenticationPlugin
$this->password = $password;
if ($config->config->AllowArbitraryServer && isset($_REQUEST['pma_servername'])) {
if ($config->config->ArbitraryServerRegexp) {
if ($config->config->ArbitraryServerRegexp !== '') {
$parts = explode(' ', $_REQUEST['pma_servername']);
if (count($parts) === 2) {
$tmpHost = $parts[0];

View File

@ -97,14 +97,14 @@ class ExportSql extends ExportPlugin
private bool $createDatabase = false;
private bool $dropTable = false;
private bool $procedureFunction = false;
private bool $createTable = false;
private bool $hasCreateProcedureFunction = false;
private bool $hasCreateTable = false;
/** @var 'INSERT'|'UPDATE'|'REPLACE' */
private string $type = 'INSERT';
private bool $createView = false;
private bool $createTrigger = false;
private bool $hasCreateView = false;
private bool $hasCreateTrigger = false;
private bool $viewCurrentUser = false;
private bool $simpleViewExport = false;
private bool $ifNotExists = false;
@ -124,7 +124,7 @@ class ExportSql extends ExportPlugin
private bool $utcTime = false;
private bool $dropDatabase = false;
private bool $viewsAsTables = false;
private bool $metadata = false;
private bool $hasMetadata = false;
public static string $oldTimezone = '';
public static bool $noConstraintsComments = false;
@ -613,7 +613,7 @@ class ExportSql extends ExportPlugin
*/
public function exportRoutines(string $db, array $aliases = []): bool
{
if (! $this->hasCreateProcedureFunction()) {
if (! $this->hasCreateProcedureFunction) {
return true;
}
@ -975,7 +975,7 @@ class ExportSql extends ExportPlugin
*/
public function exportEvents(string $db): bool
{
if (! $this->hasCreateProcedureFunction()) {
if (! $this->hasCreateProcedureFunction) {
return true;
}
@ -1041,7 +1041,7 @@ class ExportSql extends ExportPlugin
string|array $tables,
array $metadataTypes,
): bool {
if (! $this->hasMetadata()) {
if (! $this->hasMetadata) {
return true;
}
@ -1873,7 +1873,7 @@ class ExportSql extends ExportPlugin
switch ($exportMode) {
case 'create_table':
if (! $this->hasCreateTable()) {
if (! $this->hasCreateTable) {
return true; // User requested no table structure, so the job has been successfully completed
}
@ -1885,7 +1885,7 @@ class ExportSql extends ExportPlugin
$dump .= $this->getTableComments($db, $table, $aliases);
break;
case 'triggers':
if (! $this->hasCreateTrigger()) {
if (! $this->hasCreateTrigger) {
return true; // User requested no triggers, so the job has been successfully completed
}
@ -1938,7 +1938,7 @@ class ExportSql extends ExportPlugin
break;
case 'create_view':
if (! $this->hasCreateView()) {
if (! $this->hasCreateView) {
return true; // No view to export, so the job has been successfully completed
}
@ -1982,7 +1982,7 @@ class ExportSql extends ExportPlugin
break;
case 'stand_in':
if (! $this->hasCreateView()) {
if (! $this->hasCreateView) {
return true; // No view to export, so the job has been successfully completed
}
@ -2667,17 +2667,17 @@ class ExportSql extends ExportPlugin
?? $exportConfig['sql_create_database'] ?? false);
$this->dropTable = (bool) ($request->getParsedBodyParam('sql_drop_table')
?? $exportConfig['sql_drop_table'] ?? false);
$this->procedureFunction = (bool) ($request->getParsedBodyParam('sql_procedure_function')
$this->hasCreateProcedureFunction = (bool) ($request->getParsedBodyParam('sql_procedure_function')
?? $exportConfig['sql_procedure_function'] ?? false);
$this->createTable = (bool) ($request->getParsedBodyParam('sql_create_table')
$this->hasCreateTable = (bool) ($request->getParsedBodyParam('sql_create_table')
?? $exportConfig['sql_create_table'] ?? false);
$this->type = $this->setType($this->setStringValue(
$request->getParsedBodyParam('sql_type'),
$exportConfig['sql_type'] ?? null,
));
$this->createView = (bool) ($request->getParsedBodyParam('sql_create_view')
$this->hasCreateView = (bool) ($request->getParsedBodyParam('sql_create_view')
?? $exportConfig['sql_create_view'] ?? false);
$this->createTrigger = (bool) ($request->getParsedBodyParam('sql_create_trigger')
$this->hasCreateTrigger = (bool) ($request->getParsedBodyParam('sql_create_trigger')
?? $exportConfig['sql_create_trigger'] ?? false);
$this->viewCurrentUser = (bool) ($request->getParsedBodyParam('sql_view_current_user')
?? $exportConfig['sql_view_current_user'] ?? false);
@ -2711,7 +2711,7 @@ class ExportSql extends ExportPlugin
?? $exportConfig['sql_drop_database'] ?? false);
$this->viewsAsTables = (bool) ($request->getParsedBodyParam('sql_views_as_tables')
?? $exportConfig['sql_views_as_tables'] ?? false);
$this->metadata = (bool) ($request->getParsedBodyParam('sql_metadata')
$this->hasMetadata = (bool) ($request->getParsedBodyParam('sql_metadata')
?? $exportConfig['sql_metadata'] ?? false);
}
@ -2738,16 +2738,6 @@ class ExportSql extends ExportPlugin
return 'NONE';
}
private function hasCreateProcedureFunction(): bool
{
return $this->procedureFunction;
}
private function hasCreateTable(): bool
{
return $this->createTable;
}
/** @return 'INSERT'|'UPDATE'|'REPLACE' */
private function setType(string $type): string
{
@ -2758,16 +2748,6 @@ class ExportSql extends ExportPlugin
return 'INSERT';
}
private function hasCreateView(): bool
{
return $this->createView;
}
private function hasCreateTrigger(): bool
{
return $this->createTrigger;
}
public function setAutoIncrement(bool $autoIncrement): void
{
$this->autoIncrement = $autoIncrement;
@ -2796,9 +2776,4 @@ class ExportSql extends ExportPlugin
return 50000;
}
public function hasMetadata(): bool
{
return $this->metadata;
}
}

View File

@ -37,10 +37,6 @@ use const PHP_VERSION;
*/
class ExportXml extends ExportPlugin
{
/**
* Table name
*/
private string $table = '';
/**
* Table names
*
@ -183,11 +179,6 @@ class ExportXml extends ExportPlugin
*/
public function exportHeader(): bool
{
$this->setTable(Current::$table);
$table = $this->getTable();
$tables = $this->getTables();
$exportStruct = $this->exportFunctions
|| $this->exportProcedures
|| $this->exportTables
@ -239,11 +230,11 @@ class ExportXml extends ExportPlugin
. '" collation="' . htmlspecialchars($dbCollation) . '" charset="' . htmlspecialchars($dbCharset)
. '">' . "\n";
if ($tables === []) {
$tables[] = $table;
if ($this->tables === []) {
$this->tables[] = Current::$table;
}
foreach ($tables as $table) {
foreach ($this->tables as $table) {
// Export tables and views
$result = $dbi->fetchResult(
'SHOW CREATE TABLE ' . Util::backquote(Current::$database) . '.'
@ -452,34 +443,6 @@ class ExportXml extends ExportPlugin
/* ~~~~~~~~~~~~~~~~~~~~ Getters and Setters ~~~~~~~~~~~~~~~~~~~~ */
/**
* Gets the table name
*/
private function getTable(): string
{
return $this->table;
}
/**
* Sets the table name
*
* @param string $table table name
*/
private function setTable(string $table): void
{
$this->table = $table;
}
/**
* Gets the table names
*
* @return string[]
*/
private function getTables(): array
{
return $this->tables;
}
/**
* Sets the table names
*

View File

@ -104,7 +104,7 @@ class Pdf extends PdfLib
* @param bool $addpage if true add a page, otherwise only return
* the true/false state
*/
public function checkPageBreak(mixed $h = 0, mixed $y = '', mixed $addpage = true): bool
protected function checkPageBreak(mixed $h = 0, mixed $y = '', mixed $addpage = true): bool
{
if (TCPDF_STATIC::empty_string($y)) {
$y = $this->y;

View File

@ -74,7 +74,7 @@ class RelationStatsDia
*/
private function getXy(TableStatsDia $table, string $column): array
{
$pos = array_search($column, $table->fields);
$pos = array_search($column, $table->fields, true);
// left, right, position
$value = 12;
if ($pos != 0) {

View File

@ -102,7 +102,7 @@ abstract class RelationStats
*/
private function getXy(TableStats $table, string $column): array
{
$pos = array_search($column, $table->fields);
$pos = array_search($column, $table->fields, true);
// x_left, x_right, y
return [$table->x, $table->x + $table->width, $table->y + ($pos + 1.5) * $table->heightCell];

View File

@ -96,8 +96,8 @@ class Key extends TwoFactorPlugin
$this->twofactor->save();
return true;
} catch (U2FException $e) {
$this->message = $e->getMessage();
} catch (U2FException $exception) {
$this->message = $exception->getMessage();
return false;
}
@ -188,8 +188,8 @@ class Key extends TwoFactorPlugin
];
return true;
} catch (U2FException $e) {
$this->message = $e->getMessage();
} catch (U2FException $exception) {
$this->message = $exception->getMessage();
return false;
}

View File

@ -68,19 +68,19 @@ final class Plugin
public function toArray(): array
{
return [
'name' => $this->getName(),
'version' => $this->getVersion(),
'status' => $this->getStatus(),
'type' => $this->getType(),
'type_version' => $this->getTypeVersion(),
'library' => $this->getLibrary(),
'library_version' => $this->getLibraryVersion(),
'author' => $this->getAuthor(),
'description' => $this->getDescription(),
'license' => $this->getLicense(),
'load_option' => $this->getLoadOption(),
'maturity' => $this->getMaturity(),
'auth_version' => $this->getAuthVersion(),
'name' => $this->name,
'version' => $this->version,
'status' => $this->status,
'type' => $this->type,
'type_version' => $this->typeVersion,
'library' => $this->library,
'library_version' => $this->libraryVersion,
'author' => $this->author,
'description' => $this->description,
'license' => $this->license,
'load_option' => $this->loadOption,
'maturity' => $this->maturity,
'auth_version' => $this->authVersion,
];
}

View File

@ -70,10 +70,10 @@ class CacheTest extends AbstractTestCase
self::assertFalse(Cache::has($cacheKey));
Cache::set($cacheKey, $valueToCache);
self::assertTrue(Cache::has($cacheKey));
self::assertSame(Cache::get($cacheKey, null), $valueToCache);
self::assertSame(Cache::get($cacheKey), $valueToCache);
Cache::remove($cacheKey);
self::assertFalse(Cache::has($cacheKey));
self::assertNull(Cache::get($cacheKey, null));
self::assertNull(Cache::get($cacheKey));
$defaultValue = new stdClass();
self::assertSame($defaultValue, Cache::get($cacheKey, $defaultValue));
self::assertFalse(Cache::get($cacheKey, false));

View File

@ -22,9 +22,9 @@ use ReflectionProperty;
#[CoversClass(UpdateController::class)]
final class UpdateControllerTest extends AbstractTestCase
{
protected DatabaseInterface $dbi;
private DatabaseInterface $dbi;
protected DbiDummy $dummyDbi;
private DbiDummy $dummyDbi;
protected function setUp(): void
{

View File

@ -20,9 +20,9 @@ use function sprintf;
#[CoversClass(CreateController::class)]
final class CreateControllerTest extends AbstractTestCase
{
protected DatabaseInterface $dbi;
private DatabaseInterface $dbi;
protected DbiDummy $dummyDbi;
private DbiDummy $dummyDbi;
protected function setUp(): void
{

View File

@ -52,7 +52,6 @@ class GeneratorTest extends AbstractTestCase
Generator::getColumns(
"'mydb'",
"'mytable'",
null,
),
);
self::assertSame(

View File

@ -1572,7 +1572,7 @@ class TableTest extends AbstractTestCase
$extension = new DbiDummy();
$dbi = DatabaseInterface::getInstanceForTest($extension);
$tblObject = new Table($targetTable, $targetDb, $dbi);
$tblObject->getStatusInfo(null);
$tblObject->getStatusInfo();
$expect = 'DBIdummy';
$tblStorageEngine = $dbi->getTable($targetDb, $targetTable)->getStorageEngine();
self::assertSame($expect, $tblStorageEngine);
@ -1588,7 +1588,7 @@ class TableTest extends AbstractTestCase
$extension = new DbiDummy();
$dbi = DatabaseInterface::getInstanceForTest($extension);
$tblObject = new Table($targetTable, $targetDb, $dbi);
$tblObject->getStatusInfo(null);
$tblObject->getStatusInfo();
$expect = 'Test comment for "table1" in \'pma_test\'';
$showComment = $dbi->getTable($targetDb, $targetTable)->getComment();
self::assertSame($expect, $showComment);
@ -1604,7 +1604,7 @@ class TableTest extends AbstractTestCase
$extension = new DbiDummy();
$dbi = DatabaseInterface::getInstanceForTest($extension);
$tblObject = new Table($targetTable, $targetDb, $dbi);
$tblObject->getStatusInfo(null);
$tblObject->getStatusInfo();
$expect = 'utf8mb4_general_ci';
$tblCollation = $dbi->getTable($targetDb, $targetTable)->getCollation();
self::assertSame($expect, $tblCollation);
@ -1620,7 +1620,7 @@ class TableTest extends AbstractTestCase
$extension = new DbiDummy();
$dbi = DatabaseInterface::getInstanceForTest($extension);
$tblObject = new Table($targetTable, $targetDb, $dbi);
$tblObject->getStatusInfo(null);
$tblObject->getStatusInfo();
$expect = 'Redundant';
$rowFormat = $dbi->getTable($targetDb, $targetTable)->getRowFormat();
self::assertSame($expect, $rowFormat);
@ -1636,7 +1636,7 @@ class TableTest extends AbstractTestCase
$extension = new DbiDummy();
$dbi = DatabaseInterface::getInstanceForTest($extension);
$tblObject = new Table($targetTable, $targetDb, $dbi);
$tblObject->getStatusInfo(null);
$tblObject->getStatusInfo();
$expect = '5';
$autoIncrement = $dbi->getTable($targetDb, $targetTable)->getAutoIncrement();
self::assertSame($expect, $autoIncrement);
@ -1652,7 +1652,7 @@ class TableTest extends AbstractTestCase
$extension = new DbiDummy();
$dbi = DatabaseInterface::getInstanceForTest($extension);
$tblObject = new Table($targetTable, $targetDb, $dbi);
$tblObject->getStatusInfo(null);
$tblObject->getStatusInfo();
$expect = ['pack_keys' => 'DEFAULT', 'row_format' => 'REDUNDANT'];
$createOptions = $dbi->getTable($targetDb, $targetTable)->getCreateOptions();
self::assertEquals($expect, $createOptions);

View File

@ -149,7 +149,7 @@ final class WebauthnLibServerTest extends TestCase
'type' => 'public-key',
'transports' => [],
'attestationType' => 'none',
'trustPath' => ['type' => 'Webauthn\\TrustPath\\EmptyTrustPath'],
'trustPath' => ['type' => EmptyTrustPath::class],
'aaguid' => '00000000-0000-0000-0000-000000000000',
// phpcs:ignore Generic.Files.LineLength.TooLong
'credentialPublicKey' => 'pQECAyYgASFYIJV56vRrFusoDf9hm3iDmllcxxXzzKyO9WruKw4kWx7zIlgg_nq63l8IMJcIdKDJcXRh9hoz0L-nVwP1Oxil3_oNQYs',
@ -190,7 +190,7 @@ final class WebauthnLibServerTest extends TestCase
'type' => 'public-key',
'transports' => [],
'attestationType' => 'none',
'trustPath' => ['type' => 'Webauthn\\TrustPath\\EmptyTrustPath'],
'trustPath' => ['type' => EmptyTrustPath::class],
'aaguid' => '00000000-0000-0000-0000-000000000000',
// phpcs:ignore Generic.Files.LineLength.TooLong
'credentialPublicKey' => 'pQECAyYgASFYIBw_HArIcANWNOBOxq3hH8lrHo9a17nQDxlqwybjDpHEIlggu3QUKIbALqsGuHfJI3LTKJSNmk0YCFb5oz1hjJidRMk',