From 6a2c12bdc85d5bb1a1c2c2e776ad454d42e57fbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Sun, 2 Apr 2023 01:23:59 -0300 Subject: [PATCH] Add missing traversable type hints MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace array type hint with mixed[] type hint, since it means the same. This way it's possible to require traversable type hint for new code. Signed-off-by: MaurĂ­cio Meneghini Fauth --- libraries/classes/Advisory/Advisor.php | 18 +- libraries/classes/Bookmark.php | 8 +- libraries/classes/BrowseForeigners.php | 20 +- libraries/classes/Command/TwigLintCommand.php | 5 + libraries/classes/Config.php | 14 +- libraries/classes/Config/ConfigFile.php | 36 +- libraries/classes/Config/Form.php | 20 +- libraries/classes/Config/FormDisplay.php | 32 +- .../classes/Config/FormDisplayTemplate.php | 25 +- libraries/classes/Config/Forms/BaseForm.php | 2 +- .../classes/Config/Forms/Page/BrowseForm.php | 2 +- .../Config/Forms/Page/DbStructureForm.php | 2 +- .../classes/Config/Forms/Page/EditForm.php | 2 +- .../Config/Forms/Page/TableStructureForm.php | 2 +- .../classes/Config/Forms/Setup/ConfigForm.php | 2 +- .../Config/Forms/Setup/FeaturesForm.php | 2 +- .../classes/Config/Forms/Setup/MainForm.php | 2 +- .../Config/Forms/Setup/ServersForm.php | 2 +- .../classes/Config/Forms/Setup/SqlForm.php | 2 +- .../classes/Config/Forms/User/ExportForm.php | 2 +- .../Config/Forms/User/FeaturesForm.php | 2 +- .../classes/Config/Forms/User/ImportForm.php | 2 +- .../classes/Config/Forms/User/MainForm.php | 2 +- .../classes/Config/Forms/User/NaviForm.php | 2 +- .../classes/Config/Forms/User/SqlForm.php | 2 +- libraries/classes/Config/Validator.php | 88 +- libraries/classes/ConfigStorage/Relation.php | 62 +- .../classes/ConfigStorage/UserGroups.php | 10 +- .../Database/CentralColumnsController.php | 18 +- .../Structure/FavoriteTableController.php | 4 +- .../Database/StructureController.php | 56 +- .../Controllers/Server/BinlogController.php | 2 + .../Server/DatabasesController.php | 10 +- .../Status/Processes/KillController.php | 2 +- .../Server/Status/StatusController.php | 4 +- .../Server/Status/VariablesController.php | 4 +- .../Variables/GetVariableController.php | 2 +- .../Variables/SetVariableController.php | 4 +- .../Server/VariablesController.php | 2 +- .../Controllers/Setup/AbstractController.php | 2 +- .../Controllers/Setup/ConfigController.php | 2 +- .../Controllers/Setup/FormController.php | 2 +- .../Controllers/Setup/HomeController.php | 2 +- .../Controllers/Setup/ServersController.php | 4 +- .../Table/FindReplaceController.php | 6 +- .../Controllers/Table/RelationController.php | 8 +- .../Controllers/Table/SearchController.php | 14 +- .../Table/Structure/SaveController.php | 2 +- .../Controllers/Table/StructureController.php | 6 +- .../Table/ZoomSearchController.php | 14 +- .../Controllers/View/CreateController.php | 3 + libraries/classes/Core.php | 28 +- libraries/classes/CreateAddField.php | 18 +- libraries/classes/Database/CentralColumns.php | 50 +- libraries/classes/Database/Designer.php | 26 +- .../classes/Database/Designer/Common.php | 14 +- libraries/classes/Database/Events.php | 34 +- libraries/classes/Database/Qbe.php | 96 +- libraries/classes/Database/Routines.php | 72 +- libraries/classes/Database/Search.php | 4 +- libraries/classes/Database/Triggers.php | 26 +- libraries/classes/DatabaseInterface.php | 54 +- libraries/classes/Dbal/DbalInterface.php | 44 +- libraries/classes/Display/Results.php | 91 +- libraries/classes/Encoding.php | 6 +- libraries/classes/Engines/Bdb.php | 2 +- libraries/classes/Engines/Innodb.php | 2 +- libraries/classes/Engines/Memory.php | 2 +- libraries/classes/Engines/Myisam.php | 2 +- libraries/classes/Engines/Ndbcluster.php | 2 +- libraries/classes/Engines/Pbxt.php | 4 +- libraries/classes/Error.php | 18 +- libraries/classes/ErrorReport.php | 10 +- libraries/classes/Export.php | 55 +- libraries/classes/FieldMetadata.php | 6 +- libraries/classes/File.php | 8 +- libraries/classes/FileListing.php | 2 +- libraries/classes/FlashMessages.php | 2 +- libraries/classes/Font.php | 10 +- libraries/classes/Footer.php | 4 +- libraries/classes/Gis/GisGeometry.php | 52 +- .../classes/Gis/GisGeometryCollection.php | 35 +- libraries/classes/Gis/GisLineString.php | 28 +- libraries/classes/Gis/GisMultiLineString.php | 30 +- libraries/classes/Gis/GisMultiPoint.php | 30 +- libraries/classes/Gis/GisMultiPolygon.php | 34 +- libraries/classes/Gis/GisPoint.php | 30 +- libraries/classes/Gis/GisPolygon.php | 44 +- libraries/classes/Gis/GisVisualization.php | 4 +- libraries/classes/Git.php | 3 +- libraries/classes/Header.php | 2 +- libraries/classes/Html/Generator.php | 20 +- libraries/classes/Import.php | 22 +- libraries/classes/Import/Ajax.php | 2 + libraries/classes/Index.php | 6 +- libraries/classes/IndexColumn.php | 4 +- libraries/classes/InsertEdit.php | 261 +- libraries/classes/InternalRelations.php | 8 +- libraries/classes/LanguageManager.php | 6 +- libraries/classes/Linter.php | 8 +- libraries/classes/ListDatabase.php | 2 +- libraries/classes/Menu.php | 8 +- libraries/classes/Message.php | 22 +- libraries/classes/Navigation/Navigation.php | 1 + .../classes/Navigation/NavigationTree.php | 30 +- libraries/classes/Navigation/Nodes/Node.php | 14 +- .../classes/Navigation/Nodes/NodeColumn.php | 8 +- .../classes/Navigation/Nodes/NodeDatabase.php | 18 +- .../classes/Navigation/Nodes/NodeTable.php | 2 +- libraries/classes/Normalization.php | 38 +- libraries/classes/Operations.php | 22 +- .../classes/Partitioning/Maintenance.php | 5 + libraries/classes/Partitioning/Partition.php | 4 +- .../classes/Partitioning/SubPartition.php | 4 +- .../Partitioning/TablePartitionDefinition.php | 7 +- libraries/classes/Pdf.php | 4 +- .../Plugins/Auth/AuthenticationSignon.php | 2 +- .../classes/Plugins/Export/ExportCodegen.php | 28 +- .../classes/Plugins/Export/ExportCsv.php | 10 +- .../classes/Plugins/Export/ExportHtmlword.php | 80 +- .../classes/Plugins/Export/ExportJson.php | 10 +- .../classes/Plugins/Export/ExportLatex.php | 42 +- .../Plugins/Export/ExportMediawiki.php | 42 +- .../classes/Plugins/Export/ExportOds.php | 10 +- .../classes/Plugins/Export/ExportOdt.php | 86 +- .../classes/Plugins/Export/ExportPdf.php | 42 +- .../classes/Plugins/Export/ExportPhparray.php | 10 +- .../classes/Plugins/Export/ExportSql.php | 92 +- .../classes/Plugins/Export/ExportTexytext.php | 86 +- .../classes/Plugins/Export/ExportXml.php | 16 +- .../classes/Plugins/Export/ExportYaml.php | 10 +- .../classes/Plugins/Export/Helpers/Pdf.php | 38 +- .../Plugins/Export/Helpers/TableProperty.php | 2 +- libraries/classes/Plugins/ExportPlugin.php | 72 +- .../Plugins/IOTransformationsPlugin.php | 18 +- .../classes/Plugins/Import/ImportCsv.php | 8 + .../Plugins/Import/ImportMediawiki.php | 38 +- .../classes/Plugins/Import/ImportOds.php | 17 +- .../classes/Plugins/Import/ImportSql.php | 2 +- .../Plugins/Schema/Dia/RelationStatsDia.php | 2 +- libraries/classes/Plugins/Schema/Pdf/Pdf.php | 10 +- .../Plugins/Schema/Pdf/PdfRelationSchema.php | 2 +- .../classes/Plugins/Schema/RelationStats.php | 2 +- .../classes/Plugins/Schema/TableStats.php | 4 +- libraries/classes/Plugins/SchemaPlugin.php | 2 +- .../Abs/Bool2TextTransformationsPlugin.php | 2 +- .../CodeMirrorEditorTransformationPlugin.php | 20 +- .../Abs/DateFormatTransformationsPlugin.php | 2 +- .../Abs/DownloadTransformationsPlugin.php | 2 +- .../Abs/ExternalTransformationsPlugin.php | 4 +- .../Abs/FormattedTransformationsPlugin.php | 2 +- .../Abs/HexTransformationsPlugin.php | 2 +- .../Abs/ImageLinkTransformationsPlugin.php | 2 +- .../Abs/ImageUploadTransformationsPlugin.php | 20 +- .../Abs/InlineTransformationsPlugin.php | 2 +- .../Abs/LongToIPv4TransformationsPlugin.php | 2 +- .../Abs/PreApPendTransformationsPlugin.php | 2 +- .../RegexValidationTransformationsPlugin.php | 2 +- .../Abs/SQLTransformationsPlugin.php | 2 +- .../Abs/SubstringTransformationsPlugin.php | 2 +- .../TextFileUploadTransformationsPlugin.php | 20 +- .../TextImageLinkTransformationsPlugin.php | 2 +- .../Abs/TextLinkTransformationsPlugin.php | 2 +- .../Input/Text_Plain_Iptobinary.php | 20 +- .../Input/Text_Plain_Iptolong.php | 20 +- .../Output/Text_Plain_Binarytoip.php | 2 +- .../Output/Text_Plain_Json.php | 2 +- .../Transformations/Output/Text_Plain_Xml.php | 2 +- .../classes/Plugins/TransformationsPlugin.php | 4 +- .../Options/OptionsPropertyOneItem.php | 5 +- .../MariaDbMySqlKbsProvider.php | 1 + .../ServerVariablesProviderInterface.php | 1 + .../ServerVariables/VoidProvider.php | 1 + libraries/classes/Query/Cache.php | 11 +- libraries/classes/Query/Compatibility.php | 11 +- libraries/classes/Query/Utilities.php | 8 +- libraries/classes/RecentFavoriteTable.php | 6 +- libraries/classes/Replication/Replication.php | 16 +- .../classes/Replication/ReplicationGui.php | 2 +- .../classes/Replication/ReplicationInfo.php | 21 +- libraries/classes/ResponseRenderer.php | 8 +- libraries/classes/Sanitize.php | 2 +- libraries/classes/SavedSearches.php | 6 +- libraries/classes/Server/Plugin.php | 4 +- libraries/classes/Server/Plugins.php | 2 +- libraries/classes/Server/Privileges.php | 92 +- libraries/classes/Server/Status/Data.php | 42 +- libraries/classes/Server/Status/Monitor.php | 46 +- libraries/classes/Server/Status/Processes.php | 1 + libraries/classes/Session.php | 2 +- libraries/classes/Setup/ConfigGenerator.php | 8 +- libraries/classes/Setup/Index.php | 2 +- libraries/classes/Sql.php | 50 +- libraries/classes/SqlQueryForm.php | 2 +- libraries/classes/StorageEngine.php | 8 +- libraries/classes/Table.php | 126 +- libraries/classes/Table/ColumnsDefinition.php | 8 +- libraries/classes/Template.php | 4 +- libraries/classes/Theme/ThemeManager.php | 1 + libraries/classes/Tracking/Tracker.php | 14 +- libraries/classes/Tracking/Tracking.php | 116 +- libraries/classes/Transformations.php | 2 +- libraries/classes/TwoFactor.php | 5 +- libraries/classes/Url.php | 16 +- libraries/classes/UserPassword.php | 2 +- libraries/classes/UserPreferences.php | 12 +- libraries/classes/Util.php | 22 +- libraries/classes/Utils/HttpRequest.php | 4 +- libraries/classes/VersionInformation.php | 4 +- libraries/classes/WebAuthn/CustomServer.php | 4 + .../classes/WebAuthn/WebauthnLibServer.php | 4 + libraries/classes/ZipExtension.php | 6 +- phpcs.xml.dist | 9 - phpstan-baseline.neon | 8590 ++++++++--------- psalm-baseline.xml | 300 +- test/classes/AbstractTestCase.php | 3 +- test/classes/Advisory/AdvisorTest.php | 6 +- test/classes/CacheTest.php | 2 +- .../classes/Command/SetVersionCommandTest.php | 4 +- test/classes/ConfigTest.php | 32 +- test/classes/DatabaseInterfaceTest.php | 20 +- test/classes/Display/ResultsTest.php | 74 +- test/classes/Engines/PbxtTest.php | 6 +- test/classes/ErrorReportTest.php | 6 +- test/classes/ErrorTest.php | 2 +- test/classes/FooterTest.php | 2 +- test/classes/HeaderTest.php | 1 + test/classes/Html/GeneratorTest.php | 10 +- .../Http/Factory/ServerRequestFactoryTest.php | 1 + test/classes/ImportTest.php | 18 +- test/classes/IndexTest.php | 2 +- test/classes/IpAllowDenyTest.php | 2 +- test/classes/LanguageTest.php | 2 +- test/classes/MessageTest.php | 8 +- test/classes/MimeTest.php | 2 +- .../Navigation/Nodes/NodeTableTest.php | 2 +- test/classes/OperationsTest.php | 6 +- .../Plugins/Auth/AuthenticationCookieTest.php | 16 +- .../Export/Helpers/TablePropertyTest.php | 8 +- test/classes/Plugins/Import/ImportOdsTest.php | 1 + test/classes/PluginsTest.php | 2 +- test/classes/Query/CompatibilityTest.php | 4 +- test/classes/SanitizeTest.php | 6 +- test/classes/Server/SelectTest.php | 1 + test/classes/SqlTest.php | 7 +- test/classes/StorageEngineTest.php | 2 +- test/classes/Table/ColumnsDefinitionTest.php | 2 +- test/classes/TemplateTest.php | 14 +- test/classes/Theme/ThemeTest.php | 2 +- test/classes/Tracking/TrackerTest.php | 10 +- test/classes/TransformationsTest.php | 9 +- test/classes/TwoFactorTest.php | 5 +- test/classes/UtilTest.php | 44 +- test/classes/Utils/ForeignKeyTest.php | 6 +- test/classes/Utils/FormatConverterTest.php | 6 +- test/classes/Utils/GisTest.php | 9 +- test/classes/Utils/HttpRequestTest.php | 2 + test/classes/VersionInformationTest.php | 2 + 258 files changed, 6323 insertions(+), 6631 deletions(-) diff --git a/libraries/classes/Advisory/Advisor.php b/libraries/classes/Advisory/Advisor.php index 445b2df31c..d75855fb85 100644 --- a/libraries/classes/Advisory/Advisor.php +++ b/libraries/classes/Advisory/Advisor.php @@ -31,10 +31,10 @@ use function vsprintf; */ class Advisor { - /** @var array */ + /** @var mixed[] */ private array $variables = []; - /** @var array */ + /** @var mixed[] */ private array $globals = []; /** @@ -43,7 +43,7 @@ class Advisor */ private array $rules = []; - /** @var array{fired:array, notfired:array, unchecked:array, errors:array} */ + /** @var array{fired:mixed[], notfired:mixed[], unchecked:mixed[], errors:mixed[]} */ private array $runResult = ['fired' => [], 'notfired' => [], 'unchecked' => [], 'errors' => []]; public function __construct(private DatabaseInterface $dbi, private ExpressionLanguage $expression) @@ -151,13 +151,13 @@ class Advisor $this->rules = array_merge($genericRules, $extraRules); } - /** @return array{fired: array, notfired: array, unchecked: array, errors: array} */ + /** @return array{fired: mixed[], notfired: mixed[], unchecked: mixed[], errors: mixed[]} */ public function getRunResult(): array { return $this->runResult; } - /** @psalm-return array{fired:array, notfired:array, unchecked:array, errors:array} */ + /** @psalm-return array{fired:mixed[], notfired:mixed[], unchecked:mixed[], errors:mixed[]} */ public function run(): array { $this->setVariables(); @@ -249,8 +249,8 @@ class Advisor /** * Adds a rule to the result list * - * @param string $type type of rule - * @param array $rule rule itself + * @param string $type type of rule + * @param mixed[] $rule rule itself * @psalm-param 'notfired'|'fired'|'unchecked'|'errors' $type */ public function addRule(string $type, array $rule): void @@ -302,7 +302,7 @@ class Advisor /** * Callback for wrapping links with Core::linkURL * - * @param array $matches List of matched elements form preg_replace_callback + * @param mixed[] $matches List of matched elements form preg_replace_callback * * @return string Replacement value */ @@ -314,7 +314,7 @@ class Advisor /** * Callback for wrapping variable edit links * - * @param array $matches List of matched elements form preg_replace_callback + * @param mixed[] $matches List of matched elements form preg_replace_callback * * @return string Replacement value */ diff --git a/libraries/classes/Bookmark.php b/libraries/classes/Bookmark.php index 5c5a27de53..661942ea11 100644 --- a/libraries/classes/Bookmark.php +++ b/libraries/classes/Bookmark.php @@ -144,7 +144,7 @@ class Bookmark /** * Replace the placeholders in the bookmark query with variables * - * @param array $variables + * @param mixed[] $variables * * @return string query with variables applied */ @@ -175,8 +175,8 @@ class Bookmark /** * Creates a Bookmark object from the parameters * - * @param array $bkmFields the properties of the bookmark to add; here, $bkm_fields['bkm_sql_query'] is urlencoded - * @param bool $allUsers whether to make the bookmark available for all users + * @param mixed[] $bkmFields the properties of the bookmark to add; here, $bkm_fields['bkm_sql_query'] is urlencoded + * @param bool $allUsers whether to make the bookmark available for all users */ public static function createBookmark( DatabaseInterface $dbi, @@ -200,7 +200,7 @@ class Bookmark return $bookmark; } - /** @param array $row Resource used to build the bookmark */ + /** @param mixed[] $row Resource used to build the bookmark */ protected static function createFromRow(DatabaseInterface $dbi, array $row): Bookmark { $bookmark = new Bookmark($dbi, new Relation($dbi)); diff --git a/libraries/classes/BrowseForeigners.php b/libraries/classes/BrowseForeigners.php index ad401c17e6..6e6b14e8a1 100644 --- a/libraries/classes/BrowseForeigners.php +++ b/libraries/classes/BrowseForeigners.php @@ -35,15 +35,15 @@ class BrowseForeigners /** * Function to get html for one relational key * - * @param int $horizontalCount the current horizontal count - * @param string $header table header - * @param array $keys all the keys - * @param int $indexByKeyname index by keyname - * @param array $descriptions descriptions - * @param int $indexByDescription index by description - * @param string $currentValue current value on the edit form + * @param int $horizontalCount the current horizontal count + * @param string $header table header + * @param mixed[] $keys all the keys + * @param int $indexByKeyname index by keyname + * @param mixed[] $descriptions descriptions + * @param int $indexByDescription index by description + * @param string $currentValue current value on the edit form * - * @return array the generated html + * @return mixed[] the generated html */ private function getHtmlForOneKey( int $horizontalCount, @@ -135,7 +135,7 @@ class BrowseForeigners * @param string $db current database * @param string $table current table * @param string $field field - * @param array $foreignData foreign column data + * @param mixed[] $foreignData foreign column data * @param string|null $fieldKey field key * @param string $currentValue current columns's value */ @@ -262,7 +262,7 @@ class BrowseForeigners /** * Function to get html for the goto page option * - * @param array|null $foreignData foreign data + * @param mixed[]|null $foreignData foreign data */ private function getHtmlForGotoPage(array|null $foreignData): string { diff --git a/libraries/classes/Command/TwigLintCommand.php b/libraries/classes/Command/TwigLintCommand.php index 1e26fe11c3..8d00248ed8 100644 --- a/libraries/classes/Command/TwigLintCommand.php +++ b/libraries/classes/Command/TwigLintCommand.php @@ -67,6 +67,7 @@ class TwigLintCommand extends Command $this->addOption('show-deprecations', null, InputOption::VALUE_NONE, 'Show deprecations as errors'); } + /** @return mixed[] */ protected function findFiles(string $baseFolder): array { /* Open the handle */ @@ -135,6 +136,7 @@ class TwigLintCommand extends Command return $this->display($output, $io, $filesInfo); } + /** @return mixed[] */ protected function getFilesInfo(string $templatesPath): array { $filesInfo = []; @@ -154,6 +156,7 @@ class TwigLintCommand extends Command return (string) file_get_contents($filePath); } + /** @return mixed[] */ private function validate(string $template, string $file): array { $twig = Template::getTwigEnvironment(null); @@ -180,6 +183,7 @@ class TwigLintCommand extends Command return ['template' => $template, 'file' => $file, 'valid' => true]; } + /** @param mixed[] $filesInfo */ private function display(OutputInterface $output, SymfonyStyle $io, array $filesInfo): int { $errors = 0; @@ -247,6 +251,7 @@ class TwigLintCommand extends Command } } + /** @return mixed[] */ private function getContext(string $template, int $line, int $context = 3): array { $lines = explode("\n", $template); diff --git a/libraries/classes/Config.php b/libraries/classes/Config.php index 4b16893f52..ab740fa48c 100644 --- a/libraries/classes/Config.php +++ b/libraries/classes/Config.php @@ -73,13 +73,13 @@ use const PHP_URL_SCHEME; */ class Config { - /** @var array default configuration settings */ + /** @var mixed[] default configuration settings */ public array $default = []; - /** @var array configuration settings, without user preferences applied */ + /** @var mixed[] configuration settings, without user preferences applied */ public array $baseSettings = []; - /** @var array configuration settings */ + /** @var mixed[] configuration settings */ public array $settings = []; /** @var string config source */ @@ -90,7 +90,7 @@ class Config public bool $errorConfigFile = false; - /** @var array */ + /** @var mixed[] */ public array $defaultServer = []; private bool $isHttps; @@ -1191,11 +1191,11 @@ class Config /** * Return connection parameters for the database server * - * @param int $mode Connection mode. - * @param array|null $server Server information like host/port/socket/persistent + * @param int $mode Connection mode. + * @param mixed[]|null $server Server information like host/port/socket/persistent * @psalm-param ConnectionType $mode * - * @return array user, host and server settings array + * @return mixed[] user, host and server settings array */ public static function getConnectionParams(int $mode, array|null $server = null): array { diff --git a/libraries/classes/Config/ConfigFile.php b/libraries/classes/Config/ConfigFile.php index 76f7d8aedc..b45dbf5610 100644 --- a/libraries/classes/Config/ConfigFile.php +++ b/libraries/classes/Config/ConfigFile.php @@ -29,6 +29,8 @@ class ConfigFile * Stores default phpMyAdmin config * * @see Settings + * + * @var mixed[] */ private array $defaultCfg; @@ -41,6 +43,8 @@ class ConfigFile /** * Stores original PMA config, not modified by user preferences + * + * @var mixed[]|null */ private array|null $baseCfg = null; @@ -52,7 +56,7 @@ class ConfigFile /** * Keys which will be always written to config file * - * @var array + * @var mixed[] */ private array $persistKeys = []; @@ -60,7 +64,7 @@ class ConfigFile * Changes keys while updating config in {@link updateWithGlobalConfig()} * or reading by {@link getConfig()} or {@link getConfigArray()} * - * @var array + * @var mixed[] */ private array $cfgUpdateReadMapping = []; @@ -76,7 +80,7 @@ class ConfigFile private string $id; /** - * @param array|null $baseConfig base configuration read from + * @param mixed[]|null $baseConfig base configuration read from * {@link PhpMyAdmin\Config::$base_config}, * use only when not in PMA Setup */ @@ -103,7 +107,7 @@ class ConfigFile * Sets names of config options which will be placed in config file even if * they are set to their default values (use only full paths) * - * @param array $keys the names of the config options + * @param mixed[] $keys the names of the config options */ public function setPersistKeys(array $keys): void { @@ -115,7 +119,7 @@ class ConfigFile /** * Returns flipped array set by {@link setPersistKeys()} * - * @return array + * @return mixed[] */ public function getPersistKeysMap(): array { @@ -126,7 +130,7 @@ class ConfigFile * By default ConfigFile allows setting of all configuration keys, use * this method to set up a filter on {@link set()} method * - * @param array|null $keys array of allowed keys or null to remove filter + * @param mixed[]|null $keys array of allowed keys or null to remove filter */ public function setAllowedKeys(array|null $keys): void { @@ -146,7 +150,7 @@ class ConfigFile * {@link updateWithGlobalConfig()} or reading * by {@link getConfig()} or {@link getConfigArray()} * - * @param array $mapping Contains the mapping of "Server/config options" + * @param mixed[] $mapping Contains the mapping of "Server/config options" * to "Server/1/config options" */ public function setCfgUpdateReadMapping(array $mapping): void @@ -165,7 +169,7 @@ class ConfigFile /** * Sets configuration data (overrides old data) * - * @param array $cfg Configuration options + * @param mixed[] $cfg Configuration options */ public function setConfigData(array $cfg): void { @@ -222,8 +226,10 @@ class ConfigFile * Flattens multidimensional array, changes indices to paths * (eg. 'key/subkey'). * - * @param array $array Multidimensional array - * @param string $prefix Prefix + * @param mixed[] $array Multidimensional array + * @param string $prefix Prefix + * + * @return mixed[] */ private function getFlatArray(array $array, string $prefix = ''): array { @@ -241,6 +247,8 @@ class ConfigFile /** * Returns default config in a flattened array + * + * @return mixed[] */ public function getFlatDefaultConfig(): array { @@ -251,7 +259,7 @@ class ConfigFile * Updates config with values read from given array * (config will contain differences to defaults from {@see \PhpMyAdmin\Config\Settings}). * - * @param array $cfg Configuration + * @param mixed[] $cfg Configuration */ public function updateWithGlobalConfig(array $cfg): void { @@ -346,7 +354,7 @@ class ConfigFile /** * Returns server list * - * @return array + * @return mixed[] */ public function getServers(): array { @@ -438,7 +446,7 @@ class ConfigFile /** * Returns configuration array (full, multidimensional format) * - * @return array + * @return mixed[] */ public function getConfig(): array { @@ -459,7 +467,7 @@ class ConfigFile /** * Returns configuration array (flat format) * - * @return array + * @return mixed[] */ public function getConfigArray(): array { diff --git a/libraries/classes/Config/Form.php b/libraries/classes/Config/Form.php index af62b57670..f3fc50417a 100644 --- a/libraries/classes/Config/Form.php +++ b/libraries/classes/Config/Form.php @@ -44,21 +44,21 @@ class Form /** * Form fields (paths), filled by {@link readFormPaths()}, indexed by field name * - * @var array + * @var mixed[] */ public array $fields; /** * Stores default values for some fields (eg. pmadb tables) * - * @var array + * @var mixed[] */ public array $default; /** * Caches field types, indexed by field names * - * @var array + * @var mixed[] */ private array $fieldsTypes; @@ -76,7 +76,7 @@ class Form * Reads default config values * * @param string $formName Form name - * @param array $form Form data + * @param mixed[] $form Form data * @param ConfigFile $cf Config file instance * @param int|null $index arbitrary index, stored in Form::$index */ @@ -116,7 +116,7 @@ class Form * * @param string $optionPath Option path * - * @return array + * @return mixed[] */ public function getOptionValueList(string $optionPath): array { @@ -210,7 +210,7 @@ class Form /** * Reads form paths to {@link $fields} * - * @param array $form Form + * @param mixed[] $form Form */ protected function readFormPaths(array $form): void { @@ -265,9 +265,9 @@ class Form * * @see issue #15836 * - * @param array $form The form data + * @param mixed[] $form The form data * - * @return array + * @return mixed[] */ protected function cleanGroupPaths(array $form): array { @@ -290,8 +290,8 @@ class Form * Reads form settings and prepares class to work with given subset of * config file * - * @param string $formName Form name - * @param array $form Form + * @param string $formName Form name + * @param mixed[] $form Form */ public function loadForm(string $formName, array $form): void { diff --git a/libraries/classes/Config/FormDisplay.php b/libraries/classes/Config/FormDisplay.php index 79383e0e9d..b8b6e2a14c 100644 --- a/libraries/classes/Config/FormDisplay.php +++ b/libraries/classes/Config/FormDisplay.php @@ -63,14 +63,14 @@ class FormDisplay * [ Form_name ] is an array of form errors * [path] is a string storing error associated with single field * - * @var array + * @var mixed[] */ private array $errors = []; /** * Paths changed so that they can be used as HTML ids, indexed by paths * - * @var array + * @var mixed[] */ private array $translatedPaths = []; @@ -78,7 +78,7 @@ class FormDisplay * Server paths change indexes so we define maps from current server * path to the first one, indexed by work path * - * @var array + * @var mixed[] */ private array $systemPaths = []; @@ -95,7 +95,7 @@ class FormDisplay /** * Dictionary with disallowed user preferences keys * - * @var array + * @var mixed[] */ private array $userprefsDisallow = []; @@ -125,7 +125,7 @@ class FormDisplay * Registers form in form manager * * @param string $formName Form name - * @param array $form Form data + * @param mixed[] $form Form data * @param int|null $serverId 0 if new server, validation; >= 1 if editing a server */ public function registerForm(string $formName, array $form, int|null $serverId = null): void @@ -207,10 +207,10 @@ class FormDisplay /** * Outputs HTML for forms * - * @param bool $showButtons whether show submit and reset button - * @param string|null $formAction action attribute for the form - * @param array|null $hiddenFields array of form hidden fields (key: field - * name) + * @param bool $showButtons whether show submit and reset button + * @param string|null $formAction action attribute for the form + * @param mixed[]|null $hiddenFields array of form hidden fields (key: field + * name) * * @return string HTML for forms */ @@ -318,8 +318,8 @@ class FormDisplay * @param bool|null $userPrefsAllow whether user preferences are enabled * for this field (null - no support, * true/false - enabled/disabled) - * @param array $jsDefault array which stores JavaScript code - * to be displayed + * @param mixed[] $jsDefault array which stores JavaScript code + * to be displayed * * @return string|null HTML for input field */ @@ -512,7 +512,7 @@ class FormDisplay * Validates select field and casts $value to correct type * * @param string|bool $value Current value - * @param array $allowed List of allowed values + * @param mixed[] $allowed List of allowed values */ private function validateSelect(string|bool &$value, array $allowed): bool { @@ -761,8 +761,8 @@ class FormDisplay /** * Sets field comments and warnings based on current environment * - * @param string $systemPath Path to settings - * @param array $opts Chosen options + * @param string $systemPath Path to settings + * @param mixed[] $opts Chosen options */ private function setComments(string $systemPath, array &$opts): void { @@ -839,8 +839,8 @@ class FormDisplay /** * Copy items of an array to $_POST variable * - * @param array $postValues List of parameters - * @param string $key Array key + * @param mixed[] $postValues List of parameters + * @param string $key Array key */ private function fillPostArrayParameters(array $postValues, string $key): void { diff --git a/libraries/classes/Config/FormDisplayTemplate.php b/libraries/classes/Config/FormDisplayTemplate.php index 589a14a7b7..a1a2fd54b1 100644 --- a/libraries/classes/Config/FormDisplayTemplate.php +++ b/libraries/classes/Config/FormDisplayTemplate.php @@ -47,13 +47,13 @@ class FormDisplayTemplate * o comment - (string) tooltip comment * o comment_warning - (bool) whether this comments warns about something * - * @param string $path config option path - * @param string $name config option name - * @param string $type type of config option - * @param mixed $value current value - * @param string $description verbose description - * @param bool $valueIsDefault whether value is default - * @param array|null $opts see above description + * @param string $path config option path + * @param string $name config option name + * @param string $type type of config option + * @param mixed $value current value + * @param string $description verbose description + * @param bool $valueIsDefault whether value is default + * @param mixed[]|null $opts see above description */ public function displayInput( string $path, @@ -127,9 +127,9 @@ class FormDisplayTemplate /** * Appends JS validation code to $js_array * - * @param string $fieldId ID of field to validate - * @param string|array $validators validators callback - * @param array $jsArray will be updated with javascript code + * @param string $fieldId ID of field to validate + * @param string|mixed[] $validators validators callback + * @param mixed[] $jsArray will be updated with javascript code */ public function addJsValidate(string $fieldId, string|array $validators, array &$jsArray): void { @@ -145,8 +145,8 @@ class FormDisplayTemplate /** * Displays error list * - * @param string $name Name of item with errors - * @param array $errorList List of errors to show + * @param string $name Name of item with errors + * @param mixed[] $errorList List of errors to show * * @return string HTML for errors */ @@ -155,6 +155,7 @@ class FormDisplayTemplate return $this->template->render('config/form_display/errors', ['name' => $name, 'error_list' => $errorList]); } + /** @param mixed[] $data */ public function display(array $data): string { return $this->template->render('config/form_display/display', $data); diff --git a/libraries/classes/Config/Forms/BaseForm.php b/libraries/classes/Config/Forms/BaseForm.php index b761300497..b51d9a9eb3 100644 --- a/libraries/classes/Config/Forms/BaseForm.php +++ b/libraries/classes/Config/Forms/BaseForm.php @@ -47,7 +47,7 @@ abstract class BaseForm extends FormDisplay * End group blocks with: * ':group:end' * - * @return array + * @return mixed[] * * @todo This should be abstract, but that does not work in PHP 5 */ diff --git a/libraries/classes/Config/Forms/Page/BrowseForm.php b/libraries/classes/Config/Forms/Page/BrowseForm.php index a4e8d7ca17..d12352ea2e 100644 --- a/libraries/classes/Config/Forms/Page/BrowseForm.php +++ b/libraries/classes/Config/Forms/Page/BrowseForm.php @@ -12,7 +12,7 @@ use PhpMyAdmin\Config\Forms\User\MainForm; class BrowseForm extends BaseForm { - /** @return array */ + /** @return mixed[] */ public static function getForms(): array { return ['Browse' => MainForm::getForms()['Browse']]; diff --git a/libraries/classes/Config/Forms/Page/DbStructureForm.php b/libraries/classes/Config/Forms/Page/DbStructureForm.php index 84e49d8009..25bc25ba0d 100644 --- a/libraries/classes/Config/Forms/Page/DbStructureForm.php +++ b/libraries/classes/Config/Forms/Page/DbStructureForm.php @@ -12,7 +12,7 @@ use PhpMyAdmin\Config\Forms\User\MainForm; class DbStructureForm extends BaseForm { - /** @return array */ + /** @return mixed[] */ public static function getForms(): array { return ['DbStructure' => MainForm::getForms()['DbStructure']]; diff --git a/libraries/classes/Config/Forms/Page/EditForm.php b/libraries/classes/Config/Forms/Page/EditForm.php index 5dd9d18351..f3f1f2eec6 100644 --- a/libraries/classes/Config/Forms/Page/EditForm.php +++ b/libraries/classes/Config/Forms/Page/EditForm.php @@ -13,7 +13,7 @@ use PhpMyAdmin\Config\Forms\User\MainForm; class EditForm extends BaseForm { - /** @return array */ + /** @return mixed[] */ public static function getForms(): array { return ['Edit' => MainForm::getForms()['Edit'], 'Text_fields' => FeaturesForm::getForms()['Text_fields']]; diff --git a/libraries/classes/Config/Forms/Page/TableStructureForm.php b/libraries/classes/Config/Forms/Page/TableStructureForm.php index 72181f842e..81c891be8e 100644 --- a/libraries/classes/Config/Forms/Page/TableStructureForm.php +++ b/libraries/classes/Config/Forms/Page/TableStructureForm.php @@ -12,7 +12,7 @@ use PhpMyAdmin\Config\Forms\User\MainForm; class TableStructureForm extends BaseForm { - /** @return array */ + /** @return mixed[] */ public static function getForms(): array { return ['TableStructure' => MainForm::getForms()['TableStructure']]; diff --git a/libraries/classes/Config/Forms/Setup/ConfigForm.php b/libraries/classes/Config/Forms/Setup/ConfigForm.php index ead35cfbd7..e5844139cd 100644 --- a/libraries/classes/Config/Forms/Setup/ConfigForm.php +++ b/libraries/classes/Config/Forms/Setup/ConfigForm.php @@ -11,7 +11,7 @@ use PhpMyAdmin\Config\Forms\BaseForm; class ConfigForm extends BaseForm { - /** @return array */ + /** @return mixed[] */ public static function getForms(): array { return ['Config' => ['DefaultLang', 'ServerDefault']]; diff --git a/libraries/classes/Config/Forms/Setup/FeaturesForm.php b/libraries/classes/Config/Forms/Setup/FeaturesForm.php index fb367accdc..f569e594eb 100644 --- a/libraries/classes/Config/Forms/Setup/FeaturesForm.php +++ b/libraries/classes/Config/Forms/Setup/FeaturesForm.php @@ -11,7 +11,7 @@ use function array_diff; class FeaturesForm extends \PhpMyAdmin\Config\Forms\User\FeaturesForm { - /** @return array */ + /** @return mixed[] */ public static function getForms(): array { // phpcs:disable Squiz.Arrays.ArrayDeclaration.KeySpecified,Squiz.Arrays.ArrayDeclaration.NoKeySpecified diff --git a/libraries/classes/Config/Forms/Setup/MainForm.php b/libraries/classes/Config/Forms/Setup/MainForm.php index dcd5967686..d4fe5d7490 100644 --- a/libraries/classes/Config/Forms/Setup/MainForm.php +++ b/libraries/classes/Config/Forms/Setup/MainForm.php @@ -9,7 +9,7 @@ namespace PhpMyAdmin\Config\Forms\Setup; class MainForm extends \PhpMyAdmin\Config\Forms\User\MainForm { - /** @return array */ + /** @return mixed[] */ public static function getForms(): array { $result = parent::getForms(); diff --git a/libraries/classes/Config/Forms/Setup/ServersForm.php b/libraries/classes/Config/Forms/Setup/ServersForm.php index 881bee3659..94f3b30d9a 100644 --- a/libraries/classes/Config/Forms/Setup/ServersForm.php +++ b/libraries/classes/Config/Forms/Setup/ServersForm.php @@ -13,7 +13,7 @@ use function __; class ServersForm extends BaseForm { - /** @return array */ + /** @return mixed[] */ public static function getForms(): array { // phpcs:disable Squiz.Arrays.ArrayDeclaration.KeySpecified,Squiz.Arrays.ArrayDeclaration.NoKeySpecified diff --git a/libraries/classes/Config/Forms/Setup/SqlForm.php b/libraries/classes/Config/Forms/Setup/SqlForm.php index 3a10a11a0a..f36f855daf 100644 --- a/libraries/classes/Config/Forms/Setup/SqlForm.php +++ b/libraries/classes/Config/Forms/Setup/SqlForm.php @@ -9,7 +9,7 @@ namespace PhpMyAdmin\Config\Forms\Setup; class SqlForm extends \PhpMyAdmin\Config\Forms\User\SqlForm { - /** @return array */ + /** @return mixed[] */ public static function getForms(): array { $result = parent::getForms(); diff --git a/libraries/classes/Config/Forms/User/ExportForm.php b/libraries/classes/Config/Forms/User/ExportForm.php index d8be44e9d4..237a84fdaa 100644 --- a/libraries/classes/Config/Forms/User/ExportForm.php +++ b/libraries/classes/Config/Forms/User/ExportForm.php @@ -13,7 +13,7 @@ use function __; class ExportForm extends BaseForm { - /** @return array */ + /** @return mixed[] */ public static function getForms(): array { // phpcs:disable Squiz.Arrays.ArrayDeclaration.KeySpecified,Squiz.Arrays.ArrayDeclaration.NoKeySpecified diff --git a/libraries/classes/Config/Forms/User/FeaturesForm.php b/libraries/classes/Config/Forms/User/FeaturesForm.php index c7afe7c18c..f0de0a8398 100644 --- a/libraries/classes/Config/Forms/User/FeaturesForm.php +++ b/libraries/classes/Config/Forms/User/FeaturesForm.php @@ -13,7 +13,7 @@ use function __; class FeaturesForm extends BaseForm { - /** @return array */ + /** @return mixed[] */ public static function getForms(): array { $result = [ diff --git a/libraries/classes/Config/Forms/User/ImportForm.php b/libraries/classes/Config/Forms/User/ImportForm.php index c601eff65a..c7614c90cd 100644 --- a/libraries/classes/Config/Forms/User/ImportForm.php +++ b/libraries/classes/Config/Forms/User/ImportForm.php @@ -13,7 +13,7 @@ use function __; class ImportForm extends BaseForm { - /** @return array */ + /** @return mixed[] */ public static function getForms(): array { return [ diff --git a/libraries/classes/Config/Forms/User/MainForm.php b/libraries/classes/Config/Forms/User/MainForm.php index 938032076e..40dac4a3ad 100644 --- a/libraries/classes/Config/Forms/User/MainForm.php +++ b/libraries/classes/Config/Forms/User/MainForm.php @@ -13,7 +13,7 @@ use function __; class MainForm extends BaseForm { - /** @return array */ + /** @return mixed[] */ public static function getForms(): array { return [ diff --git a/libraries/classes/Config/Forms/User/NaviForm.php b/libraries/classes/Config/Forms/User/NaviForm.php index 0f5c7c107b..100f870800 100644 --- a/libraries/classes/Config/Forms/User/NaviForm.php +++ b/libraries/classes/Config/Forms/User/NaviForm.php @@ -13,7 +13,7 @@ use function __; class NaviForm extends BaseForm { - /** @return array */ + /** @return mixed[] */ public static function getForms(): array { return [ diff --git a/libraries/classes/Config/Forms/User/SqlForm.php b/libraries/classes/Config/Forms/User/SqlForm.php index 509bfce65a..0985041b4f 100644 --- a/libraries/classes/Config/Forms/User/SqlForm.php +++ b/libraries/classes/Config/Forms/User/SqlForm.php @@ -13,7 +13,7 @@ use function __; class SqlForm extends BaseForm { - /** @return array */ + /** @return mixed[] */ public static function getForms(): array { return [ diff --git a/libraries/classes/Config/Validator.php b/libraries/classes/Config/Validator.php index 42b14429b4..30bae1a7b2 100644 --- a/libraries/classes/Config/Validator.php +++ b/libraries/classes/Config/Validator.php @@ -60,7 +60,7 @@ class Validator * * @param ConfigFile $cf Config file instance * - * @return array + * @return mixed[] */ public static function getValidators(ConfigFile $cf): array { @@ -116,11 +116,11 @@ 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 string|array $validatorId ID of validator(s) to run - * @param array $values Values to validate - * @param bool $isPostSource tells whether $values are directly from - * POST request + * @param ConfigFile $cf Config file instance + * @param string|mixed[] $validatorId ID of validator(s) to run + * @param mixed[] $values Values to validate + * @param bool $isPostSource tells whether $values are directly from + * POST request */ public static function validate( ConfigFile $cf, @@ -255,12 +255,12 @@ class Validator /** * Validate server config * - * @param string $path path to config, not used - * keep this parameter since the method is invoked using - * reflection along with other similar methods - * @param array $values config values + * @param string $path path to config, not used + * keep this parameter since the method is invoked using + * reflection along with other similar methods + * @param mixed[] $values config values * - * @return array + * @return mixed[] */ public static function validateServer(string $path, array $values): array { @@ -322,12 +322,12 @@ class Validator /** * Validate pmadb config * - * @param string $path path to config, not used - * keep this parameter since the method is invoked using - * reflection along with other similar methods - * @param array $values config values + * @param string $path path to config, not used + * keep this parameter since the method is invoked using + * reflection along with other similar methods + * @param mixed[] $values config values * - * @return array + * @return mixed[] */ public static function validatePMAStorage(string $path, array $values): array { @@ -377,10 +377,10 @@ class Validator /** * Validates regular expression * - * @param string $path path to config - * @param array $values config values + * @param string $path path to config + * @param mixed[] $values config values * - * @return array + * @return mixed[] */ public static function validateRegex(string $path, array $values): array { @@ -411,10 +411,10 @@ class Validator /** * Validates TrustedProxies field * - * @param string $path path to config - * @param array $values config values + * @param string $path path to config + * @param mixed[] $values config values * - * @return array + * @return mixed[] */ public static function validateTrustedProxies(string $path, array $values): array { @@ -465,12 +465,12 @@ class Validator /** * Tests integer value * - * @param string $path path to config - * @param array $values config values - * @param bool $allowNegative allow negative values - * @param bool $allowZero allow zero - * @param int $maxValue max allowed value - * @param string $errorString error message string + * @param string $path path to config + * @param mixed[] $values config values + * @param bool $allowNegative allow negative values + * @param bool $allowZero allow zero + * @param int $maxValue max allowed value + * @param string $errorString error message string * * @return string empty string if test is successful */ @@ -503,10 +503,10 @@ class Validator /** * Validates port number * - * @param string $path path to config - * @param array $values config values + * @param string $path path to config + * @param mixed[] $values config values * - * @return array + * @return mixed[] */ public static function validatePortNumber(string $path, array $values): array { @@ -525,10 +525,10 @@ class Validator /** * Validates positive number * - * @param string $path path to config - * @param array $values config values + * @param string $path path to config + * @param mixed[] $values config values * - * @return array + * @return mixed[] */ public static function validatePositiveNumber(string $path, array $values): array { @@ -547,10 +547,10 @@ class Validator /** * Validates non-negative number * - * @param string $path path to config - * @param array $values config values + * @param string $path path to config + * @param mixed[] $values config values * - * @return array + * @return mixed[] */ public static function validateNonNegativeNumber(string $path, array $values): array { @@ -570,9 +570,9 @@ class Validator * Validates value according to given regular expression * Pattern and modifiers must be a valid for PCRE and JavaScript RegExp * - * @param string $path path to config - * @param array $values config values - * @param string $regex regular expression to match + * @param string $path path to config + * @param mixed[] $values config values + * @param string $regex regular expression to match */ public static function validateByRegex(string $path, array $values, string $regex): array|string { @@ -588,11 +588,11 @@ class Validator /** * Validates upper bound for numeric inputs * - * @param string $path path to config - * @param array $values config values - * @param int $maxValue maximal allowed value + * @param string $path path to config + * @param mixed[] $values config values + * @param int $maxValue maximal allowed value * - * @return array + * @return mixed[] */ public static function validateUpperBound(string $path, array $values, int $maxValue): array { diff --git a/libraries/classes/ConfigStorage/Relation.php b/libraries/classes/ConfigStorage/Relation.php index 563c7c00df..557863994d 100644 --- a/libraries/classes/ConfigStorage/Relation.php +++ b/libraries/classes/ConfigStorage/Relation.php @@ -397,7 +397,7 @@ class Relation * @param string $column the name of the column to check for * @param string $source the source for foreign key information * - * @return array db,table,column + * @return mixed[] db,table,column */ public function getForeigners(string $db, string $table, string $column = '', string $source = 'both'): array { @@ -521,7 +521,7 @@ class Relation * @param string $db the name of the db to check for * @param string $table the name of the table to check for * - * @return array [column_name] = comment + * @return mixed[] [column_name] = comment */ public function getComments(string $db, string $table = ''): array { @@ -575,7 +575,7 @@ class Relation /** * Gets the comment for a db * - * @return array comments + * @return mixed[] comments */ public function getDbComments(): array { @@ -693,7 +693,7 @@ class Relation * * @param string $username the username * - * @return array|bool list of history items + * @return mixed[]|bool list of history items */ public function getHistory(string $username): array|bool { @@ -769,9 +769,9 @@ class Relation /** * Prepares the dropdown for one mode * - * @param array $foreign the keys and values for foreigns - * @param string $data the current data of the dropdown - * @param string $mode the needed mode + * @param mixed[] $foreign the keys and values for foreigns + * @param string $data the current data of the dropdown + * @param string $mode the needed mode * * @return string[] the