diff --git a/examples/config.manyhosts.inc.php b/examples/config.manyhosts.inc.php index 8e93435d0d..c9022d3462 100644 --- a/examples/config.manyhosts.inc.php +++ b/examples/config.manyhosts.inc.php @@ -9,12 +9,7 @@ declare(strict_types=1); $i = 0; -$hosts = [ - 'foo.example.com', - 'bar.example.com', - 'baz.example.com', - 'quux.example.com', -]; +$hosts = ['foo.example.com', 'bar.example.com', 'baz.example.com', 'quux.example.com']; foreach ($hosts as $host) { $i++; diff --git a/examples/openid.php b/examples/openid.php index d149bf726e..91ce8406f0 100644 --- a/examples/openid.php +++ b/examples/openid.php @@ -24,12 +24,7 @@ $secureCookie = false; /** * Map of authenticated users to MySQL user/password pairs. */ -$authMap = [ - 'https://launchpad.net/~username' => [ - 'user' => 'root', - 'password' => '', - ], -]; +$authMap = ['https://launchpad.net/~username' => ['user' => 'root', 'password' => '']]; // phpcs:disable PSR1.Files.SideEffects,Squiz.Functions.GlobalFunction diff --git a/examples/signon-script.php b/examples/signon-script.php index 076eb97fea..0b27a0bbcf 100644 --- a/examples/signon-script.php +++ b/examples/signon-script.php @@ -24,15 +24,9 @@ function get_login_credentials($user): array { /* Optionally we can use passed username */ if (! empty($user)) { - return [ - $user, - 'password', - ]; + return [$user, 'password']; } /* Here we would retrieve the credentials */ - return [ - 'root', - '', - ]; + return ['root', '']; } diff --git a/libraries/classes/Advisory/Advisor.php b/libraries/classes/Advisory/Advisor.php index be3e372341..445b2df31c 100644 --- a/libraries/classes/Advisory/Advisor.php +++ b/libraries/classes/Advisory/Advisor.php @@ -44,12 +44,7 @@ class Advisor private array $rules = []; /** @var array{fired:array, notfired:array, unchecked:array, errors:array} */ - private array $runResult = [ - 'fired' => [], - 'notfired' => [], - 'unchecked' => [], - 'errors' => [], - ]; + private array $runResult = ['fired' => [], 'notfired' => [], 'unchecked' => [], 'errors' => []]; public function __construct(private DatabaseInterface $dbi, private ExpressionLanguage $expression) { @@ -191,12 +186,7 @@ class Advisor */ private function runRules(): void { - $this->runResult = [ - 'fired' => [], - 'notfired' => [], - 'unchecked' => [], - 'errors' => [], - ]; + $this->runResult = ['fired' => [], 'notfired' => [], 'unchecked' => [], 'errors' => []]; foreach ($this->rules as $rule) { $this->variables['value'] = 0; diff --git a/libraries/classes/BrowseForeigners.php b/libraries/classes/BrowseForeigners.php index 53826906ff..ad401c17e6 100644 --- a/libraries/classes/BrowseForeigners.php +++ b/libraries/classes/BrowseForeigners.php @@ -71,10 +71,7 @@ class BrowseForeigners // key names and descriptions for the left section, // sorted by key names $leftKeyname = $keys[$indexByKeyname]; - [ - $leftDescription, - $leftDescriptionTitle, - ] = $this->getDescriptionAndTitle($descriptions[$indexByKeyname]); + [$leftDescription, $leftDescriptionTitle] = $this->getDescriptionAndTitle($descriptions[$indexByKeyname]); // key names and descriptions for the right section, // sorted by descriptions @@ -129,11 +126,7 @@ class BrowseForeigners $output .= ''; - return [ - $output, - $horizontalCount, - $indexByDescription, - ]; + return [$output, $horizontalCount, $indexByDescription]; } /** @@ -230,11 +223,7 @@ class BrowseForeigners $indexByDescription = 0; foreach (array_keys($keys) as $indexByKeyname) { - [ - $html, - $horizontalCount, - $indexByDescription, - ] = $this->getHtmlForOneKey( + [$html, $horizontalCount, $indexByDescription] = $this->getHtmlForOneKey( $horizontalCount, $header, $keys, @@ -267,10 +256,7 @@ class BrowseForeigners $description = mb_substr($description, 0, $this->settings->limitChars) . '...'; } - return [ - $description, - $descriptionTitle, - ]; + return [$description, $descriptionTitle]; } /** diff --git a/libraries/classes/Charsets.php b/libraries/classes/Charsets.php index 1500830924..01c3bb96e1 100644 --- a/libraries/classes/Charsets.php +++ b/libraries/classes/Charsets.php @@ -167,10 +167,7 @@ class Charsets if (self::$serverCharset === null) {// Fallback in case nothing is found return Charset::fromServer( - [ - 'Charset' => __('Unknown'), - 'Description' => __('Unknown'), - ], + ['Charset' => __('Unknown'), 'Description' => __('Unknown')], ); } diff --git a/libraries/classes/CheckUserPrivileges.php b/libraries/classes/CheckUserPrivileges.php index 6924f6851d..f88aec2902 100644 --- a/libraries/classes/CheckUserPrivileges.php +++ b/libraries/classes/CheckUserPrivileges.php @@ -65,11 +65,7 @@ class CheckUserPrivileges ); $showGrantsTableName = Util::unQuote($showGrantsTableName, '`'); - return [ - $showGrantsString, - $showGrantsDbName, - $showGrantsTableName, - ]; + return [$showGrantsString, $showGrantsDbName, $showGrantsTableName]; } /** @@ -190,11 +186,7 @@ class CheckUserPrivileges $re1 = '(^|[^\\\\])(\\\)+'; // escaped wildcards while ($row = $showGrantsResult->fetchRow()) { - [ - $showGrantsString, - $showGrantsDbName, - $showGrantsTableName, - ] = $this->getItemsFromShowGrantsRow($row[0]); + [$showGrantsString, $showGrantsDbName, $showGrantsTableName] = $this->getItemsFromShowGrantsRow($row[0]); if ($showGrantsDbName === '*') { if ($showGrantsString !== 'USAGE') { diff --git a/libraries/classes/Config.php b/libraries/classes/Config.php index 88f6baf5d1..4b16893f52 100644 --- a/libraries/classes/Config.php +++ b/libraries/classes/Config.php @@ -1077,11 +1077,7 @@ class Config { // First try configured temp dir // Fallback to PHP upload_tmp_dir - $dirs = [ - $this->getTempDir('upload'), - ini_get('upload_tmp_dir'), - sys_get_temp_dir(), - ]; + $dirs = [$this->getTempDir('upload'), ini_get('upload_tmp_dir'), sys_get_temp_dir()]; foreach ($dirs as $dir) { if (! empty($dir) && @is_writable($dir)) { @@ -1262,11 +1258,7 @@ class Config } } else { if ($server === null) { - return [ - null, - null, - null, - ]; + return [null, null, null]; } if (isset($server['user'])) { @@ -1301,11 +1293,7 @@ class Config $server['hide_connection_errors'] = false; } - return [ - $user, - $password, - $server, - ]; + return [$user, $password, $server]; } /** diff --git a/libraries/classes/Config/ConfigFile.php b/libraries/classes/Config/ConfigFile.php index f629863b87..76f7d8aedc 100644 --- a/libraries/classes/Config/ConfigFile.php +++ b/libraries/classes/Config/ConfigFile.php @@ -501,40 +501,15 @@ class ConfigFile 'Servers' => [ 1 => [ 'port' => 'integer', - 'auth_type' => [ - 'config', - 'http', - 'signon', - 'cookie', - ], - 'AllowDeny' => [ - 'order' => [ - '', - 'deny,allow', - 'allow,deny', - 'explicit', - ], - ], + 'auth_type' => ['config', 'http', 'signon', 'cookie'], + 'AllowDeny' => ['order' => ['', 'deny,allow', 'allow,deny', 'explicit']], 'only_db' => 'array', ], ], - 'RecodingEngine' => [ - 'auto', - 'iconv', - 'recode', - 'mb', - 'none', - ], - 'OBGzip' => [ - 'auto', - true, - false, - ], + 'RecodingEngine' => ['auto', 'iconv', 'recode', 'mb', 'none'], + 'OBGzip' => ['auto', true, false], 'MemoryLimit' => 'short_string', - 'NavigationLogoLinkWindow' => [ - 'main', - 'new', - ], + 'NavigationLogoLinkWindow' => ['main', 'new'], 'NavigationTreeDefaultTabTable' => [ // fields list 'structure' => __('Structure'), @@ -564,49 +539,19 @@ class ConfigFile 'NavigationTreeDbSeparator' => 'short_string', 'NavigationTreeTableSeparator' => 'short_string', 'NavigationWidth' => 'integer', - 'TableNavigationLinksMode' => [ - 'icons' => __('Icons'), - 'text' => __('Text'), - 'both' => __('Both'), - ], - 'MaxRows' => [ - 25, - 50, - 100, - 250, - 500, - ], - 'Order' => [ - 'ASC', - 'DESC', - 'SMART', - ], + 'TableNavigationLinksMode' => ['icons' => __('Icons'), 'text' => __('Text'), 'both' => __('Both')], + 'MaxRows' => [25, 50, 100, 250, 500], + 'Order' => ['ASC', 'DESC', 'SMART'], 'RowActionLinks' => [ 'none' => __('Nowhere'), 'left' => __('Left'), 'right' => __('Right'), 'both' => __('Both'), ], - 'TablePrimaryKeyOrder' => [ - 'NONE' => __('None'), - 'ASC' => __('Ascending'), - 'DESC' => __('Descending'), - ], - 'ProtectBinary' => [ - false, - 'blob', - 'noblob', - 'all', - ], - 'CharEditing' => [ - 'input', - 'textarea', - ], - 'TabsMode' => [ - 'icons' => __('Icons'), - 'text' => __('Text'), - 'both' => __('Both'), - ], + 'TablePrimaryKeyOrder' => ['NONE' => __('None'), 'ASC' => __('Ascending'), 'DESC' => __('Descending')], + 'ProtectBinary' => [false, 'blob', 'noblob', 'all'], + 'CharEditing' => ['input', 'textarea'], + 'TabsMode' => ['icons' => __('Icons'), 'text' => __('Text'), 'both' => __('Both')], 'PDFDefaultPageSize' => [ 'A3' => 'A3', 'A4' => 'A4', @@ -614,20 +559,13 @@ class ConfigFile 'letter' => 'letter', 'legal' => 'legal', ], - 'ActionLinksMode' => [ - 'icons' => __('Icons'), - 'text' => __('Text'), - 'both' => __('Both'), - ], + 'ActionLinksMode' => ['icons' => __('Icons'), 'text' => __('Text'), 'both' => __('Both')], 'GridEditing' => [ 'click' => __('Click'), 'double-click' => __('Double click'), 'disabled' => __('Disabled'), ], - 'RelationalDisplay' => [ - 'K' => __('key'), - 'D' => __('display column'), - ], + 'RelationalDisplay' => ['K' => __('key'), 'D' => __('display column')], 'DefaultTabServer' => [ // the welcome page (recommended for multiuser setups) 'welcome' => __('Welcome'), @@ -662,11 +600,7 @@ class ConfigFile // browse page 'browse' => __('Browse'), ], - 'InitialSlidersState' => [ - 'open' => __('Open'), - 'closed' => __('Closed'), - 'disabled' => __('Disabled'), - ], + 'InitialSlidersState' => ['open' => __('Open'), 'closed' => __('Closed'), 'disabled' => __('Disabled')], 'FirstDayOfCalendar' => [ '1' => _pgettext('Week day name', 'Monday'), '2' => _pgettext('Week day name', 'Tuesday'), @@ -719,11 +653,7 @@ class ConfigFile 'ldi_terminated' => 'short_string', 'ldi_enclosed' => 'short_string', 'ldi_escaped' => 'short_string', - 'ldi_local_option' => [ - 'auto', - true, - false, - ], + 'ldi_local_option' => ['auto', true, false], ], 'Export' => [ @@ -752,11 +682,7 @@ class ConfigFile 'xml', 'yaml', ], - 'compression' => [ - 'none', - 'zip', - 'gzip', - ], + 'compression' => ['none', 'zip', 'gzip'], 'charset' => array_merge([''], $GLOBALS['cfg']['AvailableCharsets'] ?? []), 'sql_compatibility' => [ 'NONE', @@ -772,11 +698,7 @@ class ConfigFile //'POSTGRESQL', 'TRADITIONAL', ], - 'codegen_format' => [ - '#', - 'NHibernate C# DO', - 'NHibernate XML', - ], + 'codegen_format' => ['#', 'NHibernate C# DO', 'NHibernate XML'], 'csv_separator' => 'short_string', 'csv_terminated' => 'short_string', 'csv_enclosed' => 'short_string', @@ -793,11 +715,7 @@ class ConfigFile 'data' => __('data'), 'structure_and_data' => __('structure and data'), ], - 'sql_type' => [ - 'INSERT', - 'UPDATE', - 'REPLACE', - ], + 'sql_type' => ['INSERT', 'UPDATE', 'REPLACE'], 'sql_insert_syntax' => [ 'complete' => __('complete inserts'), 'extended' => __('extended inserts'), @@ -826,20 +744,9 @@ class ConfigFile ], 'Console' => [ - 'Mode' => [ - 'info', - 'show', - 'collapse', - ], - 'OrderBy' => [ - 'exec', - 'time', - 'count', - ], - 'Order' => [ - 'asc', - 'desc', - ], + 'Mode' => ['info', 'show', 'collapse'], + 'OrderBy' => ['exec', 'time', 'count'], + 'Order' => ['asc', 'desc'], ], /** @@ -855,42 +762,12 @@ class ConfigFile 'Export/sql_max_query_size' => 'validatePositiveNumber', 'FirstLevelNavigationItems' => 'validatePositiveNumber', 'ForeignKeyMaxLimit' => 'validatePositiveNumber', - 'Import/csv_enclosed' => [ - [ - 'validateByRegex', - '/^.?$/', - ], - ], - 'Import/csv_escaped' => [ - [ - 'validateByRegex', - '/^.$/', - ], - ], - 'Import/csv_terminated' => [ - [ - 'validateByRegex', - '/^.$/', - ], - ], - 'Import/ldi_enclosed' => [ - [ - 'validateByRegex', - '/^.?$/', - ], - ], - 'Import/ldi_escaped' => [ - [ - 'validateByRegex', - '/^.$/', - ], - ], - 'Import/ldi_terminated' => [ - [ - 'validateByRegex', - '/^.$/', - ], - ], + 'Import/csv_enclosed' => [['validateByRegex', '/^.?$/']], + 'Import/csv_escaped' => [['validateByRegex', '/^.$/']], + 'Import/csv_terminated' => [['validateByRegex', '/^.$/']], + 'Import/ldi_enclosed' => [['validateByRegex', '/^.?$/']], + 'Import/ldi_escaped' => [['validateByRegex', '/^.$/']], + 'Import/ldi_terminated' => [['validateByRegex', '/^.$/']], 'Import/skip_queries' => 'validateNonNegativeNumber', 'InsertRows' => 'validatePositiveNumber', 'NumRecentTables' => 'validateNonNegativeNumber', @@ -905,12 +782,7 @@ class ConfigFile 'MaxSizeForInputField' => 'validatePositiveNumber', 'MinSizeForInputField' => 'validateNonNegativeNumber', 'MaxTableList' => 'validatePositiveNumber', - 'MemoryLimit' => [ - [ - 'validateByRegex', - '/^(-1|(\d+(?:[kmg])?))$/i', - ], - ], + 'MemoryLimit' => [['validateByRegex', '/^(-1|(\d+(?:[kmg])?))$/i']], 'NavigationTreeDisplayItemFilterMinimum' => 'validatePositiveNumber', 'NavigationTreeTableLevel' => 'validatePositiveNumber', 'NavigationWidth' => 'validateNonNegativeNumber', @@ -929,24 +801,9 @@ class ConfigFile * Additional validators used for user preferences */ '_userValidators' => [ - 'MaxDbList' => [ - [ - 'validateUpperBound', - 'value:MaxDbList', - ], - ], - 'MaxTableList' => [ - [ - 'validateUpperBound', - 'value:MaxTableList', - ], - ], - 'QueryHistoryMax' => [ - [ - 'validateUpperBound', - 'value:QueryHistoryMax', - ], - ], + 'MaxDbList' => [['validateUpperBound', 'value:MaxDbList']], + 'MaxTableList' => [['validateUpperBound', 'value:MaxTableList']], + 'QueryHistoryMax' => [['validateUpperBound', 'value:QueryHistoryMax']], ], ]; } diff --git a/libraries/classes/Config/Descriptions.php b/libraries/classes/Config/Descriptions.php index ac9c32bb2b..6f96216936 100644 --- a/libraries/classes/Config/Descriptions.php +++ b/libraries/classes/Config/Descriptions.php @@ -27,14 +27,8 @@ class Descriptions public static function get(string $path, string $type = 'name'): string { $key = str_replace( - [ - 'Servers/1/', - '/', - ], - [ - 'Servers/', - '_', - ], + ['Servers/1/', '/'], + ['Servers/', '_'], $path, ); $value = self::getString($key, $type); diff --git a/libraries/classes/Config/FormDisplay.php b/libraries/classes/Config/FormDisplay.php index 0e59a8ecdc..79383e0e9d 100644 --- a/libraries/classes/Config/FormDisplay.php +++ b/libraries/classes/Config/FormDisplay.php @@ -796,18 +796,9 @@ class FormDisplay if ($systemPath === 'ZipDump' || $systemPath === 'GZipDump' || $systemPath === 'BZipDump') { $comment = ''; $funcs = [ - 'ZipDump' => [ - 'zip_open', - 'gzcompress', - ], - 'GZipDump' => [ - 'gzopen', - 'gzencode', - ], - 'BZipDump' => [ - 'bzopen', - 'bzcompress', - ], + 'ZipDump' => ['zip_open', 'gzcompress'], + 'GZipDump' => ['gzopen', 'gzencode'], + 'BZipDump' => ['bzopen', 'bzcompress'], ]; if (! function_exists($funcs[$systemPath][0])) { $comment = sprintf( diff --git a/libraries/classes/Config/FormDisplayTemplate.php b/libraries/classes/Config/FormDisplayTemplate.php index a68eb8437d..589a14a7b7 100644 --- a/libraries/classes/Config/FormDisplayTemplate.php +++ b/libraries/classes/Config/FormDisplayTemplate.php @@ -152,10 +152,7 @@ class FormDisplayTemplate */ public function displayErrors(string $name, array $errorList): string { - return $this->template->render('config/form_display/errors', [ - 'name' => $name, - 'error_list' => $errorList, - ]); + return $this->template->render('config/form_display/errors', ['name' => $name, 'error_list' => $errorList]); } public function display(array $data): string diff --git a/libraries/classes/Config/Forms/Page/BrowseForm.php b/libraries/classes/Config/Forms/Page/BrowseForm.php index e7f7c19584..a4e8d7ca17 100644 --- a/libraries/classes/Config/Forms/Page/BrowseForm.php +++ b/libraries/classes/Config/Forms/Page/BrowseForm.php @@ -15,8 +15,6 @@ class BrowseForm extends BaseForm /** @return array */ public static function getForms(): array { - return [ - 'Browse' => MainForm::getForms()['Browse'], - ]; + return ['Browse' => MainForm::getForms()['Browse']]; } } diff --git a/libraries/classes/Config/Forms/Page/DbStructureForm.php b/libraries/classes/Config/Forms/Page/DbStructureForm.php index 250c4c4aae..84e49d8009 100644 --- a/libraries/classes/Config/Forms/Page/DbStructureForm.php +++ b/libraries/classes/Config/Forms/Page/DbStructureForm.php @@ -15,8 +15,6 @@ class DbStructureForm extends BaseForm /** @return array */ public static function getForms(): array { - return [ - 'DbStructure' => MainForm::getForms()['DbStructure'], - ]; + return ['DbStructure' => MainForm::getForms()['DbStructure']]; } } diff --git a/libraries/classes/Config/Forms/Page/EditForm.php b/libraries/classes/Config/Forms/Page/EditForm.php index 6049a04b32..5dd9d18351 100644 --- a/libraries/classes/Config/Forms/Page/EditForm.php +++ b/libraries/classes/Config/Forms/Page/EditForm.php @@ -16,9 +16,6 @@ class EditForm extends BaseForm /** @return array */ public static function getForms(): array { - return [ - 'Edit' => MainForm::getForms()['Edit'], - 'Text_fields' => FeaturesForm::getForms()['Text_fields'], - ]; + 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 4c730bf521..72181f842e 100644 --- a/libraries/classes/Config/Forms/Page/TableStructureForm.php +++ b/libraries/classes/Config/Forms/Page/TableStructureForm.php @@ -15,8 +15,6 @@ class TableStructureForm extends BaseForm /** @return array */ public static function getForms(): array { - return [ - 'TableStructure' => MainForm::getForms()['TableStructure'], - ]; + return ['TableStructure' => MainForm::getForms()['TableStructure']]; } } diff --git a/libraries/classes/Config/Forms/Setup/ConfigForm.php b/libraries/classes/Config/Forms/Setup/ConfigForm.php index 806f0caa81..ead35cfbd7 100644 --- a/libraries/classes/Config/Forms/Setup/ConfigForm.php +++ b/libraries/classes/Config/Forms/Setup/ConfigForm.php @@ -14,11 +14,6 @@ class ConfigForm extends BaseForm /** @return array */ public static function getForms(): array { - return [ - 'Config' => [ - 'DefaultLang', - 'ServerDefault', - ], - ]; + return ['Config' => ['DefaultLang', 'ServerDefault']]; } } diff --git a/libraries/classes/Config/Forms/Setup/FeaturesForm.php b/libraries/classes/Config/Forms/Setup/FeaturesForm.php index 7dd5664fec..fb367accdc 100644 --- a/libraries/classes/Config/Forms/Setup/FeaturesForm.php +++ b/libraries/classes/Config/Forms/Setup/FeaturesForm.php @@ -19,10 +19,7 @@ class FeaturesForm extends \PhpMyAdmin\Config\Forms\User\FeaturesForm /* Remove only_db/hide_db, we have proper Server form in setup */ $result['Databases'] = array_diff( $result['Databases'], - [ - 'Servers/1/only_db', - 'Servers/1/hide_db', - ], + ['Servers/1/only_db', 'Servers/1/hide_db'], ); /* Following are not available to user */ $result['Import_export'] = [ @@ -50,10 +47,7 @@ class FeaturesForm extends \PhpMyAdmin\Config\Forms\User\FeaturesForm 'CaptchaLoginPrivateKey', 'CaptchaSiteVerifyURL', ]; - $result['Developer'] = [ - 'UserprefsDeveloperTab', - 'DBG/sql', - ]; + $result['Developer'] = ['UserprefsDeveloperTab', 'DBG/sql']; $result['Other_core_settings'] = [ 'OBGzip', 'PersistentConnections', diff --git a/libraries/classes/Config/Forms/Setup/ServersForm.php b/libraries/classes/Config/Forms/Setup/ServersForm.php index 55e36aa87f..881bee3659 100644 --- a/libraries/classes/Config/Forms/Setup/ServersForm.php +++ b/libraries/classes/Config/Forms/Setup/ServersForm.php @@ -18,18 +18,7 @@ class ServersForm extends BaseForm { // phpcs:disable Squiz.Arrays.ArrayDeclaration.KeySpecified,Squiz.Arrays.ArrayDeclaration.NoKeySpecified return [ - 'Server' => [ - 'Servers' => [ - 1 => [ - 'verbose', - 'host', - 'port', - 'socket', - 'ssl', - 'compress', - ], - ], - ], + 'Server' => ['Servers' => [1 => ['verbose', 'host', 'port', 'socket', 'ssl', 'compress']]], 'Server_auth' => [ 'Servers' => [ 1 => [ diff --git a/libraries/classes/Config/Forms/User/FeaturesForm.php b/libraries/classes/Config/Forms/User/FeaturesForm.php index 7205255d8e..c7afe7c18c 100644 --- a/libraries/classes/Config/Forms/User/FeaturesForm.php +++ b/libraries/classes/Config/Forms/User/FeaturesForm.php @@ -47,12 +47,7 @@ class FeaturesForm extends BaseForm 'TextareaRows', 'LongtextDoubleTextarea', ], - 'Page_titles' => [ - 'TitleDefault', - 'TitleTable', - 'TitleDatabase', - 'TitleServer', - ], + 'Page_titles' => ['TitleDefault', 'TitleTable', 'TitleDatabase', 'TitleServer'], 'Warnings' => [ 'PmaNoRelation_DisableWarning', 'SuhosinDisableWarning', diff --git a/libraries/classes/Config/Forms/User/ImportForm.php b/libraries/classes/Config/Forms/User/ImportForm.php index 72de1d398e..c601eff65a 100644 --- a/libraries/classes/Config/Forms/User/ImportForm.php +++ b/libraries/classes/Config/Forms/User/ImportForm.php @@ -24,11 +24,7 @@ class ImportForm extends BaseForm 'Import/skip_queries', 'enable_drag_drop_import', ], - 'Sql' => [ - 'Import/sql_compatibility', - 'Import/sql_no_auto_value_on_zero', - 'Import/sql_read_as_multibytes', - ], + 'Sql' => ['Import/sql_compatibility', 'Import/sql_no_auto_value_on_zero', 'Import/sql_read_as_multibytes'], 'Csv' => [ ':group:' . __('CSV'), 'Import/csv_replace', diff --git a/libraries/classes/Config/Forms/User/MainForm.php b/libraries/classes/Config/Forms/User/MainForm.php index 910d6991aa..938032076e 100644 --- a/libraries/classes/Config/Forms/User/MainForm.php +++ b/libraries/classes/Config/Forms/User/MainForm.php @@ -17,11 +17,7 @@ class MainForm extends BaseForm public static function getForms(): array { return [ - 'Startup' => [ - 'ShowCreateDb', - 'ShowStats', - 'ShowServerInfo', - ], + 'Startup' => ['ShowCreateDb', 'ShowStats', 'ShowServerInfo'], 'DbStructure' => [ 'ShowDbStructureCharset', 'ShowDbStructureComment', @@ -70,12 +66,7 @@ class MainForm extends BaseForm 'ForeignKeyDropdownOrder', 'ForeignKeyMaxLimit', ], - 'Tabs' => [ - 'TabsMode', - 'DefaultTabServer', - 'DefaultTabDatabase', - 'DefaultTabTable', - ], + 'Tabs' => ['TabsMode', 'DefaultTabServer', 'DefaultTabDatabase', 'DefaultTabTable'], 'DisplayRelationalSchema' => ['PDFDefaultPageSize'], ]; } diff --git a/libraries/classes/Config/Forms/User/NaviForm.php b/libraries/classes/Config/Forms/User/NaviForm.php index f96158a8f0..0f5c7c107b 100644 --- a/libraries/classes/Config/Forms/User/NaviForm.php +++ b/libraries/classes/Config/Forms/User/NaviForm.php @@ -41,14 +41,8 @@ class NaviForm extends BaseForm 'NavigationTreeShowEvents', 'NavigationTreeAutoexpandSingleDb', ], - 'Navi_servers' => [ - 'NavigationDisplayServers', - 'DisplayServersList', - ], - 'Navi_databases' => [ - 'NavigationTreeDisplayDbFilterMinimum', - 'NavigationTreeDbSeparator', - ], + 'Navi_servers' => ['NavigationDisplayServers', 'DisplayServersList'], + 'Navi_databases' => ['NavigationTreeDisplayDbFilterMinimum', 'NavigationTreeDbSeparator'], 'Navi_tables' => [ 'NavigationTreeDefaultTabTable', 'NavigationTreeDefaultTabTable2', diff --git a/libraries/classes/Config/Forms/User/SqlForm.php b/libraries/classes/Config/Forms/User/SqlForm.php index b9754f5c79..509bfce65a 100644 --- a/libraries/classes/Config/Forms/User/SqlForm.php +++ b/libraries/classes/Config/Forms/User/SqlForm.php @@ -29,12 +29,7 @@ class SqlForm extends BaseForm 'EnableAutocompleteForTablesAndColumns', 'DefaultForeignKeyChecks', ], - 'Sql_box' => [ - 'SQLQuery/Edit', - 'SQLQuery/Explain', - 'SQLQuery/ShowAsPHP', - 'SQLQuery/Refresh', - ], + 'Sql_box' => ['SQLQuery/Edit', 'SQLQuery/Explain', 'SQLQuery/ShowAsPHP', 'SQLQuery/Refresh'], ]; } diff --git a/libraries/classes/Config/SpecialSchemaLinks.php b/libraries/classes/Config/SpecialSchemaLinks.php index 02cabafbaf..82b9c82336 100644 --- a/libraries/classes/Config/SpecialSchemaLinks.php +++ b/libraries/classes/Config/SpecialSchemaLinks.php @@ -72,35 +72,19 @@ class SpecialSchemaLinks 'columns_priv' => [ 'user' => [ 'link_param' => 'username', - 'link_dependancy_params' => [ - 0 => [ - 'param_info' => 'hostname', - 'column_name' => 'host', - ], - ], + 'link_dependancy_params' => [0 => ['param_info' => 'hostname', 'column_name' => 'host']], 'default_page' => './' . Url::getFromRoute('/server/privileges'), ], 'table_name' => [ 'link_param' => 'table', - 'link_dependancy_params' => [ - 0 => [ - 'param_info' => 'db', - 'column_name' => 'Db', - ], - ], + 'link_dependancy_params' => [0 => ['param_info' => 'db', 'column_name' => 'Db']], 'default_page' => $defaultPageTable, ], 'column_name' => [ 'link_param' => 'field', 'link_dependancy_params' => [ - 0 => [ - 'param_info' => 'db', - 'column_name' => 'Db', - ], - 1 => [ - 'param_info' => 'table', - 'column_name' => 'Table_name', - ], + 0 => ['param_info' => 'db', 'column_name' => 'Db'], + 1 => ['param_info' => 'table', 'column_name' => 'Table_name'], ], 'default_page' => './' . Url::getFromRoute('/table/structure/change', ['change_column' => 1]), ], @@ -108,24 +92,14 @@ class SpecialSchemaLinks 'db' => [ 'user' => [ 'link_param' => 'username', - 'link_dependancy_params' => [ - 0 => [ - 'param_info' => 'hostname', - 'column_name' => 'host', - ], - ], + 'link_dependancy_params' => [0 => ['param_info' => 'hostname', 'column_name' => 'host']], 'default_page' => './' . Url::getFromRoute('/server/privileges'), ], ], 'event' => [ 'name' => [ 'link_param' => 'item_name', - 'link_dependancy_params' => [ - 0 => [ - 'param_info' => 'db', - 'column_name' => 'db', - ], - ], + 'link_dependancy_params' => [0 => ['param_info' => 'db', 'column_name' => 'db']], 'default_page' => './' . Url::getFromRoute('/database/events', ['edit_item' => 1]), ], @@ -133,25 +107,14 @@ class SpecialSchemaLinks 'innodb_index_stats' => [ 'table_name' => [ 'link_param' => 'table', - 'link_dependancy_params' => [ - 0 => [ - 'param_info' => 'db', - 'column_name' => 'database_name', - ], - ], + 'link_dependancy_params' => [0 => ['param_info' => 'db', 'column_name' => 'database_name']], 'default_page' => $defaultPageTable, ], 'index_name' => [ 'link_param' => 'index', 'link_dependancy_params' => [ - 0 => [ - 'param_info' => 'db', - 'column_name' => 'database_name', - ], - 1 => [ - 'param_info' => 'table', - 'column_name' => 'table_name', - ], + 0 => ['param_info' => 'db', 'column_name' => 'database_name'], + 1 => ['param_info' => 'table', 'column_name' => 'table_name'], ], 'default_page' => './' . Url::getFromRoute('/table/structure'), ], @@ -159,12 +122,7 @@ class SpecialSchemaLinks 'innodb_table_stats' => [ 'table_name' => [ 'link_param' => 'table', - 'link_dependancy_params' => [ - 0 => [ - 'param_info' => 'db', - 'column_name' => 'database_name', - ], - ], + 'link_dependancy_params' => [0 => ['param_info' => 'db', 'column_name' => 'database_name']], 'default_page' => $defaultPageTable, ], ], @@ -172,28 +130,16 @@ class SpecialSchemaLinks 'name' => [ 'link_param' => 'item_name', 'link_dependancy_params' => [ - 0 => [ - 'param_info' => 'db', - 'column_name' => 'db', - ], - 1 => [ - 'param_info' => 'item_type', - 'column_name' => 'type', - ], + 0 => ['param_info' => 'db', 'column_name' => 'db'], + 1 => ['param_info' => 'item_type', 'column_name' => 'type'], ], 'default_page' => './' . Url::getFromRoute('/database/routines', ['edit_item' => 1]), ], 'specific_name' => [ 'link_param' => 'item_name', 'link_dependancy_params' => [ - 0 => [ - 'param_info' => 'db', - 'column_name' => 'db', - ], - 1 => [ - 'param_info' => 'item_type', - 'column_name' => 'type', - ], + 0 => ['param_info' => 'db', 'column_name' => 'db'], + 1 => ['param_info' => 'item_type', 'column_name' => 'type'], ], 'default_page' => './' . Url::getFromRoute('/database/routines', ['edit_item' => 1]), ], @@ -201,25 +147,14 @@ class SpecialSchemaLinks 'proc_priv' => [ 'user' => [ 'link_param' => 'username', - 'link_dependancy_params' => [ - 0 => [ - 'param_info' => 'hostname', - 'column_name' => 'Host', - ], - ], + 'link_dependancy_params' => [0 => ['param_info' => 'hostname', 'column_name' => 'Host']], 'default_page' => './' . Url::getFromRoute('/server/privileges'), ], 'routine_name' => [ 'link_param' => 'item_name', 'link_dependancy_params' => [ - 0 => [ - 'param_info' => 'db', - 'column_name' => 'Db', - ], - 1 => [ - 'param_info' => 'item_type', - 'column_name' => 'Routine_type', - ], + 0 => ['param_info' => 'db', 'column_name' => 'Db'], + 1 => ['param_info' => 'item_type', 'column_name' => 'Routine_type'], ], 'default_page' => './' . Url::getFromRoute('/database/routines', ['edit_item' => 1]), ], @@ -227,46 +162,26 @@ class SpecialSchemaLinks 'proxies_priv' => [ 'user' => [ 'link_param' => 'username', - 'link_dependancy_params' => [ - 0 => [ - 'param_info' => 'hostname', - 'column_name' => 'Host', - ], - ], + 'link_dependancy_params' => [0 => ['param_info' => 'hostname', 'column_name' => 'Host']], 'default_page' => './' . Url::getFromRoute('/server/privileges'), ], ], 'tables_priv' => [ 'user' => [ 'link_param' => 'username', - 'link_dependancy_params' => [ - 0 => [ - 'param_info' => 'hostname', - 'column_name' => 'Host', - ], - ], + 'link_dependancy_params' => [0 => ['param_info' => 'hostname', 'column_name' => 'Host']], 'default_page' => './' . Url::getFromRoute('/server/privileges'), ], 'table_name' => [ 'link_param' => 'table', - 'link_dependancy_params' => [ - 0 => [ - 'param_info' => 'db', - 'column_name' => 'Db', - ], - ], + 'link_dependancy_params' => [0 => ['param_info' => 'db', 'column_name' => 'Db']], 'default_page' => $defaultPageTable, ], ], 'user' => [ 'user' => [ 'link_param' => 'username', - 'link_dependancy_params' => [ - 0 => [ - 'param_info' => 'hostname', - 'column_name' => 'host', - ], - ], + 'link_dependancy_params' => [0 => ['param_info' => 'hostname', 'column_name' => 'host']], 'default_page' => './' . Url::getFromRoute('/server/privileges'), ], ], @@ -275,25 +190,14 @@ class SpecialSchemaLinks 'columns' => [ 'table_name' => [ 'link_param' => 'table', - 'link_dependancy_params' => [ - 0 => [ - 'param_info' => 'db', - 'column_name' => 'table_schema', - ], - ], + 'link_dependancy_params' => [0 => ['param_info' => 'db', 'column_name' => 'table_schema']], 'default_page' => $defaultPageTable, ], 'column_name' => [ 'link_param' => 'field', 'link_dependancy_params' => [ - 0 => [ - 'param_info' => 'db', - 'column_name' => 'table_schema', - ], - 1 => [ - 'param_info' => 'table', - 'column_name' => 'table_name', - ], + 0 => ['param_info' => 'db', 'column_name' => 'table_schema'], + 1 => ['param_info' => 'table', 'column_name' => 'table_name'], ], 'default_page' => './' . Url::getFromRoute('/table/structure/change', ['change_column' => 1]), ], @@ -301,49 +205,29 @@ class SpecialSchemaLinks 'key_column_usage' => [ 'table_name' => [ 'link_param' => 'table', - 'link_dependancy_params' => [ - 0 => [ - 'param_info' => 'db', - 'column_name' => 'constraint_schema', - ], - ], + 'link_dependancy_params' => [0 => ['param_info' => 'db','column_name' => 'constraint_schema']], 'default_page' => $defaultPageTable, ], 'column_name' => [ 'link_param' => 'field', 'link_dependancy_params' => [ - 0 => [ - 'param_info' => 'db', - 'column_name' => 'table_schema', - ], - 1 => [ - 'param_info' => 'table', - 'column_name' => 'table_name', - ], + 0 => ['param_info' => 'db', 'column_name' => 'table_schema'], + 1 => ['param_info' => 'table', 'column_name' => 'table_name'], ], 'default_page' => './' . Url::getFromRoute('/table/structure/change', ['change_column' => 1]), ], 'referenced_table_name' => [ 'link_param' => 'table', 'link_dependancy_params' => [ - 0 => [ - 'param_info' => 'db', - 'column_name' => 'referenced_table_schema', - ], + 0 => ['param_info' => 'db', 'column_name' => 'referenced_table_schema'], ], 'default_page' => $defaultPageTable, ], 'referenced_column_name' => [ 'link_param' => 'field', 'link_dependancy_params' => [ - 0 => [ - 'param_info' => 'db', - 'column_name' => 'referenced_table_schema', - ], - 1 => [ - 'param_info' => 'table', - 'column_name' => 'referenced_table_name', - ], + 0 => ['param_info' => 'db', 'column_name' => 'referenced_table_schema'], + 1 => ['param_info' => 'table', 'column_name' => 'referenced_table_name'], ], 'default_page' => './' . Url::getFromRoute('/table/structure/change', ['change_column' => 1]), ], @@ -351,46 +235,26 @@ class SpecialSchemaLinks 'partitions' => [ 'table_name' => [ 'link_param' => 'table', - 'link_dependancy_params' => [ - 0 => [ - 'param_info' => 'db', - 'column_name' => 'table_schema', - ], - ], + 'link_dependancy_params' => [0 => ['param_info' => 'db', 'column_name' => 'table_schema']], 'default_page' => $defaultPageTable, ], ], 'processlist' => [ 'user' => [ 'link_param' => 'username', - 'link_dependancy_params' => [ - 0 => [ - 'param_info' => 'hostname', - 'column_name' => 'host', - ], - ], + 'link_dependancy_params' => [0 => ['param_info' => 'hostname', 'column_name' => 'host']], 'default_page' => './' . Url::getFromRoute('/server/privileges'), ], ], 'referential_constraints' => [ 'table_name' => [ 'link_param' => 'table', - 'link_dependancy_params' => [ - 0 => [ - 'param_info' => 'db', - 'column_name' => 'constraint_schema', - ], - ], + 'link_dependancy_params' => [0 => ['param_info' => 'db','column_name' => 'constraint_schema']], 'default_page' => $defaultPageTable, ], 'referenced_table_name' => [ 'link_param' => 'table', - 'link_dependancy_params' => [ - 0 => [ - 'param_info' => 'db', - 'column_name' => 'constraint_schema', - ], - ], + 'link_dependancy_params' => [0 => ['param_info' => 'db','column_name' => 'constraint_schema']], 'default_page' => $defaultPageTable, ], ], @@ -398,46 +262,24 @@ class SpecialSchemaLinks 'routine_name' => [ 'link_param' => 'item_name', 'link_dependancy_params' => [ - 0 => [ - 'param_info' => 'db', - 'column_name' => 'routine_schema', - ], - 1 => [ - 'param_info' => 'item_type', - 'column_name' => 'routine_type', - ], + 0 => ['param_info' => 'db', 'column_name' => 'routine_schema'], + 1 => ['param_info' => 'item_type', 'column_name' => 'routine_type'], ], 'default_page' => './' . Url::getFromRoute('/database/routines'), ], ], - 'schemata' => [ - 'schema_name' => [ - 'link_param' => 'db', - 'default_page' => $defaultPageDatabase, - ], - ], + 'schemata' => ['schema_name' => ['link_param' => 'db', 'default_page' => $defaultPageDatabase]], 'statistics' => [ 'table_name' => [ 'link_param' => 'table', - 'link_dependancy_params' => [ - 0 => [ - 'param_info' => 'db', - 'column_name' => 'table_schema', - ], - ], + 'link_dependancy_params' => [0 => ['param_info' => 'db', 'column_name' => 'table_schema']], 'default_page' => $defaultPageTable, ], 'column_name' => [ 'link_param' => 'field', 'link_dependancy_params' => [ - 0 => [ - 'param_info' => 'db', - 'column_name' => 'table_schema', - ], - 1 => [ - 'param_info' => 'table', - 'column_name' => 'table_name', - ], + 0 => ['param_info' => 'db', 'column_name' => 'table_schema'], + 1 => ['param_info' => 'table', 'column_name' => 'table_name'], ], 'default_page' => './' . Url::getFromRoute('/table/structure/change', ['change_column' => 1]), ], @@ -445,36 +287,21 @@ class SpecialSchemaLinks 'tables' => [ 'table_name' => [ 'link_param' => 'table', - 'link_dependancy_params' => [ - 0 => [ - 'param_info' => 'db', - 'column_name' => 'table_schema', - ], - ], + 'link_dependancy_params' => [0 => ['param_info' => 'db', 'column_name' => 'table_schema']], 'default_page' => $defaultPageTable, ], ], 'table_constraints' => [ 'table_name' => [ 'link_param' => 'table', - 'link_dependancy_params' => [ - 0 => [ - 'param_info' => 'db', - 'column_name' => 'table_schema', - ], - ], + 'link_dependancy_params' => [0 => ['param_info' => 'db', 'column_name' => 'table_schema']], 'default_page' => $defaultPageTable, ], ], 'views' => [ 'table_name' => [ 'link_param' => 'table', - 'link_dependancy_params' => [ - 0 => [ - 'param_info' => 'db', - 'column_name' => 'table_schema', - ], - ], + 'link_dependancy_params' => [0 => ['param_info' => 'db', 'column_name' => 'table_schema']], 'default_page' => $defaultPageTable, ], ], diff --git a/libraries/classes/ConfigStorage/Relation.php b/libraries/classes/ConfigStorage/Relation.php index f8eb8585ff..563c7c00df 100644 --- a/libraries/classes/ConfigStorage/Relation.php +++ b/libraries/classes/ConfigStorage/Relation.php @@ -225,15 +225,9 @@ class Relation $workToTable = [ 'relwork' => 'relation', - 'displaywork' => [ - 'relation', - 'table_info', - ], + 'displaywork' => ['relation', 'table_info'], 'bookmarkwork' => 'bookmarktable', - 'pdfwork' => [ - 'table_coords', - 'pdf_pages', - ], + 'pdfwork' => ['table_coords', 'pdf_pages'], 'commwork' => 'column_info', 'mimework' => 'column_info', 'historywork' => 'history', @@ -242,10 +236,7 @@ class Relation 'uiprefswork' => 'table_uiprefs', 'trackingwork' => 'tracking', 'userconfigwork' => 'userconfig', - 'menuswork' => [ - 'users', - 'usergroups', - ], + 'menuswork' => ['users', 'usergroups'], 'navwork' => 'navigationhiding', 'savedsearcheswork' => 'savedsearches', 'centralcolumnswork' => 'central_columns', @@ -347,10 +338,7 @@ class Relation { // From 4.3, new input oriented transformation feature was introduced. // Check whether column_info table has input transformation columns - $newCols = [ - 'input_transformation', - 'input_transformation_options', - ]; + $newCols = ['input_transformation', 'input_transformation_options']; $query = 'SHOW COLUMNS FROM ' . Util::backquote($GLOBALS['cfg']['Server']['pmadb']) . '.' . Util::backquote($GLOBALS['cfg']['Server']['column_info']) @@ -373,10 +361,7 @@ class Relation // replace pma__column_info table name from query // to with set in config.inc.php $query = str_replace( - [ - '`phpmyadmin`', - '`pma__column_info`', - ], + ['`phpmyadmin`', '`pma__column_info`'], [ Util::backquote($GLOBALS['cfg']['Server']['pmadb']), Util::backquote($GLOBALS['cfg']['Server']['column_info']), @@ -672,11 +657,7 @@ class Relation $_SESSION['sql_history'] = []; } - $_SESSION['sql_history'][] = [ - 'db' => $db, - 'table' => $table, - 'sqlquery' => $sqlquery, - ]; + $_SESSION['sql_history'][] = ['db' => $db, 'table' => $table, 'sqlquery' => $sqlquery]; if (count($_SESSION['sql_history']) > $GLOBALS['cfg']['QueryHistoryMax']) { // history should not exceed a maximum count @@ -1365,10 +1346,7 @@ class Relation return $this->dbi->fetchResult( $relQuery, - [ - 'referenced_column_name', - null, - ], + ['referenced_column_name', null], ); } @@ -1394,12 +1372,7 @@ class Relation array|null $foreignersFull = null, array|null $childReferencesFull = null, ): array { - $columnStatus = [ - 'isEditable' => true, - 'isReferenced' => false, - 'isForeignKey' => false, - 'references' => [], - ]; + $columnStatus = ['isEditable' => true, 'isReferenced' => false, 'isForeignKey' => false, 'references' => []]; $foreigners = []; if ($foreignersFull !== null) { @@ -1691,10 +1664,7 @@ class Relation $haveRel = count($resRel) > 0; } - return [ - $resRel, - $haveRel, - ]; + return [$resRel, $haveRel]; } /** diff --git a/libraries/classes/ConfigStorage/UserGroups.php b/libraries/classes/ConfigStorage/UserGroups.php index f584ef63b7..9d27b8d025 100644 --- a/libraries/classes/ConfigStorage/UserGroups.php +++ b/libraries/classes/ConfigStorage/UserGroups.php @@ -52,10 +52,7 @@ class UserGroups if ($result) { $i = 0; while ($row = $result->fetchRow()) { - $users[] = [ - 'count' => ++$i, - 'user' => $row[0], - ]; + $users[] = ['count' => ++$i, 'user' => $row[0]]; } } @@ -102,20 +99,14 @@ class UserGroups $userGroupVal['tableTab'] = self::getAllowedTabNames($tabs, 'table'); $userGroupVal['userGroupUrl'] = Url::getFromRoute('/server/user-groups'); $userGroupVal['viewUsersUrl'] = Url::getCommon( - [ - 'viewUsers' => 1, - 'userGroup' => $groupName, - ], + ['viewUsers' => 1, 'userGroup' => $groupName], '', false, ); $userGroupVal['viewUsersIcon'] = Generator::getIcon('b_usrlist', __('View users')); $userGroupVal['editUsersUrl'] = Url::getCommon( - [ - 'editUserGroup' => 1, - 'userGroup' => $groupName, - ], + ['editUserGroup' => 1, 'userGroup' => $groupName], '', false, ); @@ -210,11 +201,7 @@ class UserGroups $urlParams['addUserGroupSubmit'] = '1'; } - $allowedTabs = [ - 'server' => [], - 'db' => [], - 'table' => [], - ]; + $allowedTabs = ['server' => [], 'db' => [], 'table' => []]; if ($userGroup !== null) { $groupTable = Util::backquote($configurableMenusFeature->database) . '.' . Util::backquote($configurableMenusFeature->userGroups); diff --git a/libraries/classes/Controllers/Database/ExportController.php b/libraries/classes/Controllers/Database/ExportController.php index 1d5fcdff54..03924546d4 100644 --- a/libraries/classes/Controllers/Database/ExportController.php +++ b/libraries/classes/Controllers/Database/ExportController.php @@ -56,10 +56,7 @@ final class ExportController extends AbstractController $GLOBALS['urlParams']['goto'] = Url::getFromRoute('/database/export'); - [ - $GLOBALS['tables'], - $GLOBALS['num_tables'], - ] = Util::getDbInfo($request, $GLOBALS['db'], false); + [$GLOBALS['tables'], $GLOBALS['num_tables']] = Util::getDbInfo($request, $GLOBALS['db'], false); // exit if no tables in db found if ($GLOBALS['num_tables'] < 1) { diff --git a/libraries/classes/Controllers/Database/ImportController.php b/libraries/classes/Controllers/Database/ImportController.php index 1f30a5f654..d21e9ec502 100644 --- a/libraries/classes/Controllers/Database/ImportController.php +++ b/libraries/classes/Controllers/Database/ImportController.php @@ -75,11 +75,7 @@ final class ImportController extends AbstractController $charsets = Charsets::getCharsets($this->dbi, $GLOBALS['cfg']['Server']['DisableIS']); $idKey = $_SESSION[$GLOBALS['SESSION_KEY']]['handler']::getIdKey(); - $hiddenInputs = [ - $idKey => $uploadId, - 'import_type' => 'database', - 'db' => $GLOBALS['db'], - ]; + $hiddenInputs = [$idKey => $uploadId, 'import_type' => 'database', 'db' => $GLOBALS['db']]; $default = isset($_GET['format']) ? (string) $_GET['format'] : Plugins::getDefault('Import', 'format'); $choice = Plugins::getChoice($importList, $default); diff --git a/libraries/classes/Controllers/Database/MultiTableQueryController.php b/libraries/classes/Controllers/Database/MultiTableQueryController.php index eabccd6194..6f375c4495 100644 --- a/libraries/classes/Controllers/Database/MultiTableQueryController.php +++ b/libraries/classes/Controllers/Database/MultiTableQueryController.php @@ -23,10 +23,7 @@ class MultiTableQueryController extends AbstractController public function __invoke(ServerRequest $request): void { - $this->addScriptFiles([ - 'database/multi_table_query.js', - 'database/query_generator.js', - ]); + $this->addScriptFiles(['database/multi_table_query.js', 'database/query_generator.js']); $queryInstance = new MultiTableQuery($this->dbi, $this->template, $GLOBALS['db']); diff --git a/libraries/classes/Controllers/Database/PrivilegesController.php b/libraries/classes/Controllers/Database/PrivilegesController.php index 738cfd6543..1c621f5e91 100644 --- a/libraries/classes/Controllers/Database/PrivilegesController.php +++ b/libraries/classes/Controllers/Database/PrivilegesController.php @@ -61,10 +61,7 @@ class PrivilegesController extends AbstractController $isCreateUser = $this->dbi->isCreateUser(); if (! $this->dbi->isSuperUser() && ! $isGrantUser && ! $isCreateUser) { - $this->render('server/sub_page_header', [ - 'type' => 'privileges', - 'is_image' => false, - ]); + $this->render('server/sub_page_header', ['type' => 'privileges', 'is_image' => false]); $this->response->addHTML( Message::error(__('No Privileges')) ->getDisplay(), diff --git a/libraries/classes/Controllers/Database/Structure/ChangePrefixFormController.php b/libraries/classes/Controllers/Database/Structure/ChangePrefixFormController.php index d6fe4c0c85..e888b3355c 100644 --- a/libraries/classes/Controllers/Database/Structure/ChangePrefixFormController.php +++ b/libraries/classes/Controllers/Database/Structure/ChangePrefixFormController.php @@ -33,9 +33,6 @@ final class ChangePrefixFormController extends AbstractController } $this->response->disable(); - $this->render('database/structure/change_prefix_form', [ - 'route' => $route, - 'url_params' => $urlParams, - ]); + $this->render('database/structure/change_prefix_form', ['route' => $route, 'url_params' => $urlParams]); } } diff --git a/libraries/classes/Controllers/Database/Structure/FavoriteTableController.php b/libraries/classes/Controllers/Database/Structure/FavoriteTableController.php index 6915ac1a43..e0dd9ccd07 100644 --- a/libraries/classes/Controllers/Database/Structure/FavoriteTableController.php +++ b/libraries/classes/Controllers/Database/Structure/FavoriteTableController.php @@ -156,10 +156,7 @@ final class FavoriteTableController extends AbstractController // Set flag when localStorage and pmadb(if present) are in sync. $_SESSION['tmpval']['favorites_synced'][$GLOBALS['server']] = true; - return [ - 'favoriteTables' => json_encode($favoriteTables), - 'list' => $favoriteInstance->getHtmlList(), - ]; + return ['favoriteTables' => json_encode($favoriteTables), 'list' => $favoriteInstance->getHtmlList()]; } /** diff --git a/libraries/classes/Controllers/Database/Structure/RealRowCountController.php b/libraries/classes/Controllers/Database/Structure/RealRowCountController.php index f6d6f0ce52..1b163b620b 100644 --- a/libraries/classes/Controllers/Database/Structure/RealRowCountController.php +++ b/libraries/classes/Controllers/Database/Structure/RealRowCountController.php @@ -65,10 +65,7 @@ final class RealRowCountController extends AbstractController $rowCount = $this->dbi ->getTable($GLOBALS['db'], $table['TABLE_NAME']) ->getRealRowCountTable(); - $realRowCountAll[] = [ - 'table' => $table['TABLE_NAME'], - 'row_count' => $rowCount, - ]; + $realRowCountAll[] = ['table' => $table['TABLE_NAME'], 'row_count' => $rowCount]; } $this->response->addJSON(['real_row_count_all' => json_encode($realRowCountAll)]); diff --git a/libraries/classes/Controllers/Database/StructureController.php b/libraries/classes/Controllers/Database/StructureController.php index 4146056823..962b9e746c 100644 --- a/libraries/classes/Controllers/Database/StructureController.php +++ b/libraries/classes/Controllers/Database/StructureController.php @@ -88,11 +88,7 @@ class StructureController extends AbstractController */ private function getDatabaseInfo(ServerRequest $request): void { - [ - $tables, - $numTables, - $totalNumTables, - ] = Util::getDbInfo($request, $GLOBALS['db']); + [$tables, $numTables, $totalNumTables] = Util::getDbInfo($request, $GLOBALS['db']); $this->tables = $tables; $this->numTables = $numTables; @@ -121,10 +117,7 @@ class StructureController extends AbstractController { $GLOBALS['errorUrl'] ??= null; - $parameters = [ - 'sort' => $_REQUEST['sort'] ?? null, - 'sort_order' => $_REQUEST['sort_order'] ?? null, - ]; + $parameters = ['sort' => $_REQUEST['sort'] ?? null, 'sort_order' => $_REQUEST['sort_order'] ?? null]; $this->checkParameters(['db']); @@ -159,10 +152,7 @@ class StructureController extends AbstractController $this->response->addHTML($pageSettings->getHTML()); if ($this->numTables > 0) { - $urlParams = [ - 'pos' => $this->position, - 'db' => $GLOBALS['db'], - ]; + $urlParams = ['pos' => $this->position, 'db' => $GLOBALS['db']]; if (isset($parameters['sort'])) { $urlParams['sort'] = $parameters['sort']; } @@ -234,10 +224,7 @@ class StructureController extends AbstractController $inputClass = ['checkall']; // Sets parameters for links - $tableUrlParams = [ - 'db' => $GLOBALS['db'], - 'table' => $currentTable['TABLE_NAME'], - ]; + $tableUrlParams = ['db' => $GLOBALS['db'], 'table' => $currentTable['TABLE_NAME']]; // do not list the previous table's size info for a view [ @@ -444,10 +431,7 @@ class StructureController extends AbstractController $this->dbi->getDbCollation($GLOBALS['db']), ); if ($collation !== null) { - $databaseCollation = [ - 'name' => $collation->getName(), - 'description' => $collation->getDescription(), - ]; + $databaseCollation = ['name' => $collation->getName(), 'description' => $collation->getDescription()]; $databaseCharset = $collation->getCharset(); } @@ -564,10 +548,7 @@ class StructureController extends AbstractController } } - return [ - $approxRows, - $showSuperscript, - ]; + return [$approxRows, $showSuperscript]; } /** @@ -599,10 +580,7 @@ class StructureController extends AbstractController || $this->hasTable($replicaInfo['Wild_Ignore_Table'], $table); } - return [ - $do, - $ignored, - ]; + return [$do, $ignored]; } /** @@ -806,15 +784,7 @@ class StructureController extends AbstractController } } - return [ - $currentTable, - $formattedSize, - $unit, - $formattedOverhead, - $overheadUnit, - $overheadSize, - $sumSize, - ]; + return [$currentTable, $formattedSize, $unit, $formattedOverhead, $overheadUnit, $overheadSize, $sumSize]; } /** @@ -852,12 +822,7 @@ class StructureController extends AbstractController [$formattedSize, $unit] = Util::formatByteDown($tblsize, 3, ($tblsize > 0 ? 1 : 0)); } - return [ - $currentTable, - $formattedSize, - $unit, - $sumSize, - ]; + return [$currentTable, $formattedSize, $unit, $sumSize]; } /** @@ -882,11 +847,6 @@ class StructureController extends AbstractController [$formattedSize, $unit] = Util::formatByteDown($tblsize, 3, ($tblsize > 0 ? 1 : 0)); } - return [ - $currentTable, - $formattedSize, - $unit, - $sumSize, - ]; + return [$currentTable, $formattedSize, $unit, $sumSize]; } } diff --git a/libraries/classes/Controllers/GisDataEditorController.php b/libraries/classes/Controllers/GisDataEditorController.php index 3405a7632a..e2138f9e12 100644 --- a/libraries/classes/Controllers/GisDataEditorController.php +++ b/libraries/classes/Controllers/GisDataEditorController.php @@ -99,17 +99,8 @@ class GisDataEditorController extends AbstractController $result = "'" . $wkt . "'," . $srid; // Generate SVG based visualization - $visualizationSettings = [ - 'width' => 450, - 'height' => 300, - 'spatialColumn' => 'wkt', - ]; - $data = [ - [ - 'wkt' => $wktWithZero, - 'srid' => $srid, - ], - ]; + $visualizationSettings = ['width' => 450, 'height' => 300, 'spatialColumn' => 'wkt']; + $data = [['wkt' => $wktWithZero, 'srid' => $srid]]; $visualization = GisVisualization::getByData($data, $visualizationSettings); $svg = $visualization->asSVG(); @@ -117,11 +108,7 @@ class GisDataEditorController extends AbstractController // If the call is to update the WKT and visualization make an AJAX response if ($request->hasBodyParam('generate')) { - $this->response->addJSON([ - 'result' => $result, - 'visualization' => $svg, - 'openLayers' => $openLayers, - ]); + $this->response->addJSON(['result' => $result, 'visualization' => $svg, 'openLayers' => $openLayers]); return; } diff --git a/libraries/classes/Controllers/Import/ImportController.php b/libraries/classes/Controllers/Import/ImportController.php index 846cd1b2a3..e71e0b04e5 100644 --- a/libraries/classes/Controllers/Import/ImportController.php +++ b/libraries/classes/Controllers/Import/ImportController.php @@ -248,10 +248,7 @@ final class ImportController extends AbstractController $GLOBALS['format'] = Core::securePath($GLOBALS['format']); if (strlen($GLOBALS['table']) > 0 && strlen($GLOBALS['db']) > 0) { - $GLOBALS['urlParams'] = [ - 'db' => $GLOBALS['db'], - 'table' => $GLOBALS['table'], - ]; + $GLOBALS['urlParams'] = ['db' => $GLOBALS['db'], 'table' => $GLOBALS['table']]; } elseif (strlen($GLOBALS['db']) > 0) { $GLOBALS['urlParams'] = ['db' => $GLOBALS['db']]; } else { diff --git a/libraries/classes/Controllers/Import/StatusController.php b/libraries/classes/Controllers/Import/StatusController.php index b4071739c9..b78dfd44d3 100644 --- a/libraries/classes/Controllers/Import/StatusController.php +++ b/libraries/classes/Controllers/Import/StatusController.php @@ -35,11 +35,7 @@ class StatusController $GLOBALS['plugins'] ??= null; $GLOBALS['timestamp'] ??= null; - [ - $GLOBALS['SESSION_KEY'], - $GLOBALS['upload_id'], - $GLOBALS['plugins'], - ] = Ajax::uploadProgressSetup(); + [$GLOBALS['SESSION_KEY'], $GLOBALS['upload_id'], $GLOBALS['plugins']] = Ajax::uploadProgressSetup(); // $_GET["message"] is used for asking for an import message if ($request->hasQueryParam('message')) { diff --git a/libraries/classes/Controllers/Normalization/AddNewPrimaryController.php b/libraries/classes/Controllers/Normalization/AddNewPrimaryController.php index a8da10f792..3afe4d1876 100644 --- a/libraries/classes/Controllers/Normalization/AddNewPrimaryController.php +++ b/libraries/classes/Controllers/Normalization/AddNewPrimaryController.php @@ -29,10 +29,7 @@ final class AddNewPrimaryController extends AbstractController $dbName = isset($db) ? $db->getName() : ''; $tableName = isset($table) ? $table->getName() : ''; - $columnMeta = [ - 'Field' => $tableName . '_id', - 'Extra' => 'auto_increment', - ]; + $columnMeta = ['Field' => $tableName . '_id', 'Extra' => 'auto_increment']; $html = $this->normalization->getHtmlForCreateNewColumn($numFields, $dbName, $tableName, $columnMeta); $html .= Url::getHiddenInputs($dbName, $tableName); $this->response->addHTML($html); diff --git a/libraries/classes/Controllers/Normalization/MainController.php b/libraries/classes/Controllers/Normalization/MainController.php index 91bde1300b..234bb4e4b6 100644 --- a/libraries/classes/Controllers/Normalization/MainController.php +++ b/libraries/classes/Controllers/Normalization/MainController.php @@ -15,9 +15,6 @@ class MainController extends AbstractController public function __invoke(ServerRequest $request): void { $this->addScriptFiles(['normalization.js', 'vendor/jquery/jquery.uitablefilter.js']); - $this->render('table/normalization/normalization', [ - 'db' => $GLOBALS['db'], - 'table' => $GLOBALS['table'], - ]); + $this->render('table/normalization/normalization', ['db' => $GLOBALS['db'], 'table' => $GLOBALS['table']]); } } diff --git a/libraries/classes/Controllers/Preferences/TwoFactorController.php b/libraries/classes/Controllers/Preferences/TwoFactorController.php index c5f8f027fd..2db7401e1a 100644 --- a/libraries/classes/Controllers/Preferences/TwoFactorController.php +++ b/libraries/classes/Controllers/Preferences/TwoFactorController.php @@ -36,9 +36,7 @@ class TwoFactorController extends AbstractController if ($request->hasBodyParam('2fa_remove')) { if (! $twoFactor->check(true)) { - echo $this->template->render('preferences/two_factor/confirm', [ - 'form' => $twoFactor->render(), - ]); + echo $this->template->render('preferences/two_factor/confirm', ['form' => $twoFactor->render()]); return; } diff --git a/libraries/classes/Controllers/RecentTablesListController.php b/libraries/classes/Controllers/RecentTablesListController.php index 51cbce21c2..4e91a4e626 100644 --- a/libraries/classes/Controllers/RecentTablesListController.php +++ b/libraries/classes/Controllers/RecentTablesListController.php @@ -15,8 +15,6 @@ final class RecentTablesListController extends AbstractController return; } - $this->response->addJSON([ - 'list' => RecentFavoriteTable::getInstance('recent')->getHtmlList(), - ]); + $this->response->addJSON(['list' => RecentFavoriteTable::getInstance('recent')->getHtmlList()]); } } diff --git a/libraries/classes/Controllers/Server/DatabasesController.php b/libraries/classes/Controllers/Server/DatabasesController.php index 2b23804ac1..f94fca9cbb 100644 --- a/libraries/classes/Controllers/Server/DatabasesController.php +++ b/libraries/classes/Controllers/Server/DatabasesController.php @@ -272,10 +272,7 @@ class DatabasesController extends AbstractController ]; } - return [ - 'databases' => $databases, - 'total_statistics' => $totalStatistics, - ]; + return ['databases' => $databases, 'total_statistics' => $totalStatistics]; } /** @@ -286,36 +283,12 @@ class DatabasesController extends AbstractController private function getStatisticsColumns(): array { return [ - 'SCHEMA_TABLES' => [ - 'title' => __('Tables'), - 'format' => 'number', - 'raw' => 0, - ], - 'SCHEMA_TABLE_ROWS' => [ - 'title' => __('Rows'), - 'format' => 'number', - 'raw' => 0, - ], - 'SCHEMA_DATA_LENGTH' => [ - 'title' => __('Data'), - 'format' => 'byte', - 'raw' => 0, - ], - 'SCHEMA_INDEX_LENGTH' => [ - 'title' => __('Indexes'), - 'format' => 'byte', - 'raw' => 0, - ], - 'SCHEMA_LENGTH' => [ - 'title' => __('Total'), - 'format' => 'byte', - 'raw' => 0, - ], - 'SCHEMA_DATA_FREE' => [ - 'title' => __('Overhead'), - 'format' => 'byte', - 'raw' => 0, - ], + 'SCHEMA_TABLES' => ['title' => __('Tables'), 'format' => 'number', 'raw' => 0], + 'SCHEMA_TABLE_ROWS' => ['title' => __('Rows'), 'format' => 'number', 'raw' => 0], + 'SCHEMA_DATA_LENGTH' => ['title' => __('Data'), 'format' => 'byte', 'raw' => 0], + 'SCHEMA_INDEX_LENGTH' => ['title' => __('Indexes'), 'format' => 'byte', 'raw' => 0], + 'SCHEMA_LENGTH' => ['title' => __('Total'), 'format' => 'byte', 'raw' => 0], + 'SCHEMA_DATA_FREE' => ['title' => __('Overhead'), 'format' => 'byte', 'raw' => 0], ]; } } diff --git a/libraries/classes/Controllers/Server/EnginesController.php b/libraries/classes/Controllers/Server/EnginesController.php index a31a9d7499..76aa170fb6 100644 --- a/libraries/classes/Controllers/Server/EnginesController.php +++ b/libraries/classes/Controllers/Server/EnginesController.php @@ -30,8 +30,6 @@ class EnginesController extends AbstractController $this->dbi->selectDb('mysql'); } - $this->render('server/engines/index', [ - 'engines' => StorageEngine::getStorageEngines(), - ]); + $this->render('server/engines/index', ['engines' => StorageEngine::getStorageEngines()]); } } diff --git a/libraries/classes/Controllers/Server/ImportController.php b/libraries/classes/Controllers/Server/ImportController.php index 5d27d92e13..f669b3196c 100644 --- a/libraries/classes/Controllers/Server/ImportController.php +++ b/libraries/classes/Controllers/Server/ImportController.php @@ -71,10 +71,7 @@ final class ImportController extends AbstractController $charsets = Charsets::getCharsets($this->dbi, $GLOBALS['cfg']['Server']['DisableIS']); $idKey = $_SESSION[$GLOBALS['SESSION_KEY']]['handler']::getIdKey(); - $hiddenInputs = [ - $idKey => $uploadId, - 'import_type' => 'server', - ]; + $hiddenInputs = [$idKey => $uploadId, 'import_type' => 'server']; $default = isset($_GET['format']) ? (string) $_GET['format'] : Plugins::getDefault('Import', 'format'); $choice = Plugins::getChoice($importList, $default); diff --git a/libraries/classes/Controllers/Server/PluginsController.php b/libraries/classes/Controllers/Server/PluginsController.php index 40f9d690fe..d2222c7f1c 100644 --- a/libraries/classes/Controllers/Server/PluginsController.php +++ b/libraries/classes/Controllers/Server/PluginsController.php @@ -58,9 +58,6 @@ class PluginsController extends AbstractController ); } - $this->render('server/plugins/index', [ - 'plugins' => $plugins, - 'clean_types' => $cleanTypes, - ]); + $this->render('server/plugins/index', ['plugins' => $plugins, 'clean_types' => $cleanTypes]); } } diff --git a/libraries/classes/Controllers/Server/PrivilegesController.php b/libraries/classes/Controllers/Server/PrivilegesController.php index 42db6c3950..bf612a3f42 100644 --- a/libraries/classes/Controllers/Server/PrivilegesController.php +++ b/libraries/classes/Controllers/Server/PrivilegesController.php @@ -78,10 +78,7 @@ class PrivilegesController extends AbstractController /** * Sets globals from $_POST patterns, for privileges and max_* vars */ - Core::setPostAsGlobal([ - '/_priv$/i', - '/^max_/i', - ]); + Core::setPostAsGlobal(['/_priv$/i', '/^max_/i']); $GLOBALS['errorUrl'] = Url::getFromRoute('/'); @@ -109,10 +106,7 @@ class PrivilegesController extends AbstractController $isCreateUser = $this->dbi->isCreateUser(); if (! $this->dbi->isSuperUser() && ! $isGrantUser && ! $isCreateUser) { - $this->render('server/sub_page_header', [ - 'type' => 'privileges', - 'is_image' => false, - ]); + $this->render('server/sub_page_header', ['type' => 'privileges', 'is_image' => false]); $this->response->addHTML( Message::error(__('No Privileges')) ->getDisplay(), @@ -162,13 +156,7 @@ class PrivilegesController extends AbstractController * Adds a user * (Changes / copies a user, part II) */ - [ - $retMessage, - $queries, - $queriesForDisplay, - $GLOBALS['sql_query'], - $addUserError, - ] = $serverPrivileges->addUser( + [$retMessage, $queries, $queriesForDisplay, $GLOBALS['sql_query'], $addUserError] = $serverPrivileges->addUser( $GLOBALS['dbname'] ?? null, $GLOBALS['username'] ?? '', $GLOBALS['hostname'] ?? '', @@ -365,14 +353,8 @@ class PrivilegesController extends AbstractController if (isset($GLOBALS['dbname']) && ! is_array($GLOBALS['dbname'])) { $urlDbname = urlencode( str_replace( - [ - '\_', - '\%', - ], - [ - '_', - '%', - ], + ['\_', '\%'], + ['_', '%'], $GLOBALS['dbname'], ), ); diff --git a/libraries/classes/Controllers/Server/ShowEngineController.php b/libraries/classes/Controllers/Server/ShowEngineController.php index b76fde64c0..fcbed17d16 100644 --- a/libraries/classes/Controllers/Server/ShowEngineController.php +++ b/libraries/classes/Controllers/Server/ShowEngineController.php @@ -51,9 +51,6 @@ final class ShowEngineController extends AbstractController ]; } - $this->render('server/engines/show', [ - 'engine' => $engine, - 'page' => $page, - ]); + $this->render('server/engines/show', ['engine' => $engine, 'page' => $page]); } } diff --git a/libraries/classes/Controllers/Server/Status/Monitor/ChartingDataController.php b/libraries/classes/Controllers/Server/Status/Monitor/ChartingDataController.php index 528316a011..160073dfae 100644 --- a/libraries/classes/Controllers/Server/Status/Monitor/ChartingDataController.php +++ b/libraries/classes/Controllers/Server/Status/Monitor/ChartingDataController.php @@ -40,8 +40,6 @@ final class ChartingDataController extends AbstractController return; } - $this->response->addJSON([ - 'message' => $this->monitor->getJsonForChartingData($requiredData), - ]); + $this->response->addJSON(['message' => $this->monitor->getJsonForChartingData($requiredData)]); } } diff --git a/libraries/classes/Controllers/Server/Status/VariablesController.php b/libraries/classes/Controllers/Server/Status/VariablesController.php index f3560c4db6..8b89245923 100644 --- a/libraries/classes/Controllers/Server/Status/VariablesController.php +++ b/libraries/classes/Controllers/Server/Status/VariablesController.php @@ -63,11 +63,7 @@ class VariablesController extends AbstractController continue; } - $categories[$sectionId] = [ - 'id' => $sectionId, - 'name' => $sectionName, - 'is_selected' => false, - ]; + $categories[$sectionId] = ['id' => $sectionId, 'name' => $sectionName, 'is_selected' => false]; if (! $filterCategory || $filterCategory !== $sectionId) { continue; } @@ -77,10 +73,7 @@ class VariablesController extends AbstractController $links = []; foreach ($this->data->links as $sectionName => $sectionLinks) { - $links[$sectionName] = [ - 'name' => 'status_' . $sectionName, - 'links' => $sectionLinks, - ]; + $links[$sectionName] = ['name' => 'status_' . $sectionName, 'links' => $sectionLinks]; } $descriptions = $this->getDescriptions(); @@ -121,10 +114,7 @@ class VariablesController extends AbstractController } foreach ($this->data->links[$name] as $linkName => $linkUrl) { - $variables[$name]['description_doc'][] = [ - 'name' => $linkName, - 'url' => $linkUrl, - ]; + $variables[$name]['description_doc'][] = ['name' => $linkName, 'url' => $linkUrl]; } } } @@ -147,11 +137,7 @@ class VariablesController extends AbstractController */ private function flush(string $flush): void { - $flushCommands = [ - 'STATUS', - 'TABLES', - 'QUERY CACHE', - ]; + $flushCommands = ['STATUS', 'TABLES', 'QUERY CACHE']; if (! in_array($flush, $flushCommands)) { return; diff --git a/libraries/classes/Controllers/Server/Variables/GetVariableController.php b/libraries/classes/Controllers/Server/Variables/GetVariableController.php index 8da5a34c2a..2806fa342a 100644 --- a/libraries/classes/Controllers/Server/Variables/GetVariableController.php +++ b/libraries/classes/Controllers/Server/Variables/GetVariableController.php @@ -37,9 +37,7 @@ final class GetVariableController extends AbstractController DatabaseInterface::FETCH_NUM, ); - $json = [ - 'message' => $varValue[1], - ]; + $json = ['message' => $varValue[1]]; $variableType = ServerVariablesProvider::getImplementation()->getVariableType($params['name']); diff --git a/libraries/classes/Controllers/Server/Variables/SetVariableController.php b/libraries/classes/Controllers/Server/Variables/SetVariableController.php index 8cfd130c67..2c14529c38 100644 --- a/libraries/classes/Controllers/Server/Variables/SetVariableController.php +++ b/libraries/classes/Controllers/Server/Variables/SetVariableController.php @@ -50,14 +50,7 @@ final class SetVariableController extends AbstractController $matches, ) ) { - $exp = [ - 'kb' => 1, - 'kib' => 1, - 'mb' => 2, - 'mib' => 2, - 'gb' => 3, - 'gib' => 3, - ]; + $exp = ['kb' => 1, 'kib' => 1, 'mb' => 2, 'mib' => 2, 'gb' => 3, 'gib' => 3]; $value = (float) $matches[1] * 1024 ** $exp[mb_strtolower($matches[3])]; } else { $value = $this->dbi->quoteString($value); @@ -111,10 +104,7 @@ final class SetVariableController extends AbstractController $formattedValue = trim( $this->template->render( 'server/variables/format_variable', - [ - 'valueTitle' => Util::formatNumber($value, 0), - 'value' => implode(' ', $bytes), - ], + ['valueTitle' => Util::formatNumber($value, 0), 'value' => implode(' ', $bytes)], ), ); } else { @@ -122,9 +112,6 @@ final class SetVariableController extends AbstractController } } - return [ - $formattedValue, - $isHtmlFormatted, - ]; + return [$formattedValue, $isHtmlFormatted]; } } diff --git a/libraries/classes/Controllers/Server/VariablesController.php b/libraries/classes/Controllers/Server/VariablesController.php index 2a7355954f..8d4901fb19 100644 --- a/libraries/classes/Controllers/Server/VariablesController.php +++ b/libraries/classes/Controllers/Server/VariablesController.php @@ -114,10 +114,7 @@ class VariablesController extends AbstractController $formattedValue = trim( $this->template->render( 'server/variables/format_variable', - [ - 'valueTitle' => Util::formatNumber($value, 0), - 'value' => implode(' ', $bytes), - ], + ['valueTitle' => Util::formatNumber($value, 0), 'value' => implode(' ', $bytes)], ), ); } else { @@ -125,9 +122,6 @@ class VariablesController extends AbstractController } } - return [ - $formattedValue, - $isHtmlFormatted, - ]; + return [$formattedValue, $isHtmlFormatted]; } } diff --git a/libraries/classes/Controllers/Setup/AbstractController.php b/libraries/classes/Controllers/Setup/AbstractController.php index 165c37f13e..1f6e8639f3 100644 --- a/libraries/classes/Controllers/Setup/AbstractController.php +++ b/libraries/classes/Controllers/Setup/AbstractController.php @@ -20,10 +20,7 @@ abstract class AbstractController /** @return array */ protected function getPages(): array { - $ignored = [ - 'Config', - 'Servers', - ]; + $ignored = ['Config', 'Servers']; $pages = []; foreach (SetupFormList::getAllFormNames() as $formset) { if (in_array($formset, $ignored)) { @@ -33,10 +30,7 @@ abstract class AbstractController /** @var BaseForm $formClass */ $formClass = SetupFormList::get($formset); - $pages[$formset] = [ - 'name' => $formClass::getName(), - 'formset' => $formset, - ]; + $pages[$formset] = ['name' => $formClass::getName(), 'formset' => $formset]; } return $pages; diff --git a/libraries/classes/Controllers/Setup/HomeController.php b/libraries/classes/Controllers/Setup/HomeController.php index 4130960e45..3684c46384 100644 --- a/libraries/classes/Controllers/Setup/HomeController.php +++ b/libraries/classes/Controllers/Setup/HomeController.php @@ -73,16 +73,8 @@ class HomeController extends AbstractController 'dsn' => $this->config->getServerDSN($id), 'params' => [ 'token' => $_SESSION[' PMA_token '], - 'edit' => [ - 'page' => 'servers', - 'mode' => 'edit', - 'id' => $id, - ], - 'remove' => [ - 'page' => 'servers', - 'mode' => 'remove', - 'id' => $id, - ], + 'edit' => ['page' => 'servers', 'mode' => 'edit', 'id' => $id], + 'remove' => ['page' => 'servers', 'mode' => 'remove', 'id' => $id], ], ]; } diff --git a/libraries/classes/Controllers/Setup/MainController.php b/libraries/classes/Controllers/Setup/MainController.php index f4a143109e..4d72938b2a 100644 --- a/libraries/classes/Controllers/Setup/MainController.php +++ b/libraries/classes/Controllers/Setup/MainController.php @@ -65,9 +65,7 @@ final class MainController /** @var mixed $mode */ $mode = $request->getQueryParam('mode'); if ($mode === 'remove' && $request->isPost()) { - $controller->destroy([ - 'id' => $request->getQueryParam('id'), - ]); + $controller->destroy(['id' => $request->getQueryParam('id')]); header('Location: ../setup/index.php' . Url::getCommonRaw(['route' => '/setup'])); return; diff --git a/libraries/classes/Controllers/Table/AddFieldController.php b/libraries/classes/Controllers/Table/AddFieldController.php index d8c180b7e6..588dd9041b 100644 --- a/libraries/classes/Controllers/Table/AddFieldController.php +++ b/libraries/classes/Controllers/Table/AddFieldController.php @@ -65,10 +65,7 @@ class AddFieldController extends AbstractController /** * Defines the url to return to in case of error in a sql statement */ - $GLOBALS['errorUrl'] = Url::getFromRoute('/table/sql', [ - 'db' => $GLOBALS['db'], - 'table' => $GLOBALS['table'], - ]); + $GLOBALS['errorUrl'] = Url::getFromRoute('/table/sql', ['db' => $GLOBALS['db'], 'table' => $GLOBALS['table']]); // check number of fields to be created if (isset($_POST['submit_num_fields'])) { diff --git a/libraries/classes/Controllers/Table/ExportController.php b/libraries/classes/Controllers/Table/ExportController.php index c7e0949857..4ef854f2d1 100644 --- a/libraries/classes/Controllers/Table/ExportController.php +++ b/libraries/classes/Controllers/Table/ExportController.php @@ -65,17 +65,11 @@ class ExportController extends AbstractController if (! empty($parser->statements[0]) && ($parser->statements[0] instanceof SelectStatement)) { // Checking if the WHERE clause has to be replaced. if (! empty($GLOBALS['where_clause']) && is_array($GLOBALS['where_clause'])) { - $GLOBALS['replaces'][] = [ - 'WHERE', - 'WHERE (' . implode(') OR (', $GLOBALS['where_clause']) . ')', - ]; + $GLOBALS['replaces'][] = ['WHERE', 'WHERE (' . implode(') OR (', $GLOBALS['where_clause']) . ')']; } // Preparing to remove the LIMIT clause. - $GLOBALS['replaces'][] = [ - 'LIMIT', - '', - ]; + $GLOBALS['replaces'][] = ['LIMIT', '']; // Replacing the clauses. $GLOBALS['sql_query'] = Query::replaceClauses( diff --git a/libraries/classes/Controllers/Table/FindReplaceController.php b/libraries/classes/Controllers/Table/FindReplaceController.php index 86c507520b..c8f5e31a17 100644 --- a/libraries/classes/Controllers/Table/FindReplaceController.php +++ b/libraries/classes/Controllers/Table/FindReplaceController.php @@ -260,18 +260,7 @@ class FindReplaceController extends AbstractController $result = $this->dbi->fetchResult($sqlQuery, 0); /* Iterate over possible delimiters to get one */ - $delimiters = [ - '/', - '@', - '#', - '~', - '!', - '$', - '%', - '^', - '&', - '_', - ]; + $delimiters = ['/', '@', '#', '~', '!', '$', '%', '^', '&', '_']; foreach ($delimiters as $delimiter) { if (! str_contains($find, $delimiter)) { diff --git a/libraries/classes/Controllers/Table/IndexRenameController.php b/libraries/classes/Controllers/Table/IndexRenameController.php index 72c90256d5..dbf1f1cb65 100644 --- a/libraries/classes/Controllers/Table/IndexRenameController.php +++ b/libraries/classes/Controllers/Table/IndexRenameController.php @@ -72,10 +72,7 @@ final class IndexRenameController extends AbstractController { $this->dbi->selectDb($GLOBALS['db']); - $formParams = [ - 'db' => $GLOBALS['db'], - 'table' => $GLOBALS['table'], - ]; + $formParams = ['db' => $GLOBALS['db'], 'table' => $GLOBALS['table']]; if (isset($_POST['old_index'])) { $formParams['old_index'] = $_POST['old_index']; @@ -83,9 +80,6 @@ final class IndexRenameController extends AbstractController $formParams['old_index'] = $_POST['index']; } - $this->render('table/index_rename_form', [ - 'index' => $index, - 'form_params' => $formParams, - ]); + $this->render('table/index_rename_form', ['index' => $index, 'form_params' => $formParams]); } } diff --git a/libraries/classes/Controllers/Table/IndexesController.php b/libraries/classes/Controllers/Table/IndexesController.php index f530e84213..4f131b741b 100644 --- a/libraries/classes/Controllers/Table/IndexesController.php +++ b/libraries/classes/Controllers/Table/IndexesController.php @@ -107,9 +107,7 @@ class IndexesController extends AbstractController // Get fields and stores their name/type if (isset($_POST['create_edit_table'])) { $fields = json_decode($_POST['columns'], true); - $indexParams = [ - 'Non_unique' => $_POST['index']['Index_choice'] !== 'UNIQUE', - ]; + $indexParams = ['Non_unique' => $_POST['index']['Index_choice'] !== 'UNIQUE']; $index->set($indexParams); $addFields = count($fields); } else { @@ -117,10 +115,7 @@ class IndexesController extends AbstractController ->getNameAndTypeOfTheColumns(); } - $formParams = [ - 'db' => $GLOBALS['db'], - 'table' => $GLOBALS['table'], - ]; + $formParams = ['db' => $GLOBALS['db'], 'table' => $GLOBALS['table']]; if (isset($_POST['create_index'])) { $formParams['create_index'] = 1; diff --git a/libraries/classes/Controllers/Table/Maintenance/AnalyzeController.php b/libraries/classes/Controllers/Table/Maintenance/AnalyzeController.php index 0fedeeb1c2..11bd0d8c1e 100644 --- a/libraries/classes/Controllers/Table/Maintenance/AnalyzeController.php +++ b/libraries/classes/Controllers/Table/Maintenance/AnalyzeController.php @@ -76,9 +76,6 @@ final class AnalyzeController extends AbstractController 'success', ); - $this->render('table/maintenance/analyze', [ - 'message' => $message, - 'rows' => $rows, - ]); + $this->render('table/maintenance/analyze', ['message' => $message, 'rows' => $rows]); } } diff --git a/libraries/classes/Controllers/Table/Maintenance/ChecksumController.php b/libraries/classes/Controllers/Table/Maintenance/ChecksumController.php index a43403a48a..c4290abf29 100644 --- a/libraries/classes/Controllers/Table/Maintenance/ChecksumController.php +++ b/libraries/classes/Controllers/Table/Maintenance/ChecksumController.php @@ -76,10 +76,6 @@ final class ChecksumController extends AbstractController 'success', ); - $this->render('table/maintenance/checksum', [ - 'message' => $message, - 'rows' => $rows, - 'warnings' => $warnings, - ]); + $this->render('table/maintenance/checksum', ['message' => $message, 'rows' => $rows, 'warnings' => $warnings]); } } diff --git a/libraries/classes/Controllers/Table/Maintenance/OptimizeController.php b/libraries/classes/Controllers/Table/Maintenance/OptimizeController.php index 5012b9720a..b022b9fdad 100644 --- a/libraries/classes/Controllers/Table/Maintenance/OptimizeController.php +++ b/libraries/classes/Controllers/Table/Maintenance/OptimizeController.php @@ -76,9 +76,6 @@ final class OptimizeController extends AbstractController 'success', ); - $this->render('table/maintenance/optimize', [ - 'message' => $message, - 'rows' => $rows, - ]); + $this->render('table/maintenance/optimize', ['message' => $message, 'rows' => $rows]); } } diff --git a/libraries/classes/Controllers/Table/Maintenance/RepairController.php b/libraries/classes/Controllers/Table/Maintenance/RepairController.php index f4926da664..fe59f47680 100644 --- a/libraries/classes/Controllers/Table/Maintenance/RepairController.php +++ b/libraries/classes/Controllers/Table/Maintenance/RepairController.php @@ -76,9 +76,6 @@ final class RepairController extends AbstractController 'success', ); - $this->render('table/maintenance/repair', [ - 'message' => $message, - 'rows' => $rows, - ]); + $this->render('table/maintenance/repair', ['message' => $message, 'rows' => $rows]); } } diff --git a/libraries/classes/Controllers/Table/Partition/DropController.php b/libraries/classes/Controllers/Table/Partition/DropController.php index 551e169209..7fd85ff653 100644 --- a/libraries/classes/Controllers/Table/Partition/DropController.php +++ b/libraries/classes/Controllers/Table/Partition/DropController.php @@ -64,9 +64,6 @@ final class DropController extends AbstractController ); } - $this->render('table/partition/drop', [ - 'partition_name' => $partitionName, - 'message' => $message, - ]); + $this->render('table/partition/drop', ['partition_name' => $partitionName, 'message' => $message]); } } diff --git a/libraries/classes/Controllers/Table/Partition/RebuildController.php b/libraries/classes/Controllers/Table/Partition/RebuildController.php index 48fc8a4673..a73cca5c4d 100644 --- a/libraries/classes/Controllers/Table/Partition/RebuildController.php +++ b/libraries/classes/Controllers/Table/Partition/RebuildController.php @@ -64,9 +64,6 @@ final class RebuildController extends AbstractController ); } - $this->render('table/partition/rebuild', [ - 'partition_name' => $partitionName, - 'message' => $message, - ]); + $this->render('table/partition/rebuild', ['partition_name' => $partitionName, 'message' => $message]); } } diff --git a/libraries/classes/Controllers/Table/Partition/TruncateController.php b/libraries/classes/Controllers/Table/Partition/TruncateController.php index c4d24dc109..376609e460 100644 --- a/libraries/classes/Controllers/Table/Partition/TruncateController.php +++ b/libraries/classes/Controllers/Table/Partition/TruncateController.php @@ -64,9 +64,6 @@ final class TruncateController extends AbstractController ); } - $this->render('table/partition/truncate', [ - 'partition_name' => $partitionName, - 'message' => $message, - ]); + $this->render('table/partition/truncate', ['partition_name' => $partitionName, 'message' => $message]); } } diff --git a/libraries/classes/Controllers/Table/PrivilegesController.php b/libraries/classes/Controllers/Table/PrivilegesController.php index 10590e57bb..62f03b2148 100644 --- a/libraries/classes/Controllers/Table/PrivilegesController.php +++ b/libraries/classes/Controllers/Table/PrivilegesController.php @@ -64,10 +64,7 @@ class PrivilegesController extends AbstractController $isCreateUser = $this->dbi->isCreateUser(); if (! $this->dbi->isSuperUser() && ! $isGrantUser && ! $isCreateUser) { - $this->render('server/sub_page_header', [ - 'type' => 'privileges', - 'is_image' => false, - ]); + $this->render('server/sub_page_header', ['type' => 'privileges', 'is_image' => false]); $this->response->addHTML( Message::error(__('No Privileges')) ->getDisplay(), diff --git a/libraries/classes/Controllers/Table/RelationController.php b/libraries/classes/Controllers/Table/RelationController.php index b096c9b57d..052c78ac3c 100644 --- a/libraries/classes/Controllers/Table/RelationController.php +++ b/libraries/classes/Controllers/Table/RelationController.php @@ -251,12 +251,7 @@ final class RelationController extends AbstractController isset($_POST['destination_foreign_db'], $_POST['destination_foreign_table']) && isset($_POST['destination_foreign_column']) ) { - [ - $html, - $previewSqlData, - $displayQuery, - $seenError, - ] = $table->updateForeignKeys( + [$html, $previewSqlData, $displayQuery, $seenError] = $table->updateForeignKeys( $_POST['destination_foreign_db'], $multiEditColumnsName, $_POST['destination_foreign_table'], diff --git a/libraries/classes/Controllers/Table/ReplaceController.php b/libraries/classes/Controllers/Table/ReplaceController.php index eb06026fe1..ccacb56c30 100644 --- a/libraries/classes/Controllers/Table/ReplaceController.php +++ b/libraries/classes/Controllers/Table/ReplaceController.php @@ -72,10 +72,7 @@ final class ReplaceController extends AbstractController $insertRows = $_POST['insert_rows'] ?? null; if (is_numeric($insertRows) && $insertRows != $GLOBALS['cfg']['InsertRows']) { // check whether insert row mode, if so include /table/change - $this->addScriptFiles([ - 'vendor/jquery/additional-methods.js', - 'table/change.js', - ]); + $this->addScriptFiles(['vendor/jquery/additional-methods.js', 'table/change.js']); $GLOBALS['cfg']['InsertRows'] = $_POST['insert_rows']; /** @var ChangeController $controller */ $controller = Core::getContainerBuilder()->get(ChangeController::class); @@ -84,11 +81,7 @@ final class ReplaceController extends AbstractController return; } - $afterInsertActions = [ - 'new_insert', - 'same_insert', - 'edit_next', - ]; + $afterInsertActions = ['new_insert', 'same_insert', 'edit_next']; if (isset($_POST['after_insert']) && in_array($_POST['after_insert'], $afterInsertActions)) { $GLOBALS['urlParams']['after_insert'] = $_POST['after_insert']; if (isset($_POST['where_clause'])) { @@ -111,12 +104,7 @@ final class ReplaceController extends AbstractController /** * Prepares the update/insert of a row */ - [ - $loopArray, - $usingKey, - $isInsert, - $isInsertignore, - ] = $this->insertEdit->getParamsForUpdateOrInsert(); + [$loopArray, $usingKey, $isInsert, $isInsertignore] = $this->insertEdit->getParamsForUpdateOrInsert(); $GLOBALS['query'] = []; $valueSets = []; @@ -433,10 +421,7 @@ final class ReplaceController extends AbstractController $extraData = []; } - $transformationTypes = [ - 'input_transformation', - 'transformation', - ]; + $transformationTypes = ['input_transformation', 'transformation']; foreach ($mimeMap as $transformation) { $columnName = $transformation['column_name']; foreach ($transformationTypes as $type) { diff --git a/libraries/classes/Controllers/Table/SearchController.php b/libraries/classes/Controllers/Table/SearchController.php index 9a5f05049c..e6902c3de9 100644 --- a/libraries/classes/Controllers/Table/SearchController.php +++ b/libraries/classes/Controllers/Table/SearchController.php @@ -395,11 +395,6 @@ class SearchController extends AbstractController 'is_float' => $isFloat, ]); - return [ - 'type' => $type, - 'collation' => $collation, - 'func' => $func, - 'value' => $value, - ]; + return ['type' => $type, 'collation' => $collation, 'func' => $func, 'value' => $value]; } } diff --git a/libraries/classes/Controllers/Table/Structure/MoveColumnsController.php b/libraries/classes/Controllers/Table/Structure/MoveColumnsController.php index 5279f456f7..48e843db8b 100644 --- a/libraries/classes/Controllers/Table/Structure/MoveColumnsController.php +++ b/libraries/classes/Controllers/Table/Structure/MoveColumnsController.php @@ -94,12 +94,7 @@ final class MoveColumnsController extends AbstractController $defaultType = 'USER_DEFINED'; } - $virtual = [ - 'VIRTUAL', - 'PERSISTENT', - 'VIRTUAL GENERATED', - 'STORED GENERATED', - ]; + $virtual = ['VIRTUAL', 'PERSISTENT', 'VIRTUAL GENERATED', 'STORED GENERATED']; $data['Virtuality'] = ''; $data['Expression'] = ''; if (isset($data['Extra']) && in_array($data['Extra'], $virtual)) { diff --git a/libraries/classes/Controllers/Table/Structure/SaveController.php b/libraries/classes/Controllers/Table/Structure/SaveController.php index f24acdcbd3..0c1a8824dd 100644 --- a/libraries/classes/Controllers/Table/Structure/SaveController.php +++ b/libraries/classes/Controllers/Table/Structure/SaveController.php @@ -64,10 +64,7 @@ final class SaveController extends AbstractController */ private function updateColumns(): bool { - $errUrl = Url::getFromRoute('/table/structure', [ - 'db' => $GLOBALS['db'], - 'table' => $GLOBALS['table'], - ]); + $errUrl = Url::getFromRoute('/table/structure', ['db' => $GLOBALS['db'], 'table' => $GLOBALS['table']]); $regenerate = false; $fieldCnt = count($_POST['field_name'] ?? []); $changes = []; diff --git a/libraries/classes/Controllers/Table/StructureController.php b/libraries/classes/Controllers/Table/StructureController.php index 9c1ca38d01..e71017970f 100644 --- a/libraries/classes/Controllers/Table/StructureController.php +++ b/libraries/classes/Controllers/Table/StructureController.php @@ -356,10 +356,7 @@ class StructureController extends AbstractController $GLOBALS['tbl_collation'], ); if ($collation !== null) { - $tableCollation = [ - 'name' => $collation->getName(), - 'description' => $collation->getDescription(), - ]; + $tableCollation = ['name' => $collation->getName(), 'description' => $collation->getDescription()]; } if (isset($GLOBALS['showtable']['Create_time'])) { diff --git a/libraries/classes/Controllers/Table/ZoomSearchController.php b/libraries/classes/Controllers/Table/ZoomSearchController.php index 08a1244356..fc7bd48c50 100644 --- a/libraries/classes/Controllers/Table/ZoomSearchController.php +++ b/libraries/classes/Controllers/Table/ZoomSearchController.php @@ -480,11 +480,6 @@ class ZoomSearchController extends AbstractController 'is_float' => $isFloat, ]); - return [ - 'type' => $type, - 'collation' => $collation, - 'func' => $func, - 'value' => $value, - ]; + return ['type' => $type, 'collation' => $collation, 'func' => $func, 'value' => $value]; } } diff --git a/libraries/classes/Controllers/Transformation/OverviewController.php b/libraries/classes/Controllers/Transformation/OverviewController.php index d8998d6ece..5fe5e942d5 100644 --- a/libraries/classes/Controllers/Transformation/OverviewController.php +++ b/libraries/classes/Controllers/Transformation/OverviewController.php @@ -34,16 +34,10 @@ class OverviewController extends AbstractController $mimeTypes = []; foreach ($types['mimetype'] as $mimeType) { - $mimeTypes[] = [ - 'name' => $mimeType, - 'is_empty' => isset($types['empty_mimetype'][$mimeType]), - ]; + $mimeTypes[] = ['name' => $mimeType, 'is_empty' => isset($types['empty_mimetype'][$mimeType])]; } - $transformations = [ - 'transformation' => [], - 'input_transformation' => [], - ]; + $transformations = ['transformation' => [], 'input_transformation' => []]; foreach (array_keys($transformations) as $type) { foreach ($types[$type] as $key => $transformation) { @@ -54,9 +48,6 @@ class OverviewController extends AbstractController } } - $this->render('transformation_overview', [ - 'mime_types' => $mimeTypes, - 'transformations' => $transformations, - ]); + $this->render('transformation_overview', ['mime_types' => $mimeTypes, 'transformations' => $transformations]); } } diff --git a/libraries/classes/Controllers/VersionCheckController.php b/libraries/classes/Controllers/VersionCheckController.php index 8ff35af01f..3030514dc9 100644 --- a/libraries/classes/Controllers/VersionCheckController.php +++ b/libraries/classes/Controllers/VersionCheckController.php @@ -55,9 +55,6 @@ class VersionCheckController extends AbstractController $date = $latestCompatible['date']; } - echo json_encode([ - 'version' => ! empty($version) ? $version : '', - 'date' => ! empty($date) ? $date : '', - ]); + echo json_encode(['version' => ! empty($version) ? $version : '', 'date' => ! empty($date) ? $date : '']); } } diff --git a/libraries/classes/Controllers/View/CreateController.php b/libraries/classes/Controllers/View/CreateController.php index 0e6ce99408..df148a1ef6 100644 --- a/libraries/classes/Controllers/View/CreateController.php +++ b/libraries/classes/Controllers/View/CreateController.php @@ -34,21 +34,11 @@ use function substr; class CreateController extends AbstractController { /** @todo Move the whole view rebuilding logic to SQL parser */ - private const VIEW_SECURITY_OPTIONS = [ - 'DEFINER', - 'INVOKER', - ]; + private const VIEW_SECURITY_OPTIONS = ['DEFINER', 'INVOKER']; - private const VIEW_ALGORITHM_OPTIONS = [ - 'UNDEFINED', - 'MERGE', - 'TEMPTABLE', - ]; + private const VIEW_ALGORITHM_OPTIONS = ['UNDEFINED', 'MERGE', 'TEMPTABLE']; - private const VIEW_WITH_OPTIONS = [ - 'CASCADED', - 'LOCAL', - ]; + private const VIEW_WITH_OPTIONS = ['CASCADED', 'LOCAL']; public function __construct(ResponseRenderer $response, Template $template, private DatabaseInterface $dbi) { diff --git a/libraries/classes/Core.php b/libraries/classes/Core.php index 42cb79fade..422d98a368 100644 --- a/libraries/classes/Core.php +++ b/libraries/classes/Core.php @@ -83,16 +83,7 @@ class Core public static function getPHPDocLink(string $target): string { /* List of PHP documentation translations */ - $phpDocLanguages = [ - 'pt_BR', - 'zh_CN', - 'fr', - 'de', - 'ja', - 'ru', - 'es', - 'tr', - ]; + $phpDocLanguages = ['pt_BR', 'zh_CN', 'fr', 'de', 'ja', 'ru', 'es', 'tr']; $lang = 'en'; if (isset($GLOBALS['lang']) && in_array($GLOBALS['lang'], $phpDocLanguages)) { diff --git a/libraries/classes/CreateAddField.php b/libraries/classes/CreateAddField.php index 193366e10e..740deb6d40 100644 --- a/libraries/classes/CreateAddField.php +++ b/libraries/classes/CreateAddField.php @@ -41,14 +41,7 @@ class CreateAddField $fieldFullText = json_decode($_POST['fulltext_indexes'], true); $fieldSpatial = json_decode($_POST['spatial_indexes'], true); - return [ - $fieldCount, - $fieldPrimary, - $fieldIndex, - $fieldUnique, - $fieldFullText, - $fieldSpatial, - ]; + return [$fieldCount, $fieldPrimary, $fieldIndex, $fieldUnique, $fieldFullText, $fieldSpatial]; } /** diff --git a/libraries/classes/Database/CentralColumns.php b/libraries/classes/Database/CentralColumns.php index 8f9c7a3f64..aea97b6d50 100644 --- a/libraries/classes/Database/CentralColumns.php +++ b/libraries/classes/Database/CentralColumns.php @@ -941,10 +941,7 @@ class CentralColumns foreach ($charsets as $charset) { $collationsList = []; foreach ($collations[$charset->getName()] as $collation) { - $collationsList[] = [ - 'name' => $collation->getName(), - 'description' => $collation->getDescription(), - ]; + $collationsList[] = ['name' => $collation->getName(), 'description' => $collation->getDescription()]; } $charsetsList[] = [ diff --git a/libraries/classes/Database/Designer/Common.php b/libraries/classes/Database/Designer/Common.php index ac78912eb2..c28c8c0c00 100644 --- a/libraries/classes/Database/Designer/Common.php +++ b/libraries/classes/Database/Designer/Common.php @@ -171,10 +171,7 @@ class Common $retval[$ti][$cNameI] = []; if (in_array($dtnI, $tableDbNames) && in_array($con['STN'][$i], $tableDbNames)) { $retval[$ti][$cNameI][$dtnI] = []; - $retval[$ti][$cNameI][$dtnI][$con['DCN'][$i]] = [ - 0 => $con['STN'][$i], - 1 => $con['SCN'][$i], - ]; + $retval[$ti][$cNameI][$dtnI][$con['DCN'][$i]] = [0 => $con['STN'][$i], 1 => $con['SCN'][$i]]; } $ti++; @@ -234,10 +231,7 @@ class Common */ public function getScriptTabs(array $designerTables): array { - $retval = [ - 'j_tabs' => [], - 'h_tabs' => [], - ]; + $retval = ['j_tabs' => [], 'h_tabs' => []]; foreach ($designerTables as $designerTable) { $key = rawurlencode($designerTable->getDbTableString()); @@ -490,10 +484,7 @@ class Common $updQuery = new Table($table, $db, $this->dbi); $updQuery->updateDisplayField($field, $displayFeature); - return [ - true, - null, - ]; + return [true, null]; } /** @@ -534,10 +525,7 @@ class Common $existRelForeign = $this->relation->getForeigners($db2, $t2, '', 'foreign'); $foreigner = $this->relation->searchColumnInForeigners($existRelForeign, $f2); if ($foreigner && isset($foreigner['constraint'])) { - return [ - false, - __('Error: relationship already exists.'), - ]; + return [false, __('Error: relationship already exists.')]; } // note: in InnoDB, the index does not requires to be on a PRIMARY @@ -586,33 +574,20 @@ class Common $updQuery .= ';'; if ($this->dbi->tryQuery($updQuery)) { - return [ - true, - __('FOREIGN KEY relationship has been added.'), - ]; + return [true, __('FOREIGN KEY relationship has been added.')]; } $error = $this->dbi->getError(); - return [ - false, - __('Error: FOREIGN KEY relationship could not be added!') - . '
' . $error, - ]; + return [false, __('Error: FOREIGN KEY relationship could not be added!') . '
' . $error]; } - return [ - false, - __('Error: Missing index on column(s).'), - ]; + return [false, __('Error: Missing index on column(s).')]; } $relationFeature = $this->relation->getRelationParameters()->relationFeature; if ($relationFeature === null) { - return [ - false, - __('Error: Relational features are disabled!'), - ]; + return [false, __('Error: Relational features are disabled!')]; } // no need to recheck if the keys are primary or unique at this point, @@ -633,19 +608,12 @@ class Common . "'" . $this->dbi->escapeString($f1) . "')"; if ($this->dbi->tryQueryAsControlUser($q)) { - return [ - true, - __('Internal relationship has been added.'), - ]; + return [true, __('Internal relationship has been added.')]; } $error = $this->dbi->getError(Connection::TYPE_CONTROL); - return [ - false, - __('Error: Internal relationship could not be added!') - . '
' . $error, - ]; + return [false, __('Error: Internal relationship could not be added!') . '
' . $error]; } /** @@ -679,19 +647,13 @@ class Common . Util::backquote($foreigner['constraint']) . ';'; $this->dbi->query($updQuery); - return [ - true, - __('FOREIGN KEY relationship has been removed.'), - ]; + return [true, __('FOREIGN KEY relationship has been removed.')]; } } $relationFeature = $this->relation->getRelationParameters()->relationFeature; if ($relationFeature === null) { - return [ - false, - __('Error: Relational features are disabled!'), - ]; + return [false, __('Error: Relational features are disabled!')]; } // internal relations @@ -710,16 +672,10 @@ class Common if (! $result) { $error = $this->dbi->getError(Connection::TYPE_CONTROL); - return [ - false, - __('Error: Internal relationship could not be removed!') . '
' . $error, - ]; + return [false, __('Error: Internal relationship could not be removed!') . '
' . $error]; } - return [ - true, - __('Internal relationship has been removed.'), - ]; + return [true, __('Internal relationship has been removed.')]; } /** diff --git a/libraries/classes/Database/Events.php b/libraries/classes/Database/Events.php index fe0a11ccb0..1d8bdccef7 100644 --- a/libraries/classes/Database/Events.php +++ b/libraries/classes/Database/Events.php @@ -608,11 +608,7 @@ class Events $events = $this->dbi->fetchResult($query); foreach ($events as $event) { - $result[] = [ - 'name' => $event['Name'], - 'type' => $event['Type'], - 'status' => $event['Status'], - ]; + $result[] = ['name' => $event['Name'], 'type' => $event['Type'], 'status' => $event['Status']]; } // Sort results by name diff --git a/libraries/classes/Database/Qbe.php b/libraries/classes/Database/Qbe.php index b739327ba2..92851652ed 100644 --- a/libraries/classes/Database/Qbe.php +++ b/libraries/classes/Database/Qbe.php @@ -1109,10 +1109,7 @@ class Qbe } } - return [ - 'unique' => $uniqueColumns, - 'index' => $indexColumns, - ]; + return ['unique' => $uniqueColumns, 'index' => $indexColumns]; } /** @@ -1302,10 +1299,7 @@ class Qbe $whereClauseTables[$table] = $table; } - return [ - 'where_clause_tables' => $whereClauseTables, - 'where_clause_columns' => $whereClauseColumns, - ]; + return ['where_clause_tables' => $whereClauseTables, 'where_clause_columns' => $whereClauseColumns]; } /** @@ -1712,38 +1706,26 @@ class Qbe $candidateColumns = $uniqueColumns; $needSort = 1; - return [ - $candidateColumns, - $needSort, - ]; + return [$candidateColumns, $needSort]; } if (isset($indexColumns) && count($indexColumns) > 0) { $candidateColumns = $indexColumns; $needSort = 1; - return [ - $candidateColumns, - $needSort, - ]; + return [$candidateColumns, $needSort]; } if (isset($whereClauseColumns) && count($whereClauseColumns) > 0) { $candidateColumns = $whereClauseColumns; $needSort = 0; - return [ - $candidateColumns, - $needSort, - ]; + return [$candidateColumns, $needSort]; } $candidateColumns = $searchTables; $needSort = 0; - return [ - $candidateColumns, - $needSort, - ]; + return [$candidateColumns, $needSort]; } } diff --git a/libraries/classes/Database/Routines.php b/libraries/classes/Database/Routines.php index 465a34539a..633370c18e 100644 --- a/libraries/classes/Database/Routines.php +++ b/libraries/classes/Database/Routines.php @@ -343,10 +343,7 @@ class Routines $errors = $this->checkResult($createRoutine, $errors); } - return [ - $errors, - null, - ]; + return [$errors, null]; } // Default value @@ -373,10 +370,7 @@ class Routines $message = $this->flushPrivileges($resultAdjust); - return [ - [], - $message, - ]; + return [[], $message]; } /** diff --git a/libraries/classes/Database/Search.php b/libraries/classes/Database/Search.php index 544666c581..55cf270ba3 100644 --- a/libraries/classes/Database/Search.php +++ b/libraries/classes/Database/Search.php @@ -231,11 +231,7 @@ class Search $resultCount = (int) $this->dbi->fetchValue($newSearchSqls['select_count']); $resultTotal += $resultCount; // Gets the result row's HTML for a table - $rows[] = [ - 'table' => $eachTable, - 'new_search_sqls' => $newSearchSqls, - 'result_count' => $resultCount, - ]; + $rows[] = ['table' => $eachTable, 'new_search_sqls' => $newSearchSqls, 'result_count' => $resultCount]; } return $this->template->render('database/search/results', [ diff --git a/libraries/classes/DatabaseInterface.php b/libraries/classes/DatabaseInterface.php index 08e7eec7c7..2624d29104 100644 --- a/libraries/classes/DatabaseInterface.php +++ b/libraries/classes/DatabaseInterface.php @@ -415,10 +415,7 @@ class DatabaseInterface implements DbalInterface /** @var mixed[][][] $tables */ $tables = $this->fetchResult( $sql, - [ - 'TABLE_SCHEMA', - 'TABLE_NAME', - ], + ['TABLE_SCHEMA', 'TABLE_NAME'], null, $connectionType, ); diff --git a/libraries/classes/Display/Results.php b/libraries/classes/Display/Results.php index 24ac2087c3..9cab419279 100644 --- a/libraries/classes/Display/Results.php +++ b/libraries/classes/Display/Results.php @@ -301,16 +301,10 @@ class Results 'views' => ['view_definition' => $sqlHighlightingData], ], 'mysql' => [ - 'event' => [ - 'body' => $blobSqlHighlightingData, - 'body_utf8' => $blobSqlHighlightingData, - ], + 'event' => ['body' => $blobSqlHighlightingData, 'body_utf8' => $blobSqlHighlightingData], 'general_log' => ['argument' => $sqlHighlightingData], 'help_category' => ['url' => $linkData], - 'help_topic' => [ - 'example' => $sqlHighlightingData, - 'url' => $linkData, - ], + 'help_topic' => ['example' => $sqlHighlightingData, 'url' => $linkData], 'proc' => [ 'param_list' => $blobSqlHighlightingData, 'returns' => $blobSqlHighlightingData, @@ -611,10 +605,7 @@ class Results // if for COUNT query, number of rows returned more than 1 // (may be being used GROUP BY) if ($this->properties['is_count'] && $numRows > 1) { - $displayParts = $displayParts->with([ - 'hasNavigationBar' => true, - 'hasSortLink' => true, - ]); + $displayParts = $displayParts->with(['hasNavigationBar' => true, 'hasSortLink' => true]); } // 4. If navigation bar or sorting fields names URLs should be @@ -631,10 +622,7 @@ class Results } } - return [ - $displayParts, - (int) $theTotal, - ]; + return [$displayParts, (int) $theTotal]; } /** @@ -687,10 +675,7 @@ class Results ]); } - return [ - $output, - $nbTotalPage, - ]; + return [$output, $nbTotalPage]; } /** @@ -716,10 +701,7 @@ class Results $pageSelector = ''; $numberTotalPage = 1; if (! $isShowingAll) { - [ - $pageSelector, - $numberTotalPage, - ] = $this->getHtmlPageSelector(); + [$pageSelector, $numberTotalPage] = $this->getHtmlPageSelector(); } $isLastPage = $this->properties['unlim_num_rows'] !== -1 && $this->properties['unlim_num_rows'] !== false @@ -1061,11 +1043,7 @@ class Results ]; } - $options[] = [ - 'value' => $unsortedSqlQuery, - 'content' => __('None'), - 'is_selected' => ! $isIndexUsed, - ]; + $options[] = ['value' => $unsortedSqlQuery, 'content' => __('None'), 'is_selected' => ! $isIndexUsed]; return ['hidden_fields' => $hiddenFields, 'options' => $options]; } @@ -1521,11 +1499,7 @@ class Results $sortOrderColumns[] = $sortOrder; } - return [ - $singleSortOrder, - implode(', ', $sortOrderColumns), - $orderImg ?? '', - ]; + return [$singleSortOrder, implode(', ', $sortOrderColumns), $orderImg ?? '']; } /** @@ -1612,43 +1586,28 @@ class Results $orderImg = ' ' . Generator::getImage( 's_desc', __('Descending'), - [ - 'class' => 'soimg', - 'title' => '', - ], + ['class' => 'soimg', 'title' => ''], ); $orderImg .= ' ' . Generator::getImage( 's_asc', __('Ascending'), - [ - 'class' => 'soimg hide', - 'title' => '', - ], + ['class' => 'soimg hide', 'title' => ''], ); } else { $sortOrder .= self::DESCENDING_SORT_DIR; $orderImg = ' ' . Generator::getImage( 's_asc', __('Ascending'), - [ - 'class' => 'soimg', - 'title' => '', - ], + ['class' => 'soimg', 'title' => ''], ); $orderImg .= ' ' . Generator::getImage( 's_desc', __('Descending'), - [ - 'class' => 'soimg hide', - 'title' => '', - ], + ['class' => 'soimg hide', 'title' => ''], ); } - return [ - $sortOrder, - $orderImg, - ]; + return [$sortOrder, $orderImg]; } /** @@ -1883,10 +1842,7 @@ class Results bool $isFieldTruncated = false, bool $hasTransformationPlugin = false, ): string { - $classes = array_filter([ - $class, - $nowrap, - ]); + $classes = array_filter([$class, $nowrap]); if ($meta->internalMediaType !== null) { $classes[] = preg_replace('/\//', '_', $meta->internalMediaType); @@ -2413,10 +2369,7 @@ class Results ); $transformationPlugin = new Text_Plain_Link(); - $transformOptions = [ - 0 => $linkingUrl, - 2 => true, - ]; + $transformOptions = [0 => $linkingUrl, 2 => true]; $meta->internalMediaType = str_replace('_', '/', 'Text/Plain'); } @@ -2669,10 +2622,7 @@ class Results $colVisib = false; } - return [ - $colOrder, - $colVisib, - ]; + return [$colOrder, $colVisib]; } /** @@ -2754,13 +2704,7 @@ class Results __('Copy'), ); - return [ - $editUrl, - $copyUrl, - $editStr, - $copyStr, - $urlParams, - ]; + return [$editUrl, $copyUrl, $editStr, $copyStr, $urlParams]; } /** @@ -2827,11 +2771,7 @@ class Results $kill = $this->dbi->getKillQuery($processId); - $urlParams = [ - 'db' => 'mysql', - 'sql_query' => $kill, - 'goto' => $linkGoto, - ]; + $urlParams = ['db' => 'mysql', 'sql_query' => $kill, 'goto' => $linkGoto]; $deleteUrl = Url::getFromRoute('/sql'); $jsConf = $kill; @@ -2843,12 +2783,7 @@ class Results $deleteUrl = $deleteString = $jsConf = $urlParams = null; } - return [ - $deleteUrl, - $deleteString, - $jsConf, - $urlParams, - ]; + return [$deleteUrl, $deleteString, $jsConf, $urlParams]; } /** @@ -3139,11 +3074,7 @@ class Results && str_contains($transformationPlugin->getName(), 'Link')) && ! $meta->isBinary() ) { - [ - $isFieldTruncated, - $column, - $originalLength, - ] = $this->getPartialText($column); + [$isFieldTruncated, $column, $originalLength] = $this->getPartialText($column); } if ($meta->isMappedTypeBit) { @@ -3411,10 +3342,7 @@ class Results // 1.1 Gets the information about which functionalities should be // displayed - [ - $displayParts, - $total, - ] = $this->setDisplayPartsAndTotal($displayParts); + [$displayParts, $total] = $this->setDisplayPartsAndTotal($displayParts); // 1.2 Defines offsets for the next and previous pages $posNext = 0; @@ -3834,12 +3762,7 @@ class Results foreach ($existRel as $masterField => $rel) { if ($masterField !== 'foreign_keys_data') { $displayField = $this->relation->getDisplayField($rel['foreign_db'], $rel['foreign_table']); - $map[$masterField] = [ - $rel['foreign_table'], - $rel['foreign_field'], - $displayField, - $rel['foreign_db'], - ]; + $map[$masterField] = [$rel['foreign_table'], $rel['foreign_field'], $displayField, $rel['foreign_db']]; } else { foreach ($rel as $oneKey) { foreach ($oneKey['index_list'] as $index => $oneField) { @@ -4303,10 +4226,6 @@ class Results $truncated = false; } - return [ - $truncated, - $str, - $originalLength, - ]; + return [$truncated, $str, $originalLength]; } } diff --git a/libraries/classes/Encoding.php b/libraries/classes/Encoding.php index f753ba7d95..b27fe2d8da 100644 --- a/libraries/classes/Encoding.php +++ b/libraries/classes/Encoding.php @@ -65,26 +65,10 @@ class Encoding * @var array */ private static array $enginemap = [ - 'iconv' => [ - 'iconv', - self::ENGINE_ICONV, - 'iconv', - ], - 'recode' => [ - 'recode_string', - self::ENGINE_RECODE, - 'recode', - ], - 'mb' => [ - 'mb_convert_encoding', - self::ENGINE_MB, - 'mbstring', - ], - 'none' => [ - 'isset', - self::ENGINE_NONE, - '', - ], + 'iconv' => ['iconv', self::ENGINE_ICONV, 'iconv'], + 'recode' => ['recode_string', self::ENGINE_RECODE, 'recode'], + 'mb' => ['mb_convert_encoding', self::ENGINE_MB, 'mbstring'], + 'none' => ['isset', self::ENGINE_NONE, ''], ]; /** @@ -92,11 +76,7 @@ class Encoding * * @var array */ - private static array $engineorder = [ - 'iconv', - 'mb', - 'recode', - ]; + private static array $engineorder = ['iconv', 'mb', 'recode']; /** * Kanji encodings list diff --git a/libraries/classes/Engines/Bdb.php b/libraries/classes/Engines/Bdb.php index aaa3cace96..0098dff365 100644 --- a/libraries/classes/Engines/Bdb.php +++ b/libraries/classes/Engines/Bdb.php @@ -24,9 +24,7 @@ class Bdb extends StorageEngine public function getVariables(): array { return [ - 'version_bdb' => [ - 'title' => __('Version information'), - ], + 'version_bdb' => ['title' => __('Version information')], 'bdb_cache_size' => ['type' => StorageEngine::DETAILS_TYPE_SIZE], 'bdb_home' => [], 'bdb_log_buffer_size' => ['type' => StorageEngine::DETAILS_TYPE_SIZE], diff --git a/libraries/classes/Engines/Innodb.php b/libraries/classes/Engines/Innodb.php index f3b87748dc..c0f6399ba9 100644 --- a/libraries/classes/Engines/Innodb.php +++ b/libraries/classes/Engines/Innodb.php @@ -31,9 +31,7 @@ class Innodb extends StorageEngine 'title' => __('Data home directory'), 'desc' => __('The common part of the directory path for all InnoDB data files.'), ], - 'innodb_data_file_path' => [ - 'title' => __('Data files'), - ], + 'innodb_data_file_path' => ['title' => __('Data files')], 'innodb_autoextend_increment' => [ 'title' => __('Autoextend increment'), 'desc' => __( @@ -103,10 +101,7 @@ class Innodb extends StorageEngine return []; } - return [ - 'Bufferpool' => __('Buffer Pool'), - 'Status' => __('InnoDB Status'), - ]; + return ['Bufferpool' => __('Buffer Pool'), 'Status' => __('InnoDB Status')]; } /** diff --git a/libraries/classes/Engines/Memory.php b/libraries/classes/Engines/Memory.php index 55040dfe07..e42eafd60a 100644 --- a/libraries/classes/Engines/Memory.php +++ b/libraries/classes/Engines/Memory.php @@ -21,8 +21,6 @@ class Memory extends StorageEngine */ public function getVariables(): array { - return [ - 'max_heap_table_size' => ['type' => StorageEngine::DETAILS_TYPE_SIZE], - ]; + return ['max_heap_table_size' => ['type' => StorageEngine::DETAILS_TYPE_SIZE]]; } } diff --git a/libraries/classes/Engines/Ndbcluster.php b/libraries/classes/Engines/Ndbcluster.php index 43194e9877..fb11a4d918 100644 --- a/libraries/classes/Engines/Ndbcluster.php +++ b/libraries/classes/Engines/Ndbcluster.php @@ -21,9 +21,7 @@ class Ndbcluster extends StorageEngine */ public function getVariables(): array { - return [ - 'ndb_connectstring' => [], - ]; + return ['ndb_connectstring' => []]; } /** diff --git a/libraries/classes/Error.php b/libraries/classes/Error.php index 9ba77e1ced..6df5fbe8d3 100644 --- a/libraries/classes/Error.php +++ b/libraries/classes/Error.php @@ -157,12 +157,7 @@ class Error extends Message { $result = []; - $members = [ - 'line', - 'function', - 'class', - 'type', - ]; + $members = ['line', 'function', 'class', 'type']; foreach ($backtrace as $idx => $step) { /* Create new backtrace entry */ @@ -415,12 +410,7 @@ class Error extends Message public static function getArg(mixed $arg, string $function): string { $retval = ''; - $includeFunctions = [ - 'include', - 'include_once', - 'require', - 'require_once', - ]; + $includeFunctions = ['include', 'include_once', 'require', 'require_once']; $connectFunctions = [ 'mysql_connect', 'mysql_pconnect', diff --git a/libraries/classes/ErrorReport.php b/libraries/classes/ErrorReport.php index 4104bdf3d2..ef44d6a1ef 100644 --- a/libraries/classes/ErrorReport.php +++ b/libraries/classes/ErrorReport.php @@ -192,10 +192,7 @@ class ErrorReport $uri = $scriptName . '?' . $query; - return [ - $uri, - $scriptName, - ]; + return [$uri, $scriptName]; } /** diff --git a/libraries/classes/Export.php b/libraries/classes/Export.php index cf8eadc3b5..1e1ad2063c 100644 --- a/libraries/classes/Export.php +++ b/libraries/classes/Export.php @@ -318,10 +318,7 @@ class Export $mediaType = 'application/zip'; } - return [ - $filename, - $mediaType, - ]; + return [$filename, $mediaType]; } /** @@ -437,11 +434,7 @@ class Export } } - return [ - $saveFilename, - $message, - $fileHandle, - ]; + return [$saveFilename, $message, $fileHandle]; } /** diff --git a/libraries/classes/Export/Options.php b/libraries/classes/Export/Options.php index 3e57d33ca8..670163b7c7 100644 --- a/libraries/classes/Export/Options.php +++ b/libraries/classes/Export/Options.php @@ -76,10 +76,7 @@ final class Options $isSelected = true; } - $databases[] = [ - 'name' => $currentDb, - 'is_selected' => $isSelected, - ]; + $databases[] = ['name' => $currentDb, 'is_selected' => $isSelected]; } return $databases; diff --git a/libraries/classes/FileListing.php b/libraries/classes/FileListing.php index db04985de3..4017a286e0 100644 --- a/libraries/classes/FileListing.php +++ b/libraries/classes/FileListing.php @@ -84,10 +84,7 @@ class FileListing $template = new Template(); - return $template->render('file_select_options', [ - 'filesList' => $list, - 'active' => $active, - ]); + return $template->render('file_select_options', ['filesList' => $list, 'active' => $active]); } /** diff --git a/libraries/classes/Font.php b/libraries/classes/Font.php index 4865f9aa8c..e8baffac6a 100644 --- a/libraries/classes/Font.php +++ b/libraries/classes/Font.php @@ -30,51 +30,17 @@ class Font $charLists = []; //ijl - $charLists[] = [ - 'chars' => [ - 'i', - 'j', - 'l', - ], - 'modifier' => 0.23, - ]; + $charLists[] = ['chars' => ['i', 'j', 'l'], 'modifier' => 0.23]; //f - $charLists[] = [ - 'chars' => ['f'], - 'modifier' => 0.27, - ]; + $charLists[] = ['chars' => ['f'], 'modifier' => 0.27]; //tI - $charLists[] = [ - 'chars' => [ - 't', - 'I', - ], - 'modifier' => 0.28, - ]; + $charLists[] = ['chars' => ['t', 'I'], 'modifier' => 0.28]; //r - $charLists[] = [ - 'chars' => ['r'], - 'modifier' => 0.34, - ]; + $charLists[] = ['chars' => ['r'], 'modifier' => 0.34]; //1 - $charLists[] = [ - 'chars' => ['1'], - 'modifier' => 0.49, - ]; + $charLists[] = ['chars' => ['1'], 'modifier' => 0.49]; //cksvxyzJ - $charLists[] = [ - 'chars' => [ - 'c', - 'k', - 's', - 'v', - 'x', - 'y', - 'z', - 'J', - ], - 'modifier' => 0.5, - ]; + $charLists[] = ['chars' => ['c', 'k', 's', 'v', 'x', 'y', 'z', 'J'], 'modifier' => 0.5]; //abdeghnopquL023456789 $charLists[] = [ 'chars' => [ @@ -103,69 +69,19 @@ class Font 'modifier' => 0.56, ]; //FTZ - $charLists[] = [ - 'chars' => [ - 'F', - 'T', - 'Z', - ], - 'modifier' => 0.61, - ]; + $charLists[] = ['chars' => ['F', 'T', 'Z'], 'modifier' => 0.61]; //ABEKPSVXY - $charLists[] = [ - 'chars' => [ - 'A', - 'B', - 'E', - 'K', - 'P', - 'S', - 'V', - 'X', - 'Y', - ], - 'modifier' => 0.67, - ]; + $charLists[] = ['chars' => ['A', 'B', 'E', 'K', 'P', 'S', 'V', 'X', 'Y'], 'modifier' => 0.67]; //wCDHNRU - $charLists[] = [ - 'chars' => [ - 'w', - 'C', - 'D', - 'H', - 'N', - 'R', - 'U', - ], - 'modifier' => 0.73, - ]; + $charLists[] = ['chars' => ['w', 'C', 'D', 'H', 'N', 'R', 'U'], 'modifier' => 0.73]; //GOQ - $charLists[] = [ - 'chars' => [ - 'G', - 'O', - 'Q', - ], - 'modifier' => 0.78, - ]; + $charLists[] = ['chars' => ['G', 'O', 'Q'], 'modifier' => 0.78]; //mM - $charLists[] = [ - 'chars' => [ - 'm', - 'M', - ], - 'modifier' => 0.84, - ]; + $charLists[] = ['chars' => ['m', 'M'], 'modifier' => 0.84]; //W - $charLists[] = [ - 'chars' => ['W'], - 'modifier' => 0.95, - ]; + $charLists[] = ['chars' => ['W'], 'modifier' => 0.95]; //" " - $charLists[] = [ - 'chars' => [' '], - 'modifier' => 0.28, - ]; + $charLists[] = ['chars' => [' '], 'modifier' => 0.28]; return $charLists; } diff --git a/libraries/classes/Gis/GisGeometry.php b/libraries/classes/Gis/GisGeometry.php index 066402fe75..0179f1b4ba 100644 --- a/libraries/classes/Gis/GisGeometry.php +++ b/libraries/classes/Gis/GisGeometry.php @@ -160,10 +160,7 @@ abstract class GisGeometry $wkt = $value; } - return [ - 'srid' => $srid, - 'wkt' => $wkt, - ]; + return ['srid' => $srid, 'wkt' => $wkt]; } /** @@ -190,12 +187,7 @@ abstract class GisGeometry preg_match('/^\w+/', $wkt, $matches); $wktType = strtoupper($matches[0]); - return [ - 'srid' => $data['srid'], - $index => [ - $wktType => $this->getCoordinateParams($wkt), - ], - ]; + return ['srid' => $data['srid'], $index => [$wktType => $this->getCoordinateParams($wkt)]]; } /** diff --git a/libraries/classes/Gis/GisGeometryCollection.php b/libraries/classes/Gis/GisGeometryCollection.php index e41346df00..61b271f3c8 100644 --- a/libraries/classes/Gis/GisGeometryCollection.php +++ b/libraries/classes/Gis/GisGeometryCollection.php @@ -322,12 +322,7 @@ class GisGeometryCollection extends GisGeometry // Trim to remove leading 'GEOMETRYCOLLECTION(' and trailing ')' $geomCol = mb_substr($wkt, 19, -1); $wktGeometries = $this->explodeGeomCol($geomCol); - $params = [ - 'srid' => $data['srid'], - 'GEOMETRYCOLLECTION' => [ - 'geom_count' => count($wktGeometries), - ], - ]; + $params = ['srid' => $data['srid'], 'GEOMETRYCOLLECTION' => ['geom_count' => count($wktGeometries)]]; $i = 0; foreach ($wktGeometries as $wktGeometry) { @@ -342,10 +337,7 @@ class GisGeometryCollection extends GisGeometry continue; } - $params[$i++] = [ - 'gis_type' => $wktType, - $wktType => $gisObj->getCoordinateParams($wktGeometry), - ]; + $params[$i++] = ['gis_type' => $wktType, $wktType => $gisObj->getCoordinateParams($wktGeometry)]; } return $params; diff --git a/libraries/classes/Gis/GisLineString.php b/libraries/classes/Gis/GisLineString.php index 8c1e6386f8..a3276b7ac1 100644 --- a/libraries/classes/Gis/GisLineString.php +++ b/libraries/classes/Gis/GisLineString.php @@ -124,10 +124,7 @@ class GisLineString extends GisGeometry */ public function prepareRowAsPdf(string $spatial, string $label, array $color, array $scaleData, TCPDF $pdf): TCPDF { - $line = [ - 'width' => 1.5, - 'color' => $color, - ]; + $line = ['width' => 1.5, 'color' => $color]; // Trim to remove leading 'LINESTRING(' and trailing ')' $linestring = mb_substr($spatial, 11, -1); @@ -205,10 +202,7 @@ class GisLineString extends GisGeometry */ public function prepareRowAsOl(string $spatial, int $srid, string $label, array $color): string { - $strokeStyle = [ - 'color' => $color, - 'width' => 2, - ]; + $strokeStyle = ['color' => $color, 'width' => 2]; $style = 'new ol.style.Style({' . 'stroke: new ol.style.Stroke(' . json_encode($strokeStyle) . ')'; @@ -277,10 +271,7 @@ class GisLineString extends GisGeometry $noOfPoints = count($pointsArr); $coords = ['no_of_points' => $noOfPoints]; for ($i = 0; $i < $noOfPoints; $i++) { - $coords[$i] = [ - 'x' => $pointsArr[$i][0], - 'y' => $pointsArr[$i][1], - ]; + $coords[$i] = ['x' => $pointsArr[$i][0], 'y' => $pointsArr[$i][1]]; } return $coords; diff --git a/libraries/classes/Gis/GisMultiLineString.php b/libraries/classes/Gis/GisMultiLineString.php index 06c2857261..6d5456d5d7 100644 --- a/libraries/classes/Gis/GisMultiLineString.php +++ b/libraries/classes/Gis/GisMultiLineString.php @@ -141,10 +141,7 @@ class GisMultiLineString extends GisGeometry */ public function prepareRowAsPdf(string $spatial, string $label, array $color, array $scaleData, TCPDF $pdf): TCPDF { - $line = [ - 'width' => 1.5, - 'color' => $color, - ]; + $line = ['width' => 1.5, 'color' => $color]; // Trim to remove leading 'MULTILINESTRING((' and trailing '))' $multilineString = mb_substr($spatial, 17, -2); @@ -236,10 +233,7 @@ class GisMultiLineString extends GisGeometry */ public function prepareRowAsOl(string $spatial, int $srid, string $label, array $color): string { - $strokeStyle = [ - 'color' => $color, - 'width' => 2, - ]; + $strokeStyle = ['color' => $color, 'width' => 2]; $style = 'new ol.style.Style({' . 'stroke: new ol.style.Stroke(' . json_encode($strokeStyle) . ')'; @@ -349,10 +343,7 @@ class GisMultiLineString extends GisGeometry $noOfPoints = count($points); $coords[$j] = ['no_of_points' => $noOfPoints]; for ($i = 0; $i < $noOfPoints; $i++) { - $coords[$j][$i] = [ - 'x' => $points[$i][0], - 'y' => $points[$i][1], - ]; + $coords[$j][$i] = ['x' => $points[$i][0], 'y' => $points[$i][1]]; } } diff --git a/libraries/classes/Gis/GisMultiPoint.php b/libraries/classes/Gis/GisMultiPoint.php index ce0ac37191..77037b86e9 100644 --- a/libraries/classes/Gis/GisMultiPoint.php +++ b/libraries/classes/Gis/GisMultiPoint.php @@ -131,10 +131,7 @@ class GisMultiPoint extends GisGeometry array $scaleData, TCPDF $pdf, ): TCPDF { - $line = [ - 'width' => 1.25, - 'color' => $color, - ]; + $line = ['width' => 1.25, 'color' => $color]; // Trim to remove leading 'MULTIPOINT(' and trailing ')' $multipoint = mb_substr($spatial, 11, -1); @@ -220,10 +217,7 @@ class GisMultiPoint extends GisGeometry array $color, ): string { $fillStyle = ['color' => 'white']; - $strokeStyle = [ - 'color' => $color, - 'width' => 2, - ]; + $strokeStyle = ['color' => $color, 'width' => 2]; $style = 'new ol.style.Style({' . 'image: new ol.style.Circle({' . 'fill: new ol.style.Fill(' . json_encode($fillStyle) . '),' @@ -231,10 +225,7 @@ class GisMultiPoint extends GisGeometry . 'radius: 3' . '})'; if ($label !== '') { - $textStyle = [ - 'text' => $label, - 'offsetY' => -9, - ]; + $textStyle = ['text' => $label, 'offsetY' => -9]; $style .= ',text: new ol.style.Text(' . json_encode($textStyle) . ')'; } @@ -318,10 +309,7 @@ class GisMultiPoint extends GisGeometry $noOfPoints = count($points); $coords = ['no_of_points' => $noOfPoints]; for ($i = 0; $i < $noOfPoints; $i++) { - $coords[$i] = [ - 'x' => $points[$i][0], - 'y' => $points[$i][1], - ]; + $coords[$i] = ['x' => $points[$i][0], 'y' => $points[$i][1]]; } return $coords; diff --git a/libraries/classes/Gis/GisMultiPolygon.php b/libraries/classes/Gis/GisMultiPolygon.php index 19386e2c1c..9326546234 100644 --- a/libraries/classes/Gis/GisMultiPolygon.php +++ b/libraries/classes/Gis/GisMultiPolygon.php @@ -112,10 +112,7 @@ class GisMultiPolygon extends GisGeometry continue; } - $labelPoint = [ - $pointsArr[2], - $pointsArr[3], - ]; + $labelPoint = [$pointsArr[2], $pointsArr[3]]; } // print label if applicable @@ -165,10 +162,7 @@ class GisMultiPolygon extends GisGeometry continue; } - $labelPoint = [ - $pointsArr[2], - $pointsArr[3], - ]; + $labelPoint = [$pointsArr[2], $pointsArr[3]]; } // print label if applicable @@ -245,10 +239,7 @@ class GisMultiPolygon extends GisGeometry { $color[] = 0.8; $fillStyle = ['color' => $color]; - $strokeStyle = [ - 'color' => [0, 0, 0], - 'width' => 0.5, - ]; + $strokeStyle = ['color' => [0, 0, 0], 'width' => 0.5]; $style = 'new ol.style.Style({' . 'fill: new ol.style.Fill(' . json_encode($fillStyle) . '),' . 'stroke: new ol.style.Stroke(' . json_encode($strokeStyle) . ')'; @@ -458,10 +449,7 @@ class GisMultiPolygon extends GisGeometry $noOfPoints = count($points); $coords[$k][$j] = ['no_of_points' => $noOfPoints]; for ($i = 0; $i < $noOfPoints; $i++) { - $coords[$k][$j][$i] = [ - 'x' => $points[$i][0], - 'y' => $points[$i][1], - ]; + $coords[$k][$j][$i] = ['x' => $points[$i][0], 'y' => $points[$i][1]]; } } } diff --git a/libraries/classes/Gis/GisPoint.php b/libraries/classes/Gis/GisPoint.php index a7557646ac..e6ef3ff6fb 100644 --- a/libraries/classes/Gis/GisPoint.php +++ b/libraries/classes/Gis/GisPoint.php @@ -125,10 +125,7 @@ class GisPoint extends GisGeometry array $scaleData, TCPDF $pdf, ): TCPDF { - $line = [ - 'width' => 1.25, - 'color' => $color, - ]; + $line = ['width' => 1.25, 'color' => $color]; // Trim to remove leading 'POINT(' and trailing ')' $point = mb_substr($spatial, 6, -1); @@ -205,10 +202,7 @@ class GisPoint extends GisGeometry array $color, ): string { $fillStyle = ['color' => 'white']; - $strokeStyle = [ - 'color' => $color, - 'width' => 2, - ]; + $strokeStyle = ['color' => $color, 'width' => 2]; $style = 'new ol.style.Style({' . 'image: new ol.style.Circle({' . 'fill: new ol.style.Fill(' . json_encode($fillStyle) . '),' @@ -216,10 +210,7 @@ class GisPoint extends GisGeometry . 'radius: 3' . '})'; if ($label !== '') { - $textStyle = [ - 'text' => $label, - 'offsetY' => -9, - ]; + $textStyle = ['text' => $label, 'offsetY' => -9]; $style .= ',text: new ol.style.Text(' . json_encode($textStyle) . ')'; } @@ -283,9 +274,6 @@ class GisPoint extends GisGeometry $wktPoint = mb_substr($wkt, 6, -1); $points = $this->extractPoints1d($wktPoint, null); - return [ - 'x' => $points[0][0], - 'y' => $points[0][1], - ]; + return ['x' => $points[0][0], 'y' => $points[0][1]]; } } diff --git a/libraries/classes/Gis/GisPolygon.php b/libraries/classes/Gis/GisPolygon.php index c251f4757c..e732b53dfc 100644 --- a/libraries/classes/Gis/GisPolygon.php +++ b/libraries/classes/Gis/GisPolygon.php @@ -206,10 +206,7 @@ class GisPolygon extends GisGeometry { $color[] = 0.8; $fillStyle = ['color' => $color]; - $strokeStyle = [ - 'color' => [0, 0, 0], - 'width' => 0.5, - ]; + $strokeStyle = ['color' => [0, 0, 0], 'width' => 0.5]; $style = 'new ol.style.Style({' . 'fill: new ol.style.Fill(' . json_encode($fillStyle) . '),' . 'stroke: new ol.style.Stroke(' . json_encode($strokeStyle) . ')'; @@ -479,10 +476,7 @@ class GisPolygon extends GisGeometry $noOfPoints = count($points); $coords[$j] = ['no_of_points' => $noOfPoints]; for ($i = 0; $i < $noOfPoints; $i++) { - $coords[$j][$i] = [ - 'x' => $points[$i][0], - 'y' => $points[$i][1], - ]; + $coords[$j][$i] = ['x' => $points[$i][0], 'y' => $points[$i][1]]; } } diff --git a/libraries/classes/Gis/GisVisualization.php b/libraries/classes/Gis/GisVisualization.php index 6f605dcc0d..9bb14b2f49 100644 --- a/libraries/classes/Gis/GisVisualization.php +++ b/libraries/classes/Gis/GisVisualization.php @@ -533,12 +533,7 @@ class GisVisualization ? ($minMax->maxY + $minMax->minY - $this->height / $scale) / 2 : $minMax->minY - ($border / $scale); - return [ - 'scale' => $scale, - 'x' => $x, - 'y' => $y, - 'height' => $this->height, - ]; + return ['scale' => $scale, 'x' => $x, 'y' => $y, 'height' => $this->height]; } /** diff --git a/libraries/classes/Git.php b/libraries/classes/Git.php index 0a5ac7ba1a..ad7f8d0cd3 100644 --- a/libraries/classes/Git.php +++ b/libraries/classes/Git.php @@ -364,16 +364,8 @@ class Git */ private function extractDataFormTextBody(array $commit): array { - $author = [ - 'name' => '', - 'email' => '', - 'date' => '', - ]; - $committer = [ - 'name' => '', - 'email' => '', - 'date' => '', - ]; + $author = ['name' => '', 'email' => '', 'date' => '']; + $committer = ['name' => '', 'email' => '', 'date' => '']; do { $dataline = array_shift($commit); @@ -388,11 +380,7 @@ class Git $timezone = new DateTimeZone($user[4] ?? '+0000'); $date = (new DateTimeImmutable())->setTimestamp((int) $user[3])->setTimezone($timezone); - $user2 = [ - 'name' => trim($user[1]), - 'email' => trim($user[2]), - 'date' => $date->format('Y-m-d H:i:s O'), - ]; + $user2 = ['name' => trim($user[1]), 'email' => trim($user[2]), 'date' => $date->format('Y-m-d H:i:s O')]; if ($linetype === 'author') { $author = $user2; diff --git a/libraries/classes/Html/Generator.php b/libraries/classes/Html/Generator.php index 23d1b27e8a..fe14d5e174 100644 --- a/libraries/classes/Html/Generator.php +++ b/libraries/classes/Html/Generator.php @@ -756,10 +756,7 @@ class Generator * The errors found by the lexer and the parser. */ $errors = ParserError::get( - [ - $lexer, - $parser, - ], + [$lexer, $parser], ); if ($sqlQuery === '') { @@ -806,10 +803,7 @@ class Generator } if ($isModifyLink) { - $urlParams = [ - 'sql_query' => $sqlQuery, - 'show_query' => 1, - ]; + $urlParams = ['sql_query' => $sqlQuery, 'show_query' => 1]; if (strlen($GLOBALS['table']) > 0) { $urlParams['db'] = $GLOBALS['db']; $urlParams['table'] = $GLOBALS['table']; @@ -849,14 +843,8 @@ class Generator // All non-single blanks and TAB-characters are replaced with their // HTML-counterpart $serverMessage = str_replace( - [ - ' ', - "\t", - ], - [ - '  ', - '    ', - ], + [' ', "\t"], + ['  ', '    '], $serverMessage, ); diff --git a/libraries/classes/Import.php b/libraries/classes/Import.php index 99d4c7f9e5..b97f92a3e6 100644 --- a/libraries/classes/Import.php +++ b/libraries/classes/Import.php @@ -133,10 +133,7 @@ class Import $GLOBALS['my_die'] = []; } - $GLOBALS['my_die'][] = [ - 'sql' => $sql, - 'error' => $GLOBALS['dbi']->getError(), - ]; + $GLOBALS['my_die'][] = ['sql' => $sql, 'error' => $GLOBALS['dbi']->getError()]; $GLOBALS['msg'] .= __('Error'); @@ -302,10 +299,7 @@ class Import $reload = true; } - return [ - $db, - $reload, - ]; + return [$db, $reload]; } /** @@ -559,11 +553,7 @@ class Import $m = $currSize - 1; $d = $decPrecision; - return [ - $m, - $d, - $m . ',' . $d, - ]; + return [$m, $d, $m . ',' . $d]; } /** @@ -932,10 +922,7 @@ class Import $sizes[$n] = '10'; } - return [ - $types, - $sizes, - ]; + return [$types, $sizes]; } /** @@ -1239,10 +1226,7 @@ class Import unset($params); foreach ($tables as $table) { - $params = [ - 'db' => $dbName, - 'table' => (string) $table[self::TBL_NAME], - ]; + $params = ['db' => $dbName, 'table' => (string) $table[self::TBL_NAME]]; $tblUrl = Url::getFromRoute('/sql', $params); $tblStructUrl = Url::getFromRoute('/table/structure', $params); $tblOpsUrl = Url::getFromRoute('/table/operations', $params); @@ -1410,16 +1394,7 @@ class Import } // List of Transactional Engines. - $transactionalEngines = [ - 'INNODB', - 'FALCON', - 'NDB', - 'INFINIDB', - 'TOKUDB', - 'XTRADB', - 'SEQUENCE', - 'BDB', - ]; + $transactionalEngines = ['INNODB', 'FALCON', 'NDB', 'INFINIDB', 'TOKUDB', 'XTRADB', 'SEQUENCE', 'BDB']; // Query to check if table is 'Transactional'. $checkQuery = 'SELECT `ENGINE` FROM `information_schema`.`tables` ' diff --git a/libraries/classes/Import/Ajax.php b/libraries/classes/Import/Ajax.php index aa8a0c49ee..3f22d06885 100644 --- a/libraries/classes/Import/Ajax.php +++ b/libraries/classes/Import/Ajax.php @@ -61,11 +61,7 @@ final class Ajax } } - return [ - $sessionKey, - $uploadId, - $plugins, - ]; + return [$sessionKey, $uploadId, $plugins]; } /** diff --git a/libraries/classes/Index.php b/libraries/classes/Index.php index df20a05f0e..1c5b0f55d9 100644 --- a/libraries/classes/Index.php +++ b/libraries/classes/Index.php @@ -237,10 +237,7 @@ class Index // $columns[sub_parts][] foreach ($columns['names'] as $key => $name) { $subPart = $columns['sub_parts'][$key] ?? ''; - $addedColumns[] = [ - 'Column_name' => $name, - 'Sub_part' => $subPart, - ]; + $addedColumns[] = ['Column_name' => $name, 'Sub_part' => $subPart]; } } else { // coming from SHOW INDEXES @@ -425,10 +422,7 @@ class Index */ public static function getIndexTypes(): array { - return [ - 'BTREE', - 'HASH', - ]; + return ['BTREE', 'HASH']; } public function hasPrimary(): bool @@ -531,10 +525,7 @@ class Index */ public function getCompareData(): array { - $data = [ - 'Packed' => $this->packed, - 'Index_choice' => $this->choice, - ]; + $data = ['Packed' => $this->packed, 'Index_choice' => $this->choice]; foreach ($this->columns as $column) { $data['columns'][] = $column->getCompareData(); diff --git a/libraries/classes/InsertEdit.php b/libraries/classes/InsertEdit.php index 42724dc751..a65a8b063f 100644 --- a/libraries/classes/InsertEdit.php +++ b/libraries/classes/InsertEdit.php @@ -53,10 +53,7 @@ use const PASSWORD_DEFAULT; class InsertEdit { - private const FUNC_OPTIONAL_PARAM = [ - 'RAND', - 'UNIX_TIMESTAMP', - ]; + private const FUNC_OPTIONAL_PARAM = ['RAND', 'UNIX_TIMESTAMP']; private const FUNC_NO_PARAM = [ 'CONNECTION_ID', @@ -197,12 +194,7 @@ class InsertEdit $foundUniqueKey = true; } - return [ - $whereClauses, - $result, - $rows, - $foundUniqueKey, - ]; + return [$whereClauses, $result, $rows, $foundUniqueKey]; } /** @@ -268,10 +260,7 @@ class InsertEdit // Can be a string on some old configuration storage settings $rows = array_fill(0, (int) $GLOBALS['cfg']['InsertRows'], false); - return [ - $result, - $rows, - ]; + return [$result, $rows]; } /** @@ -375,26 +364,15 @@ class InsertEdit $column['Field_title'] = $this->getColumnTitle($column, $commentsMap); $column['is_binary'] = $this->isColumn( $column, - [ - 'binary', - 'varbinary', - ], + ['binary', 'varbinary'], ); $column['is_blob'] = $this->isColumn( $column, - [ - 'blob', - 'tinyblob', - 'mediumblob', - 'longblob', - ], + ['blob', 'tinyblob', 'mediumblob', 'longblob'], ); $column['is_char'] = $this->isColumn( $column, - [ - 'char', - 'varchar', - ], + ['char', 'varchar'], ); [ @@ -456,26 +434,14 @@ class InsertEdit private function getEnumSetAndTimestampColumns(array $column, bool $timestampSeen): array { return match ($column['True_Type']) { - 'set' => [ - 'set', - '', - false, - ], - 'enum' => [ - 'enum', - '', - false, - ], + 'set' => ['set', '', false], + 'enum' => ['enum', '', false], 'timestamp' => [ $column['Type'], ' text-nowrap', ! $timestampSeen, // can only occur once per table ], - default => [ - $column['Type'], - ' text-nowrap', - false, - ], + default => [$column['Type'], ' text-nowrap', false], }; } @@ -588,10 +554,7 @@ class InsertEdit { $values = []; foreach ($enumSetValues as $val) { - $values[] = [ - 'plain' => $val, - 'html' => htmlspecialchars($val), - ]; + $values[] = ['plain' => $val, 'html' => htmlspecialchars($val)]; } return $values; @@ -612,19 +575,13 @@ class InsertEdit if (! isset($column['values'])) { $column['values'] = []; foreach ($enumSetValues as $val) { - $column['values'][] = [ - 'plain' => $val, - 'html' => htmlspecialchars($val), - ]; + $column['values'][] = ['plain' => $val, 'html' => htmlspecialchars($val)]; } $column['select_size'] = min(4, count($column['values'])); } - return [ - $column['values'], - $column['select_size'], - ]; + return [$column['values'], $column['select_size']]; } /** @@ -758,10 +715,7 @@ class InsertEdit $biggestMaxFileSize = $thisFieldMaxSize; } - return [ - $htmlOutput, - $biggestMaxFileSize, - ]; + return [$htmlOutput, $biggestMaxFileSize]; } /** @@ -1054,13 +1008,7 @@ class InsertEdit . $columnNameAppendix . '" value="' . htmlspecialchars($currentRow[$column['Field']], ENT_COMPAT) . '">'; - return [ - $realNullValue, - (string) $specialCharsEncoded, - (string) $specialChars, - (string) $data, - $backupField, - ]; + return [$realNullValue, (string) $specialCharsEncoded, (string) $specialChars, (string) $data, $backupField]; } /** @@ -1101,13 +1049,7 @@ class InsertEdit $specialCharsEncoded = Util::duplicateFirstNewline($specialChars); - return [ - $realNullValue, - (string) $data, - $specialChars, - '', - $specialCharsEncoded, - ]; + return [$realNullValue, (string) $data, $specialChars, '', $specialCharsEncoded]; } /** @@ -1142,12 +1084,7 @@ class InsertEdit $isInsertIgnore = isset($_POST['submit_type']) && $_POST['submit_type'] === 'insertignore'; - return [ - $loopArray, - $usingKey, - $isInsert, - $isInsertIgnore, - ]; + return [$loopArray, $usingKey, $isInsert, $isInsertIgnore]; } /** @@ -1189,11 +1126,7 @@ class InsertEdit */ public function getGotoInclude(string|false $gotoInclude): string { - $validOptions = [ - 'new_insert', - 'same_insert', - 'edit_next', - ]; + $validOptions = ['new_insert', 'same_insert', 'edit_next']; if (isset($_POST['after_insert']) && in_array($_POST['after_insert'], $validOptions)) { return '/table/change'; } @@ -1331,14 +1264,7 @@ class InsertEdit $warningMessages = $this->getWarningMessages(); } - return [ - $urlParams, - $totalAffectedRows, - $lastMessages, - $warningMessages, - $errorMessages, - $returnToSqlQuery, - ]; + return [$urlParams, $totalAffectedRows, $lastMessages, $warningMessages, $errorMessages, $returnToSqlQuery]; } /** @@ -2367,12 +2293,7 @@ class InsertEdit $columnMime = $mimeMap[$tableColumn['Field']]; } - $virtual = [ - 'VIRTUAL', - 'PERSISTENT', - 'VIRTUAL GENERATED', - 'STORED GENERATED', - ]; + $virtual = ['VIRTUAL', 'PERSISTENT', 'VIRTUAL GENERATED', 'STORED GENERATED']; if (in_array($tableColumn['Extra'], $virtual)) { continue; } diff --git a/libraries/classes/IpAllowDeny.php b/libraries/classes/IpAllowDeny.php index 321509a2e8..f4bd17bc71 100644 --- a/libraries/classes/IpAllowDeny.php +++ b/libraries/classes/IpAllowDeny.php @@ -256,10 +256,7 @@ class IpAllowDeny } // lookup table for some name shortcuts - $shortcuts = [ - 'all' => '0.0.0.0/0', - 'localhost' => '127.0.0.1/8', - ]; + $shortcuts = ['all' => '0.0.0.0/0', 'localhost' => '127.0.0.1/8']; // Provide some useful shortcuts if server gives us address: if (Core::getenv('SERVER_ADDR')) { diff --git a/libraries/classes/Linter.php b/libraries/classes/Linter.php index 4506ea3fa0..57bb640f46 100644 --- a/libraries/classes/Linter.php +++ b/libraries/classes/Linter.php @@ -85,10 +85,7 @@ class Linter $line = $lineNo; } - return [ - $line, - $pos - $lines[$line], - ]; + return [$line, $pos - $lines[$line]]; } /** diff --git a/libraries/classes/ListDatabase.php b/libraries/classes/ListDatabase.php index 97bc9aba63..7ca79f9d45 100644 --- a/libraries/classes/ListDatabase.php +++ b/libraries/classes/ListDatabase.php @@ -47,10 +47,7 @@ class ListDatabase extends ListAbstract continue; } - $list[] = [ - 'name' => $eachItem, - 'is_selected' => $selected === $eachItem, - ]; + $list[] = ['name' => $eachItem, 'is_selected' => $selected === $eachItem]; } return $list; @@ -140,9 +137,7 @@ class ListDatabase extends ListAbstract protected function checkOnlyDatabase(): bool { if (is_string($GLOBALS['cfg']['Server']['only_db']) && strlen($GLOBALS['cfg']['Server']['only_db']) > 0) { - $GLOBALS['cfg']['Server']['only_db'] = [ - $GLOBALS['cfg']['Server']['only_db'], - ]; + $GLOBALS['cfg']['Server']['only_db'] = [$GLOBALS['cfg']['Server']['only_db']]; } if (! is_array($GLOBALS['cfg']['Server']['only_db'])) { diff --git a/libraries/classes/Menu.php b/libraries/classes/Menu.php index e61f3e5933..16bd2344e5 100644 --- a/libraries/classes/Menu.php +++ b/libraries/classes/Menu.php @@ -94,10 +94,7 @@ class Menu // Filter out any tabs that are not allowed $tabs = array_intersect_key($tabs, $allowedTabs); - return $this->template->render('top_menu', [ - 'tabs' => $tabs, - 'url_params' => $urlParams, - ]); + return $this->template->render('top_menu', ['tabs' => $tabs, 'url_params' => $urlParams]); } /** @@ -235,10 +232,7 @@ class Menu $tabs['structure']['icon'] = 'b_props'; $tabs['structure']['route'] = '/table/structure'; $tabs['structure']['text'] = __('Structure'); - $tabs['structure']['active'] = in_array($route, [ - '/table/relation', - '/table/structure', - ]); + $tabs['structure']['active'] = in_array($route, ['/table/relation', '/table/structure']); $tabs['sql']['icon'] = 'b_sql'; $tabs['sql']['route'] = '/table/sql'; @@ -248,11 +242,7 @@ class Menu $tabs['search']['icon'] = 'b_search'; $tabs['search']['text'] = __('Search'); $tabs['search']['route'] = '/table/search'; - $tabs['search']['active'] = in_array($route, [ - '/table/find-replace', - '/table/search', - '/table/zoom-search', - ]); + $tabs['search']['active'] = in_array($route, ['/table/find-replace', '/table/search', '/table/zoom-search']); if (! $isSystemSchema && (! $tableIsView || $updatableView)) { $tabs['insert']['icon'] = 'b_insrow'; @@ -483,10 +473,7 @@ class Menu $tabs['rights']['icon'] = 's_rights'; $tabs['rights']['route'] = '/server/privileges'; $tabs['rights']['text'] = __('User accounts'); - $tabs['rights']['active'] = in_array($route, [ - '/server/privileges', - '/server/user-groups', - ]); + $tabs['rights']['active'] = in_array($route, ['/server/privileges', '/server/user-groups']); } $tabs['export']['icon'] = 'b_export'; diff --git a/libraries/classes/Message.php b/libraries/classes/Message.php index fa5c2d2149..399f88cbd4 100644 --- a/libraries/classes/Message.php +++ b/libraries/classes/Message.php @@ -62,11 +62,7 @@ class Message implements Stringable * * @var array */ - public static array $level = [ - self::SUCCESS => 'success', - self::NOTICE => 'notice', - self::ERROR => 'error', - ]; + public static array $level = [self::SUCCESS => 'success', self::NOTICE => 'notice', self::ERROR => 'error']; /** * The message number @@ -689,10 +685,7 @@ class Message implements Stringable $template = new Template(); - return $template->render('message', [ - 'context' => $context, - 'message' => $this->getMessage(), - ]); + return $template->render('message', ['context' => $context, 'message' => $this->getMessage()]); } /** diff --git a/libraries/classes/Navigation/NavigationTree.php b/libraries/classes/Navigation/NavigationTree.php index 4e5ec3ddb6..a587d7ff04 100644 --- a/libraries/classes/Navigation/NavigationTree.php +++ b/libraries/classes/Navigation/NavigationTree.php @@ -789,10 +789,7 @@ class NavigationTree $newChild->addChild($elm); } - $newChildren[] = [ - 'node' => $newChild, - 'replaces_name' => $child->name, - ]; + $newChildren[] = ['node' => $newChild, 'replaces_name' => $child->name]; } } @@ -874,10 +871,7 @@ class NavigationTree $this->groupTree(); $children = $this->tree->children; - usort($children, [ - self::class, - 'sortNode', - ]); + usort($children, [self::class, 'sortNode']); $this->setVisibility(); $nodes = $this->renderNodes($children); @@ -905,10 +899,7 @@ class NavigationTree $listContent = $this->fastFilterHtml($node); $listContent .= $this->getPageSelector($node); $children = $node->children; - usort($children, [ - self::class, - 'sortNode', - ]); + usort($children, [self::class, 'sortNode']); $listContent .= $this->renderNodes($children, false); @@ -1076,13 +1067,7 @@ class NavigationTree $paginationParams = $this->getPaginationParamsHtml($node); - $haveAjax = [ - 'functions', - 'procedures', - 'events', - 'triggers', - 'indexes', - ]; + $haveAjax = ['functions', 'procedures', 'events', 'triggers', 'indexes']; $parent = $node->parents(false, true); $isNewView = $parent[0]->realName === 'views' && $node->isNew === true; $linkHasAjaxClass = $parent[0]->type == Node::CONTAINER @@ -1223,20 +1208,13 @@ class NavigationTree $options[] = [ 'title' => $title, 'name' => $node->realName, - 'data' => [ - 'apath' => $paths['aPath'], - 'vpath' => $paths['vPath'], - 'pos' => $this->pos, - ], + 'data' => ['apath' => $paths['aPath'], 'vpath' => $paths['vPath'], 'pos' => $this->pos], 'isSelected' => $node->realName === $selected, ]; } $children = $this->tree->children; - usort($children, [ - self::class, - 'sortNode', - ]); + usort($children, [self::class, 'sortNode']); $this->setVisibility(); $nodes = $this->renderNodes($children); diff --git a/libraries/classes/Navigation/Nodes/Node.php b/libraries/classes/Navigation/Nodes/Node.php index 74a15f6c6f..e99c3cf447 100644 --- a/libraries/classes/Navigation/Nodes/Node.php +++ b/libraries/classes/Navigation/Nodes/Node.php @@ -96,10 +96,7 @@ class Node * title?: string * } */ - public array $links = [ - 'text' => ['route' => '', 'params' => []], - 'icon' => ['route' => '', 'params' => []], - ]; + public array $links = ['text' => ['route' => '', 'params' => []], 'icon' => ['route' => '', 'params' => []]]; /** @var string HTML title */ public string $title = ''; @@ -340,12 +337,7 @@ class Node $vPath = implode('.', array_reverse($vPath)); $vPathClean = array_reverse($vPathClean); - return [ - 'aPath' => $aPath, - 'aPath_clean' => $aPathClean, - 'vPath' => $vPath, - 'vPath_clean' => $vPathClean, - ]; + return ['aPath' => $aPath, 'aPath_clean' => $aPathClean, 'vPath' => $vPath, 'vPath_clean' => $vPathClean]; } /** @@ -492,9 +484,7 @@ class Node { $databases = []; if (! empty($searchClause)) { - $databases = [ - '%' . $GLOBALS['dbi']->escapeString($searchClause) . '%', - ]; + $databases = ['%' . $GLOBALS['dbi']->escapeString($searchClause) . '%']; } elseif (! empty($GLOBALS['cfg']['Server']['only_db'])) { $databases = $GLOBALS['cfg']['Server']['only_db']; } elseif (! empty($GLOBALS['dbs_to_test'])) { @@ -532,9 +522,7 @@ class Node if (! empty($GLOBALS['cfg']['Server']['only_db'])) { if (is_string($GLOBALS['cfg']['Server']['only_db'])) { - $GLOBALS['cfg']['Server']['only_db'] = [ - $GLOBALS['cfg']['Server']['only_db'], - ]; + $GLOBALS['cfg']['Server']['only_db'] = [$GLOBALS['cfg']['Server']['only_db']]; } $whereClause .= 'AND ('; diff --git a/libraries/classes/Navigation/Nodes/NodeDatabase.php b/libraries/classes/Navigation/Nodes/NodeDatabase.php index e9161de758..61e7c7b704 100644 --- a/libraries/classes/Navigation/Nodes/NodeDatabase.php +++ b/libraries/classes/Navigation/Nodes/NodeDatabase.php @@ -570,10 +570,7 @@ class NodeDatabase extends Node $relationParameters = $this->relation->getRelationParameters(); if ($relationParameters->navigationItemsHidingFeature !== null) { if ($this->hiddenCount > 0) { - $params = [ - 'showUnhideDialog' => true, - 'dbName' => $this->realName, - ]; + $params = ['showUnhideDialog' => true, 'dbName' => $this->realName]; $ret = '' . 'getName()] as $collation) { - $collationsList[] = [ - 'name' => $collation->getName(), - 'description' => $collation->getDescription(), - ]; + $collationsList[] = ['name' => $collation->getName(), 'description' => $collation->getDescription()]; } $charsetsList[] = [ @@ -312,12 +309,7 @@ class Normalization . ''; - return [ - 'legendText' => $legendText, - 'headText' => $headText, - 'subText' => $subText, - 'extra' => $extra, - ]; + return ['legendText' => $legendText, 'headText' => $headText, 'subText' => $subText, 'extra' => $extra]; } /** @@ -514,11 +506,7 @@ class Normalization htmlspecialchars($table), ) . ''; if (count($partialDependencies) === 1) { - return [ - 'legendText' => __('End of step'), - 'headText' => $headText, - 'queryError' => false, - ]; + return ['legendText' => __('End of step'), 'headText' => $headText, 'queryError' => false]; } $message = ''; @@ -640,20 +628,13 @@ class Normalization . '( ' . htmlspecialchars($key) . '' . (count($dependents) > 0 ? ', ' : '') . htmlspecialchars(implode(', ', $dependents)) . ' )'; - $newTables[$table][$tableName] = [ - 'pk' => $key, - 'nonpk' => implode(', ', $dependents), - ]; + $newTables[$table][$tableName] = ['pk' => $key, 'nonpk' => implode(', ', $dependents)]; $i++; $tableName = 'table' . $i; } } - return [ - 'html' => $html, - 'newTables' => $newTables, - 'success' => true, - ]; + return ['html' => $html, 'newTables' => $newTables, 'success' => true]; } /** @@ -671,11 +652,7 @@ class Normalization $error = false; $headText = '

' . __('The third step of normalization is complete.') . '

'; if (count($newTables) === 0) { - return [ - 'legendText' => __('End of step'), - 'headText' => $headText, - 'queryError' => false, - ]; + return ['legendText' => __('End of step'), 'headText' => $headText, 'queryError' => false]; } $message = ''; @@ -808,10 +785,7 @@ class Normalization } $query2 = trim($query2, ','); - $queries = [ - $query1, - $query2, - ]; + $queries = [$query1, $query2]; $this->dbi->selectDb($db); foreach ($queries as $query) { if (! $this->dbi->tryQuery($query)) { @@ -825,10 +799,7 @@ class Normalization } } - return [ - 'queryError' => $error, - 'message' => $message, - ]; + return ['queryError' => $error, 'message' => $message]; } /** @@ -905,12 +876,7 @@ class Normalization $extra = '

' . __('Table is already in Third normal form!') . '

'; } - return [ - 'legendText' => $legendText, - 'headText' => $headText, - 'subText' => $subText, - 'extra' => $extra, - ]; + return ['legendText' => $legendText, 'headText' => $headText, 'subText' => $subText, 'extra' => $extra]; } /** diff --git a/libraries/classes/OpenDocument.php b/libraries/classes/OpenDocument.php index f19ebab5b0..15fe8f63e2 100644 --- a/libraries/classes/OpenDocument.php +++ b/libraries/classes/OpenDocument.php @@ -163,13 +163,7 @@ EOT; . '', ]; - $name = [ - 'mimetype', - 'content.xml', - 'meta.xml', - 'styles.xml', - 'META-INF/manifest.xml', - ]; + $name = ['mimetype', 'content.xml', 'meta.xml', 'styles.xml', 'META-INF/manifest.xml']; $zipExtension = new ZipExtension(); diff --git a/libraries/classes/Operations.php b/libraries/classes/Operations.php index a3bb3a06fd..3ed4932e9a 100644 --- a/libraries/classes/Operations.php +++ b/libraries/classes/Operations.php @@ -447,11 +447,7 @@ class Operations return; } - $getFields = [ - 'user', - 'label', - 'query', - ]; + $getFields = ['user', 'label', 'query']; $whereFields = ['dbase' => $db]; $newFields = ['dbase' => $newDatabaseName->getName()]; Table::duplicateInfo('bookmarkwork', 'bookmark', $getFields, $whereFields, $newFields); @@ -469,28 +465,11 @@ class Operations $possibleRowFormats = [ 'ARCHIVE' => ['COMPRESSED' => 'COMPRESSED'], - 'ARIA' => [ - 'FIXED' => 'FIXED', - 'DYNAMIC' => 'DYNAMIC', - 'PAGE' => 'PAGE', - ], - 'MARIA' => [ - 'FIXED' => 'FIXED', - 'DYNAMIC' => 'DYNAMIC', - 'PAGE' => 'PAGE', - ], - 'MYISAM' => [ - 'FIXED' => 'FIXED', - 'DYNAMIC' => 'DYNAMIC', - ], - 'PBXT' => [ - 'FIXED' => 'FIXED', - 'DYNAMIC' => 'DYNAMIC', - ], - 'INNODB' => [ - 'COMPACT' => 'COMPACT', - 'REDUNDANT' => 'REDUNDANT', - ], + 'ARIA' => ['FIXED' => 'FIXED', 'DYNAMIC' => 'DYNAMIC', 'PAGE' => 'PAGE'], + 'MARIA' => ['FIXED' => 'FIXED', 'DYNAMIC' => 'DYNAMIC', 'PAGE' => 'PAGE'], + 'MYISAM' => ['FIXED' => 'FIXED', 'DYNAMIC' => 'DYNAMIC'], + 'PBXT' => ['FIXED' => 'FIXED', 'DYNAMIC' => 'DYNAMIC'], + 'INNODB' => ['COMPACT' => 'COMPACT', 'REDUNDANT' => 'REDUNDANT'], ]; /** @var Innodb $innodbEnginePlugin */ @@ -599,10 +578,7 @@ class Operations . ' IS NOT NULL'; $thisUrlParams = array_merge( $urlParams, - [ - 'sql_query' => $joinQuery, - 'sql_signature' => Core::signSqlQuery($joinQuery), - ], + ['sql_query' => $joinQuery, 'sql_signature' => Core::signSqlQuery($joinQuery)], ); $foreigners[] = [ diff --git a/libraries/classes/Plugins/Auth/AuthenticationCookie.php b/libraries/classes/Plugins/Auth/AuthenticationCookie.php index 9e562b9c2d..2156a7d2c2 100644 --- a/libraries/classes/Plugins/Auth/AuthenticationCookie.php +++ b/libraries/classes/Plugins/Auth/AuthenticationCookie.php @@ -121,10 +121,7 @@ class AuthenticationCookie extends AuthenticationPlugin 'session_expired' => 1, ]); } else { - $loginHeader = $this->template->render('login/header', [ - 'add_class' => '', - 'session_expired' => 0, - ]); + $loginHeader = $this->template->render('login/header', ['add_class' => '', 'session_expired' => 0]); } $errorMessages = ''; diff --git a/libraries/classes/Plugins/Export/ExportCsv.php b/libraries/classes/Plugins/Export/ExportCsv.php index 2c0c71b6a7..f80ec2e9cb 100644 --- a/libraries/classes/Plugins/Export/ExportCsv.php +++ b/libraries/classes/Plugins/Export/ExportCsv.php @@ -131,16 +131,8 @@ class ExportCsv extends ExportPlugin $GLOBALS['csv_terminated'] = "\n"; } else { $GLOBALS['csv_terminated'] = str_replace( - [ - '\\r', - '\\n', - '\\t', - ], - [ - "\015", - "\012", - "\011", - ], + ['\\r', '\\n', '\\t'], + ["\015", "\012", "\011"], $GLOBALS['csv_terminated'], ); } @@ -270,10 +262,7 @@ class ExportCsv extends ExportPlugin isset($GLOBALS[$GLOBALS['what'] . '_removeCRLF']) && $GLOBALS[$GLOBALS['what'] . '_removeCRLF'] ) { $field = str_replace( - [ - "\r", - "\n", - ], + ["\r", "\n"], '', $field, ); diff --git a/libraries/classes/Plugins/Export/ExportHtmlword.php b/libraries/classes/Plugins/Export/ExportHtmlword.php index 3e35e3f1c0..2c27f36f65 100644 --- a/libraries/classes/Plugins/Export/ExportHtmlword.php +++ b/libraries/classes/Plugins/Export/ExportHtmlword.php @@ -58,11 +58,7 @@ class ExportHtmlword extends ExportPlugin // create primary items and add them to the group $leaf = new RadioPropertyItem('structure_or_data'); $leaf->setValues( - [ - 'structure' => __('structure'), - 'data' => __('data'), - 'structure_and_data' => __('structure and data'), - ], + ['structure' => __('structure'), 'data' => __('data'), 'structure_and_data' => __('structure and data')], ); $dumpWhat->addProperty($leaf); // add the main group to the root group diff --git a/libraries/classes/Plugins/Export/ExportJson.php b/libraries/classes/Plugins/Export/ExportJson.php index 0550bb0300..8684ab43f2 100644 --- a/libraries/classes/Plugins/Export/ExportJson.php +++ b/libraries/classes/Plugins/Export/ExportJson.php @@ -310,10 +310,7 @@ class ExportJson extends ExportPlugin */ public function exportRawQuery(string $errorUrl, string|null $db, string $sqlQuery): bool { - $buffer = $this->encode([ - 'type' => 'raw', - 'data' => '@@DATA@@', - ]); + $buffer = $this->encode(['type' => 'raw', 'data' => '@@DATA@@']); if ($buffer === false) { return false; } diff --git a/libraries/classes/Plugins/Export/ExportLatex.php b/libraries/classes/Plugins/Export/ExportLatex.php index b26ef6159a..e6754b5f10 100644 --- a/libraries/classes/Plugins/Export/ExportLatex.php +++ b/libraries/classes/Plugins/Export/ExportLatex.php @@ -90,11 +90,7 @@ class ExportLatex extends ExportPlugin // create primary items and add them to the group $leaf = new RadioPropertyItem('structure_or_data'); $leaf->setValues( - [ - 'structure' => __('structure'), - 'data' => __('data'), - 'structure_and_data' => __('structure and data'), - ], + ['structure' => __('structure'), 'data' => __('data'), 'structure_and_data' => __('structure and data')], ); $dumpWhat->addProperty($leaf); // add the main group to the root group @@ -321,10 +317,7 @@ class ExportLatex extends ExportPlugin . Util::expandUserString( $GLOBALS['latex_data_label'], null, - [ - 'table' => $tableAlias, - 'database' => $dbAlias, - ], + ['table' => $tableAlias, 'database' => $dbAlias], ) . '} \\\\'; } @@ -539,10 +532,7 @@ class ExportLatex extends ExportPlugin . Util::expandUserString( $GLOBALS['latex_structure_label'], null, - [ - 'table' => $tableAlias, - 'database' => $dbAlias, - ], + ['table' => $tableAlias, 'database' => $dbAlias], ) . '} \\\\' . "\n"; } @@ -642,16 +632,7 @@ class ExportLatex extends ExportPlugin */ public static function texEscape(string $string): string { - $escape = [ - '$', - '%', - '{', - '}', - '&', - '#', - '_', - '^', - ]; + $escape = ['$', '%', '{', '}', '&', '#', '_', '^']; $cntEscape = count($escape); for ($k = 0; $k < $cntEscape; $k++) { $string = str_replace($escape[$k], '\\' . $escape[$k], $string); diff --git a/libraries/classes/Plugins/Export/ExportMediawiki.php b/libraries/classes/Plugins/Export/ExportMediawiki.php index 282cbe8511..f4b9662870 100644 --- a/libraries/classes/Plugins/Export/ExportMediawiki.php +++ b/libraries/classes/Plugins/Export/ExportMediawiki.php @@ -61,11 +61,7 @@ class ExportMediawiki extends ExportPlugin ); $leaf = new RadioPropertyItem('structure_or_data'); $leaf->setValues( - [ - 'structure' => __('structure'), - 'data' => __('data'), - 'structure_and_data' => __('structure and data'), - ], + ['structure' => __('structure'), 'data' => __('data'), 'structure_and_data' => __('structure and data')], ); $subgroup->setSubgroupHeader($leaf); $generalOptions->addProperty($subgroup); diff --git a/libraries/classes/Plugins/Export/ExportOdt.php b/libraries/classes/Plugins/Export/ExportOdt.php index b84e85da1d..ffa7d4e6b7 100644 --- a/libraries/classes/Plugins/Export/ExportOdt.php +++ b/libraries/classes/Plugins/Export/ExportOdt.php @@ -71,11 +71,7 @@ class ExportOdt extends ExportPlugin // create primary items and add them to the group $leaf = new RadioPropertyItem('structure_or_data'); $leaf->setValues( - [ - 'structure' => __('structure'), - 'data' => __('data'), - 'structure_and_data' => __('structure and data'), - ], + ['structure' => __('structure'), 'data' => __('data'), 'structure_and_data' => __('structure and data')], ); $dumpWhat->addProperty($leaf); // add the main group to the root group diff --git a/libraries/classes/Plugins/Export/ExportPdf.php b/libraries/classes/Plugins/Export/ExportPdf.php index 5e829819b3..67156bdf79 100644 --- a/libraries/classes/Plugins/Export/ExportPdf.php +++ b/libraries/classes/Plugins/Export/ExportPdf.php @@ -81,11 +81,7 @@ class ExportPdf extends ExportPlugin ); $leaf = new RadioPropertyItem('structure_or_data'); $leaf->setValues( - [ - 'structure' => __('structure'), - 'data' => __('data'), - 'structure_and_data' => __('structure and data'), - ], + ['structure' => __('structure'), 'data' => __('data'), 'structure_and_data' => __('structure and data')], ); $dumpWhat->addProperty($leaf); // add the group to the root group diff --git a/libraries/classes/Plugins/Export/ExportSql.php b/libraries/classes/Plugins/Export/ExportSql.php index d440cbb810..c8e1f0ed0c 100644 --- a/libraries/classes/Plugins/Export/ExportSql.php +++ b/libraries/classes/Plugins/Export/ExportSql.php @@ -166,11 +166,7 @@ class ExportSql extends ExportPlugin __('Enclose export in a transaction'), ); $leaf->setDoc( - [ - 'programs', - 'mysqldump', - 'option_mysqldump_single-transaction', - ], + ['programs', 'mysqldump', 'option_mysqldump_single-transaction'], ); $generalOptions->addProperty($leaf); @@ -180,11 +176,7 @@ class ExportSql extends ExportPlugin __('Disable foreign key checks'), ); $leaf->setDoc( - [ - 'manual_MySQL_Database_Administration', - 'server-system-variables', - 'sysvar_foreign_key_checks', - ], + ['manual_MySQL_Database_Administration', 'server-system-variables', 'sysvar_foreign_key_checks'], ); $generalOptions->addProperty($leaf); @@ -215,11 +207,7 @@ class ExportSql extends ExportPlugin ); $leaf = new RadioPropertyItem('structure_or_data'); $leaf->setValues( - [ - 'structure' => __('structure'), - 'data' => __('data'), - 'structure_and_data' => __('structure and data'), - ], + ['structure' => __('structure'), 'data' => __('data'), 'structure_and_data' => __('structure and data')], ); $subgroup->setSubgroupHeader($leaf); $generalOptions->addProperty($subgroup); @@ -388,10 +376,7 @@ class ExportSql extends ExportPlugin __('INSERT DELAYED statements'), ); $leaf->setDoc( - [ - 'manual_MySQL_Database_Administration', - 'insert_delayed', - ], + ['manual_MySQL_Database_Administration', 'insert_delayed'], ); $subgroup->addProperty($leaf); @@ -400,10 +385,7 @@ class ExportSql extends ExportPlugin __('INSERT IGNORE statements'), ); $leaf->setDoc( - [ - 'manual_MySQL_Database_Administration', - 'insert', - ], + ['manual_MySQL_Database_Administration', 'insert'], ); $subgroup->addProperty($leaf); $dataOptions->addProperty($subgroup); @@ -414,11 +396,7 @@ class ExportSql extends ExportPlugin __('Function to use when dumping data:'), ); $leaf->setValues( - [ - 'INSERT' => 'INSERT', - 'UPDATE' => 'UPDATE', - 'REPLACE' => 'REPLACE', - ], + ['INSERT' => 'INSERT', 'UPDATE' => 'UPDATE', 'REPLACE' => 'REPLACE'], ); $dataOptions->addProperty($leaf); @@ -1060,11 +1038,7 @@ class ExportSql extends ExportPlugin $relationParams = $relationParameters->toArray(); if (isset($table)) { - $types = [ - 'column_info' => 'db_name', - 'table_uiprefs' => 'db_name', - 'tracking' => 'db_name', - ]; + $types = ['column_info' => 'db_name', 'table_uiprefs' => 'db_name', 'tracking' => 'db_name']; } else { $types = [ 'bookmark' => 'dbase', @@ -2731,10 +2705,7 @@ class ExportSql extends ExportPlugin ); $leaf->setValues($values); $leaf->setDoc( - [ - 'manual_MySQL_Database_Administration', - 'Server_SQL_mode', - ], + ['manual_MySQL_Database_Administration', 'Server_SQL_mode'], ); $generalOptions->addProperty($leaf); } diff --git a/libraries/classes/Plugins/Export/ExportTexytext.php b/libraries/classes/Plugins/Export/ExportTexytext.php index 6119204cc5..11e070d567 100644 --- a/libraries/classes/Plugins/Export/ExportTexytext.php +++ b/libraries/classes/Plugins/Export/ExportTexytext.php @@ -57,11 +57,7 @@ class ExportTexytext extends ExportPlugin // create primary items and add them to the group $leaf = new RadioPropertyItem('structure_or_data'); $leaf->setValues( - [ - 'structure' => __('structure'), - 'data' => __('data'), - 'structure_and_data' => __('structure and data'), - ], + ['structure' => __('structure'), 'data' => __('data'), 'structure_and_data' => __('structure and data')], ); $dumpWhat->addProperty($leaf); // add the main group to the root group diff --git a/libraries/classes/Plugins/Export/ExportYaml.php b/libraries/classes/Plugins/Export/ExportYaml.php index 3d5cbb57cc..5ee14fb561 100644 --- a/libraries/classes/Plugins/Export/ExportYaml.php +++ b/libraries/classes/Plugins/Export/ExportYaml.php @@ -176,18 +176,8 @@ class ExportYaml extends ExportPlugin } $record[$i] = str_replace( - [ - '\\', - '"', - "\n", - "\r", - ], - [ - '\\\\', - '\"', - '\n', - '\r', - ], + ['\\', '"', "\n", "\r"], + ['\\\\', '\"', '\n', '\r'], $record[$i], ); $buffer .= ' ' . $columns[$i] . ': "' . $record[$i] . '"' . "\n"; diff --git a/libraries/classes/Plugins/Export/Helpers/TableProperty.php b/libraries/classes/Plugins/Export/Helpers/TableProperty.php index 1ab071790a..23b72f1bd9 100644 --- a/libraries/classes/Plugins/Export/Helpers/TableProperty.php +++ b/libraries/classes/Plugins/Export/Helpers/TableProperty.php @@ -232,14 +232,8 @@ class TableProperty public function formatXml(string $text): string { $text = str_replace( - [ - '#name#', - '#indexName#', - ], - [ - htmlspecialchars($this->name, ENT_COMPAT, 'UTF-8'), - $this->getIndexName(), - ], + ['#name#', '#indexName#'], + [htmlspecialchars($this->name, ENT_COMPAT, 'UTF-8'), $this->getIndexName()], $text, ); @@ -256,14 +250,7 @@ class TableProperty public function format(string $text): string { return str_replace( - [ - '#ucfirstName#', - '#dotNetPrimitiveType#', - '#dotNetObjectType#', - '#type#', - '#notNull#', - '#unique#', - ], + ['#ucfirstName#', '#dotNetPrimitiveType#', '#dotNetObjectType#', '#type#', '#notNull#', '#unique#'], [ ExportCodegen::cgMakeIdentifier($this->name), $this->getDotNetPrimitiveType(), diff --git a/libraries/classes/Plugins/ExportPlugin.php b/libraries/classes/Plugins/ExportPlugin.php index 022f16fdf3..620a787af7 100644 --- a/libraries/classes/Plugins/ExportPlugin.php +++ b/libraries/classes/Plugins/ExportPlugin.php @@ -271,9 +271,7 @@ abstract class ExportPlugin implements Plugin string $tbl = '', ): string { if ($db !== '' && isset($aliases[$db])) { - $aliases = [ - $db => $aliases[$db], - ]; + $aliases = [$db => $aliases[$db]]; } // search each database @@ -288,9 +286,7 @@ abstract class ExportPlugin implements Plugin } if ($tbl !== '' && isset($db['tables'][$tbl])) { - $db['tables'] = [ - $tbl => $db['tables'][$tbl], - ]; + $db['tables'] = [$tbl => $db['tables'][$tbl]]; } // search each of its tables diff --git a/libraries/classes/Plugins/Import/ImportCsv.php b/libraries/classes/Plugins/Import/ImportCsv.php index bbc28a044d..629398aa9c 100644 --- a/libraries/classes/Plugins/Import/ImportCsv.php +++ b/libraries/classes/Plugins/Import/ImportCsv.php @@ -169,11 +169,7 @@ class ImportCsv extends AbstractImportCsv $GLOBALS['timeout_passed'] ??= null; $GLOBALS['finished'] ??= null; - $replacements = [ - '\\n' => "\n", - '\\t' => "\t", - '\\r' => "\r", - ]; + $replacements = ['\\n' => "\n", '\\t' => "\t", '\\r' => "\r"]; $GLOBALS['csv_terminated'] = strtr($GLOBALS['csv_terminated'], $replacements); $GLOBALS['csv_enclosed'] = strtr($GLOBALS['csv_enclosed'], $replacements); $GLOBALS['csv_escaped'] = strtr($GLOBALS['csv_escaped'], $replacements); @@ -581,11 +577,7 @@ class ImportCsv extends AbstractImportCsv $tblName = $this->getTableNameFromImport((string) $GLOBALS['db']); - $tables[] = [ - $tblName, - $colNames, - $rows, - ]; + $tables[] = [$tblName, $colNames, $rows]; /* Obtain the best-fit MySQL types for each column */ $analyses = []; diff --git a/libraries/classes/Plugins/Import/ImportMediawiki.php b/libraries/classes/Plugins/Import/ImportMediawiki.php index cbcf4da064..cfd3ce99ce 100644 --- a/libraries/classes/Plugins/Import/ImportMediawiki.php +++ b/libraries/classes/Plugins/Import/ImportMediawiki.php @@ -224,11 +224,7 @@ class ImportMediawiki extends ImportPlugin // No more processing required at the end of the table if (mb_substr($curBufferLine, 0, 2) === '|}') { - $currentTable = [ - $curTableName, - $curTempTableHeaders, - $curTempTable, - ]; + $currentTable = [$curTableName, $curTempTableHeaders, $curTempTable]; // Import the current table data into the database $this->importDataOneTable($currentTable, $sqlStatements); @@ -305,11 +301,7 @@ class ImportMediawiki extends ImportPlugin // Create the tables array to be used in Import::buildSql() $tables = []; - $tables[] = [ - $table[0], - $table[1], - $table[2], - ]; + $tables[] = [$table[0], $table[1], $table[2]]; // Obtain the best-fit MySQL types for each column $analyses = []; diff --git a/libraries/classes/Plugins/Import/ImportOds.php b/libraries/classes/Plugins/Import/ImportOds.php index 97d4ff2747..1c9a927cf6 100644 --- a/libraries/classes/Plugins/Import/ImportOds.php +++ b/libraries/classes/Plugins/Import/ImportOds.php @@ -423,11 +423,7 @@ class ImportOds extends ImportPlugin $tables[] = [(string) $tblAttr['name']]; /* Store the current sheet in the accumulator */ - $rows[] = [ - (string) $tblAttr['name'], - $colNames, - $tempRows, - ]; + $rows[] = [(string) $tblAttr['name'], $colNames, $tempRows]; $tempRows = []; $colNames = []; $maxCols = 0; diff --git a/libraries/classes/Plugins/Import/ImportShp.php b/libraries/classes/Plugins/Import/ImportShp.php index 3ff2378846..8c41b62741 100644 --- a/libraries/classes/Plugins/Import/ImportShp.php +++ b/libraries/classes/Plugins/Import/ImportShp.php @@ -268,13 +268,7 @@ class ImportShp extends ImportPlugin $tableName = 'TBL_NAME'; } - $tables = [ - [ - $tableName, - $colNames, - $rows, - ], - ]; + $tables = [[$tableName, $colNames, $rows]]; // Use data from shape file to chose best-fit MySQL types for each column $analyses = []; diff --git a/libraries/classes/Plugins/Import/ImportSql.php b/libraries/classes/Plugins/Import/ImportSql.php index f2a8829656..4cc250a266 100644 --- a/libraries/classes/Plugins/Import/ImportSql.php +++ b/libraries/classes/Plugins/Import/ImportSql.php @@ -61,10 +61,7 @@ class ImportSql extends ImportPlugin ); $leaf->setValues($values); $leaf->setDoc( - [ - 'manual_MySQL_Database_Administration', - 'Server_SQL_mode', - ], + ['manual_MySQL_Database_Administration', 'Server_SQL_mode'], ); $generalOptions->addProperty($leaf); $leaf = new BoolPropertyItem( @@ -72,11 +69,7 @@ class ImportSql extends ImportPlugin __('Do not use AUTO_INCREMENT for zero values'), ); $leaf->setDoc( - [ - 'manual_MySQL_Database_Administration', - 'Server_SQL_mode', - 'sqlmode_no_auto_value_on_zero', - ], + ['manual_MySQL_Database_Administration', 'Server_SQL_mode', 'sqlmode_no_auto_value_on_zero'], ); $generalOptions->addProperty($leaf); diff --git a/libraries/classes/Plugins/Import/ImportXml.php b/libraries/classes/Plugins/Import/ImportXml.php index 55c482343b..637c3c0880 100644 --- a/libraries/classes/Plugins/Import/ImportXml.php +++ b/libraries/classes/Plugins/Import/ImportXml.php @@ -249,11 +249,7 @@ class ImportXml extends ImportPlugin $tempCells[] = (string) $v2; } - $rows[] = [ - (string) $tblAttr['name'], - $tempRow, - $tempCells, - ]; + $rows[] = [(string) $tblAttr['name'], $tempRow, $tempCells]; $tempRow = []; $tempCells = []; @@ -317,10 +313,7 @@ class ImportXml extends ImportPlugin $options = null; } else { /* Set database collation/charset */ - $options = [ - 'db_collation' => $collation, - 'db_charset' => $charset, - ]; + $options = ['db_collation' => $collation, 'db_charset' => $charset]; } $createDb = $GLOBALS['db'] === ''; diff --git a/libraries/classes/Plugins/Schema/Dia/RelationStatsDia.php b/libraries/classes/Plugins/Schema/Dia/RelationStatsDia.php index 64c63c9fa4..be50ca7604 100644 --- a/libraries/classes/Plugins/Schema/Dia/RelationStatsDia.php +++ b/libraries/classes/Plugins/Schema/Dia/RelationStatsDia.php @@ -78,18 +78,10 @@ class RelationStatsDia // left, right, position $value = 12; if ($pos != 0) { - return [ - $pos + $value + $pos, - $pos + $value + $pos + 1, - $pos, - ]; + return [$pos + $value + $pos, $pos + $value + $pos + 1, $pos]; } - return [ - $pos + $value, - $pos + $value + 1, - $pos, - ]; + return [$pos + $value, $pos + $value + 1, $pos]; } /** @@ -121,11 +113,7 @@ class RelationStatsDia } if ($showColor) { - $listOfColors = [ - 'FF0000', - '000099', - '00FF00', - ]; + $listOfColors = ['FF0000', '000099', '00FF00']; shuffle($listOfColors); $this->referenceColor = '#' . $listOfColors[0]; } else { diff --git a/libraries/classes/Plugins/Schema/Dia/TableStatsDia.php b/libraries/classes/Plugins/Schema/Dia/TableStatsDia.php index 52e4f17e18..6339870330 100644 --- a/libraries/classes/Plugins/Schema/Dia/TableStatsDia.php +++ b/libraries/classes/Plugins/Schema/Dia/TableStatsDia.php @@ -86,11 +86,7 @@ class TableStatsDia extends TableStats public function tableDraw(bool $showColor): void { if ($showColor) { - $listOfColors = [ - 'FF0000', - '000099', - '00FF00', - ]; + $listOfColors = ['FF0000', '000099', '00FF00']; shuffle($listOfColors); $this->tableColor = '#' . $listOfColors[0]; } else { diff --git a/libraries/classes/Plugins/Schema/Pdf/PdfRelationSchema.php b/libraries/classes/Plugins/Schema/Pdf/PdfRelationSchema.php index fdb1c03476..dabbf63741 100644 --- a/libraries/classes/Plugins/Schema/Pdf/PdfRelationSchema.php +++ b/libraries/classes/Plugins/Schema/Pdf/PdfRelationSchema.php @@ -658,17 +658,7 @@ class PdfRelationSchema extends ExportRelationSchema $this->diagram->Cell($commentsWidth, 8, __('Comments'), 1, 0, 'C'); $this->diagram->Cell(45, 8, 'MIME', 1, 1, 'C'); $this->diagram->setWidths( - [ - 25, - 20, - 20, - 10, - 20, - 25, - 45, - $commentsWidth, - 45, - ], + [25, 20, 20, 10, 20, 25, 45, $commentsWidth, 45], ); } else { $this->diagram->Cell(20, 8, __('Column'), 1, 0, 'C'); diff --git a/libraries/classes/Plugins/Schema/Pdf/RelationStatsPdf.php b/libraries/classes/Plugins/Schema/Pdf/RelationStatsPdf.php index 312deb7244..8bc396330c 100644 --- a/libraries/classes/Plugins/Schema/Pdf/RelationStatsPdf.php +++ b/libraries/classes/Plugins/Schema/Pdf/RelationStatsPdf.php @@ -60,38 +60,7 @@ class RelationStatsPdf extends RelationStats $j = ($i - $d) / 6; $j %= 4; $j++; - $case = [ - [ - 1, - 0, - 0, - ], - [ - 0, - 1, - 0, - ], - [ - 0, - 0, - 1, - ], - [ - 1, - 1, - 0, - ], - [ - 1, - 0, - 1, - ], - [ - 0, - 1, - 1, - ], - ]; + $case = [[1, 0, 0], [0, 1, 0], [0, 0, 1], [1, 1, 0], [1, 0, 1], [0, 1, 1]]; [$a, $b, $c] = $case[$d]; $e = 1 - ($j - 1) / 6; $this->diagram->setDrawColor($a * 255 * $e, $b * 255 * $e, $c * 255 * $e); diff --git a/libraries/classes/Plugins/Schema/RelationStats.php b/libraries/classes/Plugins/Schema/RelationStats.php index 7565ba6c3e..26d457e783 100644 --- a/libraries/classes/Plugins/Schema/RelationStats.php +++ b/libraries/classes/Plugins/Schema/RelationStats.php @@ -105,10 +105,6 @@ abstract class RelationStats $pos = array_search($column, $table->fields); // x_left, x_right, y - return [ - $table->x, - $table->x + $table->width, - $table->y + ($pos + 1.5) * $table->heightCell, - ]; + return [$table->x, $table->x + $table->width, $table->y + ($pos + 1.5) * $table->heightCell]; } } diff --git a/libraries/classes/Plugins/Schema/SchemaDia.php b/libraries/classes/Plugins/Schema/SchemaDia.php index a39737a306..fd9e63ae5e 100644 --- a/libraries/classes/Plugins/Schema/SchemaDia.php +++ b/libraries/classes/Plugins/Schema/SchemaDia.php @@ -53,10 +53,7 @@ class SchemaDia extends SchemaPlugin __('Orientation'), ); $leaf->setValues( - [ - 'L' => __('Landscape'), - 'P' => __('Portrait'), - ], + ['L' => __('Landscape'), 'P' => __('Portrait')], ); $specificOptions->addProperty($leaf); diff --git a/libraries/classes/Plugins/Schema/SchemaEps.php b/libraries/classes/Plugins/Schema/SchemaEps.php index c2d9467e01..f917beea1a 100644 --- a/libraries/classes/Plugins/Schema/SchemaEps.php +++ b/libraries/classes/Plugins/Schema/SchemaEps.php @@ -61,10 +61,7 @@ class SchemaEps extends SchemaPlugin __('Orientation'), ); $leaf->setValues( - [ - 'L' => __('Landscape'), - 'P' => __('Portrait'), - ], + ['L' => __('Landscape'), 'P' => __('Portrait')], ); $specificOptions->addProperty($leaf); diff --git a/libraries/classes/Plugins/Schema/SchemaPdf.php b/libraries/classes/Plugins/Schema/SchemaPdf.php index a95949a672..3fabb84321 100644 --- a/libraries/classes/Plugins/Schema/SchemaPdf.php +++ b/libraries/classes/Plugins/Schema/SchemaPdf.php @@ -63,10 +63,7 @@ class SchemaPdf extends SchemaPlugin __('Orientation'), ); $leaf->setValues( - [ - 'L' => __('Landscape'), - 'P' => __('Portrait'), - ], + ['L' => __('Landscape'), 'P' => __('Portrait')], ); $specificOptions->addProperty($leaf); @@ -94,11 +91,7 @@ class SchemaPdf extends SchemaPlugin __('Order of the tables'), ); $leaf->setValues( - [ - '' => __('None'), - 'name_asc' => __('Name (Ascending)'), - 'name_desc' => __('Name (Descending)'), - ], + ['' => __('None'), 'name_asc' => __('Name (Ascending)'), 'name_desc' => __('Name (Descending)')], ); $specificOptions->addProperty($leaf); diff --git a/libraries/classes/Plugins/Schema/Svg/RelationStatsSvg.php b/libraries/classes/Plugins/Schema/Svg/RelationStatsSvg.php index 3696d7a2d0..2eb83808da 100644 --- a/libraries/classes/Plugins/Schema/Svg/RelationStatsSvg.php +++ b/libraries/classes/Plugins/Schema/Svg/RelationStatsSvg.php @@ -54,15 +54,7 @@ class RelationStatsSvg extends RelationStats public function relationDraw(bool $showColor): void { if ($showColor) { - $listOfColors = [ - '#c00', - '#bbb', - '#333', - '#cb0', - '#0b0', - '#0bf', - '#b0b', - ]; + $listOfColors = ['#c00', '#bbb', '#333', '#cb0', '#0b0', '#0bf', '#b0b']; shuffle($listOfColors); $color = $listOfColors[0]; } else { diff --git a/libraries/classes/Plugins/Transformations/Abs/DownloadTransformationsPlugin.php b/libraries/classes/Plugins/Transformations/Abs/DownloadTransformationsPlugin.php index 2f63518c5d..cde843167f 100644 --- a/libraries/classes/Plugins/Transformations/Abs/DownloadTransformationsPlugin.php +++ b/libraries/classes/Plugins/Transformations/Abs/DownloadTransformationsPlugin.php @@ -69,10 +69,7 @@ abstract class DownloadTransformationsPlugin extends TransformationsPlugin $link = '
' . htmlspecialchars($cn); diff --git a/libraries/classes/Plugins/Transformations/Abs/ExternalTransformationsPlugin.php b/libraries/classes/Plugins/Transformations/Abs/ExternalTransformationsPlugin.php index 930e0874d8..e66d4294e8 100644 --- a/libraries/classes/Plugins/Transformations/Abs/ExternalTransformationsPlugin.php +++ b/libraries/classes/Plugins/Transformations/Abs/ExternalTransformationsPlugin.php @@ -125,16 +125,7 @@ abstract class ExternalTransformationsPlugin extends TransformationsPlugin // needs PHP >= 4.3.0 $newstring = ''; - $descriptorspec = [ - 0 => [ - 'pipe', - 'r', - ], - 1 => [ - 'pipe', - 'w', - ], - ]; + $descriptorspec = [0 => ['pipe', 'r'], 1 => ['pipe', 'w']]; $process = proc_open($program . ' ' . $options[1], $descriptorspec, $pipes); if (is_resource($process)) { fwrite($pipes[0], $buffer); diff --git a/libraries/classes/Query/Utilities.php b/libraries/classes/Query/Utilities.php index d377efac57..9db3c0929e 100644 --- a/libraries/classes/Query/Utilities.php +++ b/libraries/classes/Query/Utilities.php @@ -34,12 +34,7 @@ class Utilities */ public static function getSystemSchemas(): array { - $schemas = [ - 'information_schema', - 'performance_schema', - 'mysql', - 'sys', - ]; + $schemas = ['information_schema', 'performance_schema', 'mysql', 'sys']; $systemSchemas = []; foreach ($schemas as $schema) { if (! self::isSystemSchema($schema, true)) { diff --git a/libraries/classes/RecentFavoriteTable.php b/libraries/classes/RecentFavoriteTable.php index f7dd6cdf64..8a213c64b1 100644 --- a/libraries/classes/RecentFavoriteTable.php +++ b/libraries/classes/RecentFavoriteTable.php @@ -188,10 +188,7 @@ class RecentFavoriteTable if ($this->tableType === 'recent') { $tables = []; foreach ($this->tables as $table) { - $tables[] = [ - 'db' => $table['db'], - 'table' => $table['table'], - ]; + $tables[] = ['db' => $table['db'], 'table' => $table['table']]; } return $this->template->render('recent_favorite_table_recent', ['tables' => $tables]); @@ -211,10 +208,7 @@ class RecentFavoriteTable 'md5' => md5($table['db'] . '.' . $table['table']), ]; - $tables[] = [ - 'remove_parameters' => $removeParameters, - 'table_parameters' => $tableParameters, - ]; + $tables[] = ['remove_parameters' => $removeParameters, 'table_parameters' => $tableParameters]; } return $this->template->render('recent_favorite_table_favorite', ['tables' => $tables]); @@ -361,10 +355,7 @@ class RecentFavoriteTable public static function getHtmlUpdateRecentTables(): string { return ''; } diff --git a/libraries/classes/Replication/ReplicationGui.php b/libraries/classes/Replication/ReplicationGui.php index dfde08d2ae..f599447a56 100644 --- a/libraries/classes/Replication/ReplicationGui.php +++ b/libraries/classes/Replication/ReplicationGui.php @@ -227,10 +227,7 @@ class ReplicationGui */ public function getHtmlForReplicationChangePrimary(string $submitName): string { - [ - $usernameLength, - $hostnameLength, - ] = $this->getUsernameHostnameLength(); + [$usernameLength, $hostnameLength] = $this->getUsernameHostnameLength(); return $this->template->render('server/replication/change_primary', [ 'server_id' => time(), @@ -265,14 +262,8 @@ class ReplicationGui $serverReplication = $replicationInfo->getPrimaryStatus(); if ($type === 'replica') { $replicationVariables = $replicationInfo->replicaVariables; - $variablesAlerts = [ - 'Slave_IO_Running' => 'No', - 'Slave_SQL_Running' => 'No', - ]; - $variablesOks = [ - 'Slave_IO_Running' => 'Yes', - 'Slave_SQL_Running' => 'Yes', - ]; + $variablesAlerts = ['Slave_IO_Running' => 'No', 'Slave_SQL_Running' => 'No']; + $variablesOks = ['Slave_IO_Running' => 'Yes', 'Slave_SQL_Running' => 'Yes']; $serverReplication = $replicationInfo->getReplicaStatus(); } @@ -282,11 +273,7 @@ class ReplicationGui ? $serverReplication[0][$variable] : ''; - $variables[$variable] = [ - 'name' => $variable, - 'status' => '', - 'value' => $serverReplicationVariable, - ]; + $variables[$variable] = ['name' => $variable, 'status' => '', 'value' => $serverReplicationVariable]; if (isset($variablesAlerts[$variable]) && $variablesAlerts[$variable] === $serverReplicationVariable) { $variables[$variable]['status'] = 'text-danger'; @@ -343,10 +330,7 @@ class ReplicationGui } } - return [ - $usernameLength, - $hostnameLength, - ]; + return [$usernameLength, $hostnameLength]; } /** @@ -356,10 +340,7 @@ class ReplicationGui */ public function getHtmlForReplicationPrimaryAddReplicaUser(string|null $postUsername, string|null $hostname): string { - [ - $usernameLength, - $hostnameLength, - ] = $this->getUsernameHostnameLength(); + [$usernameLength, $hostnameLength] = $this->getUsernameHostnameLength(); $username = ''; if ($postUsername === '') { diff --git a/libraries/classes/Replication/ReplicationInfo.php b/libraries/classes/Replication/ReplicationInfo.php index f48a81e062..742f809254 100644 --- a/libraries/classes/Replication/ReplicationInfo.php +++ b/libraries/classes/Replication/ReplicationInfo.php @@ -13,12 +13,7 @@ use function sprintf; final class ReplicationInfo { /** @var string[] */ - public array $primaryVariables = [ - 'File', - 'Position', - 'Binlog_Do_DB', - 'Binlog_Ignore_DB', - ]; + public array $primaryVariables = ['File', 'Position', 'Binlog_Do_DB', 'Binlog_Ignore_DB']; /** @var string[] */ public array $replicaVariables = [ diff --git a/libraries/classes/Sanitize.php b/libraries/classes/Sanitize.php index f120b4ea6a..ce400620b8 100644 --- a/libraries/classes/Sanitize.php +++ b/libraries/classes/Sanitize.php @@ -43,12 +43,7 @@ class Sanitize public static function checkLink(string $url, bool $http = false, bool $other = false): bool { $url = strtolower($url); - $validStarts = [ - 'https://', - 'index.php?route=/url&url=https%3a%2f%2f', - './doc/html/', - './index.php?', - ]; + $validStarts = ['https://', 'index.php?route=/url&url=https%3a%2f%2f', './doc/html/', './index.php?']; $isSetup = self::isSetup(); // Adjust path to setup script location if ($isSetup) { diff --git a/libraries/classes/SavedSearches.php b/libraries/classes/SavedSearches.php index 7b14dd21ba..c00951a729 100644 --- a/libraries/classes/SavedSearches.php +++ b/libraries/classes/SavedSearches.php @@ -260,10 +260,7 @@ class SavedSearches } //Else, it's an update. - $wheres = [ - 'id != ' . $this->getId(), - 'search_name = ' . $GLOBALS['dbi']->quoteString($this->getSearchName()), - ]; + $wheres = ['id != ' . $this->getId(), 'search_name = ' . $GLOBALS['dbi']->quoteString($this->getSearchName())]; $existingSearches = $this->getList($savedQueryByExampleSearchesFeature, $wheres); if ($existingSearches !== []) { diff --git a/libraries/classes/Scripts.php b/libraries/classes/Scripts.php index 341e41f487..95d8414263 100644 --- a/libraries/classes/Scripts.php +++ b/libraries/classes/Scripts.php @@ -53,11 +53,7 @@ class Scripts } $hasOnload = $this->hasOnloadEvent($filename); - $this->files[$hash] = [ - 'has_onload' => (int) $hasOnload, - 'filename' => $filename, - 'params' => $params, - ]; + $this->files[$hash] = ['has_onload' => (int) $hasOnload, 'filename' => $filename, 'params' => $params]; } /** @@ -116,10 +112,7 @@ class Scripts continue; } - $retval[] = [ - 'name' => $file['filename'], - 'fire' => $file['has_onload'], - ]; + $retval[] = ['name' => $file['filename'], 'fire' => $file['has_onload']]; } return $retval; diff --git a/libraries/classes/Server/Privileges.php b/libraries/classes/Server/Privileges.php index d7d7baf9f9..abb5611e7d 100644 --- a/libraries/classes/Server/Privileges.php +++ b/libraries/classes/Server/Privileges.php @@ -258,11 +258,7 @@ class Privileges } } elseif ($allPrivileges && (! isset($_POST['grant_count']) || count($privs) == $_POST['grant_count'])) { if ($enableHTML) { - $privs = [ - 'ALL PRIVILEGES', - ]; + $privs = ['ALL PRIVILEGES']; } else { $privs = ['ALL PRIVILEGES']; } @@ -279,46 +275,14 @@ class Privileges public function getTableGrantsArray(): array { return [ - [ - 'Delete', - 'DELETE', - __('Allows deleting data.'), - ], - [ - 'Create', - 'CREATE', - __('Allows creating new tables.'), - ], - [ - 'Drop', - 'DROP', - __('Allows dropping tables.'), - ], - [ - 'Index', - 'INDEX', - __('Allows creating and dropping indexes.'), - ], - [ - 'Alter', - 'ALTER', - __('Allows altering the structure of existing tables.'), - ], - [ - 'Create View', - 'CREATE_VIEW', - __('Allows creating new views.'), - ], - [ - 'Show view', - 'SHOW_VIEW', - __('Allows performing SHOW CREATE VIEW queries.'), - ], - [ - 'Trigger', - 'TRIGGER', - __('Allows creating and dropping triggers.'), - ], + ['Delete', 'DELETE', __('Allows deleting data.')], + ['Create', 'CREATE', __('Allows creating new tables.')], + ['Drop', 'DROP', __('Allows dropping tables.')], + ['Index', 'INDEX', __('Allows creating and dropping indexes.')], + ['Alter', 'ALTER', __('Allows altering the structure of existing tables.')], + ['Create View', 'CREATE_VIEW', __('Allows creating new views.')], + ['Show view', 'SHOW_VIEW', __('Allows performing SHOW CREATE VIEW queries.')], + ['Trigger', 'TRIGGER', __('Allows creating and dropping triggers.')], ]; } @@ -331,76 +295,20 @@ class Privileges public function getGrantsArray(): array { return [ - [ - 'Select_priv', - 'SELECT', - __('Allows reading data.'), - ], - [ - 'Insert_priv', - 'INSERT', - __('Allows inserting and replacing data.'), - ], - [ - 'Update_priv', - 'UPDATE', - __('Allows changing data.'), - ], - [ - 'Delete_priv', - 'DELETE', - __('Allows deleting data.'), - ], - [ - 'Create_priv', - 'CREATE', - __('Allows creating new databases and tables.'), - ], - [ - 'Drop_priv', - 'DROP', - __('Allows dropping databases and tables.'), - ], - [ - 'Reload_priv', - 'RELOAD', - __('Allows reloading server settings and flushing the server\'s caches.'), - ], - [ - 'Shutdown_priv', - 'SHUTDOWN', - __('Allows shutting down the server.'), - ], - [ - 'Process_priv', - 'PROCESS', - __('Allows viewing processes of all users.'), - ], - [ - 'File_priv', - 'FILE', - __('Allows importing data from and exporting data into files.'), - ], - [ - 'References_priv', - 'REFERENCES', - __('Has no effect in this MySQL version.'), - ], - [ - 'Index_priv', - 'INDEX', - __('Allows creating and dropping indexes.'), - ], - [ - 'Alter_priv', - 'ALTER', - __('Allows altering the structure of existing tables.'), - ], - [ - 'Show_db_priv', - 'SHOW DATABASES', - __('Gives access to the complete list of databases.'), - ], + ['Select_priv', 'SELECT', __('Allows reading data.')], + ['Insert_priv', 'INSERT', __('Allows inserting and replacing data.')], + ['Update_priv', 'UPDATE', __('Allows changing data.')], + ['Delete_priv', 'DELETE', __('Allows deleting data.')], + ['Create_priv', 'CREATE', __('Allows creating new databases and tables.')], + ['Drop_priv', 'DROP', __('Allows dropping databases and tables.')], + ['Reload_priv', 'RELOAD', __('Allows reloading server settings and flushing the server\'s caches.')], + ['Shutdown_priv', 'SHUTDOWN', __('Allows shutting down the server.')], + ['Process_priv', 'PROCESS', __('Allows viewing processes of all users.')], + ['File_priv', 'FILE', __('Allows importing data from and exporting data into files.')], + ['References_priv', 'REFERENCES', __('Has no effect in this MySQL version.')], + ['Index_priv', 'INDEX', __('Allows creating and dropping indexes.')], + ['Alter_priv', 'ALTER', __('Allows altering the structure of existing tables.')], + ['Show_db_priv', 'SHOW DATABASES', __('Gives access to the complete list of databases.')], [ 'Super_priv', 'SUPER', @@ -410,58 +318,22 @@ class Privileges . 'like setting global variables or killing threads of other users.', ), ], - [ - 'Create_tmp_table_priv', - 'CREATE TEMPORARY TABLES', - __('Allows creating temporary tables.'), - ], - [ - 'Lock_tables_priv', - 'LOCK TABLES', - __('Allows locking tables for the current thread.'), - ], - [ - 'Repl_slave_priv', - 'REPLICATION SLAVE', - __('Needed for the replication replicas.'), - ], + ['Create_tmp_table_priv', 'CREATE TEMPORARY TABLES', __('Allows creating temporary tables.')], + ['Lock_tables_priv', 'LOCK TABLES', __('Allows locking tables for the current thread.')], + ['Repl_slave_priv', 'REPLICATION SLAVE', __('Needed for the replication replicas.')], [ 'Repl_client_priv', 'REPLICATION CLIENT', __('Allows the user to ask where the replicas / primaries are.'), ], - [ - 'Create_view_priv', - 'CREATE VIEW', - __('Allows creating new views.'), - ], - [ - 'Event_priv', - 'EVENT', - __('Allows to set up events for the event scheduler.'), - ], - [ - 'Trigger_priv', - 'TRIGGER', - __('Allows creating and dropping triggers.'), - ], + ['Create_view_priv', 'CREATE VIEW', __('Allows creating new views.')], + ['Event_priv', 'EVENT', __('Allows to set up events for the event scheduler.')], + ['Trigger_priv', 'TRIGGER', __('Allows creating and dropping triggers.')], // for table privs: - [ - 'Create View_priv', - 'CREATE VIEW', - __('Allows creating new views.'), - ], - [ - 'Show_view_priv', - 'SHOW VIEW', - __('Allows performing SHOW CREATE VIEW queries.'), - ], + ['Create View_priv', 'CREATE VIEW', __('Allows creating new views.')], + ['Show_view_priv', 'SHOW VIEW', __('Allows performing SHOW CREATE VIEW queries.')], // for table privs: - [ - 'Show view_priv', - 'SHOW VIEW', - __('Allows performing SHOW CREATE VIEW queries.'), - ], + ['Show view_priv', 'SHOW VIEW', __('Allows performing SHOW CREATE VIEW queries.')], [ 'Delete_history_priv', 'DELETE HISTORY', @@ -478,26 +350,10 @@ class Privileges /* l10n: https://mariadb.com/kb/en/library/grant/#table-privileges "Remove historical rows from a table using the DELETE HISTORY statement" */ __('Allows deleting historical rows.'), ], - [ - 'Create_routine_priv', - 'CREATE ROUTINE', - __('Allows creating stored routines.'), - ], - [ - 'Alter_routine_priv', - 'ALTER ROUTINE', - __('Allows altering and dropping stored routines.'), - ], - [ - 'Create_user_priv', - 'CREATE USER', - __('Allows creating, dropping and renaming user accounts.'), - ], - [ - 'Execute_priv', - 'EXECUTE', - __('Allows executing stored routines.'), - ], + ['Create_routine_priv', 'CREATE ROUTINE', __('Allows creating stored routines.')], + ['Alter_routine_priv', 'ALTER ROUTINE', __('Allows altering and dropping stored routines.')], + ['Create_user_priv', 'CREATE USER', __('Allows creating, dropping and renaming user accounts.')], + ['Execute_priv', 'EXECUTE', __('Allows executing stored routines.')], ]; } @@ -813,10 +669,7 @@ class Privileges } } - return [ - $usernameLength, - $hostnameLength, - ]; + return [$usernameLength, $hostnameLength]; } /** @@ -1078,10 +931,7 @@ class Privileges ); $message->addParam('\'' . $username . '\'@\'' . $hostname . '\''); - return [ - $message, - $sqlQuery, - ]; + return [$message, $sqlQuery]; } /** @@ -1232,10 +1082,7 @@ class Privileges */ private function getSpecificPrivilege(array $row): array { - $privilege = [ - 'type' => $row['Type'], - 'database' => $row['Db'], - ]; + $privilege = ['type' => $row['Type'], 'database' => $row['Db']]; if ($row['Type'] === 'r') { $privilege['routine'] = $row['Routine_name']; $privilege['has_grant'] = str_contains($row['Proc_priv'], 'Grant'); @@ -1401,10 +1248,7 @@ class Privileges $linkClass = 'export_user_anchor ajax'; } - $params = [ - 'username' => $username, - 'hostname' => $hostname, - ]; + $params = ['username' => $username, 'hostname' => $hostname]; switch ($linktype) { case 'edit': $params['dbname'] = $dbname; @@ -1595,11 +1439,7 @@ class Privileges $userHostCondition = $this->getUserHostCondition($username, $hostname); if ($type === 'database') { - $tablesToSearchForUsers = [ - 'tables_priv', - 'columns_priv', - 'procs_priv', - ]; + $tablesToSearchForUsers = ['tables_priv', 'columns_priv', 'procs_priv']; $dbOrTableName = 'Db'; } elseif ($type === 'table') { $userHostCondition .= ' AND `Db` LIKE ' . $this->dbi->quoteString($dbname); @@ -1625,12 +1465,7 @@ class Privileges . $userHostCondition; } - $userDefaults = [ - $dbOrTableName => '', - 'Grant_priv' => 'N', - 'privs' => ['USAGE'], - 'Column_priv' => true, - ]; + $userDefaults = [$dbOrTableName => '', 'Grant_priv' => 'N', 'privs' => ['USAGE'], 'Column_priv' => true]; // for the rights $dbRights = []; @@ -1700,11 +1535,7 @@ class Privileges */ public function parseProcPriv(string $privs): array { - $result = [ - 'Alter_routine_priv' => 'N', - 'Execute_priv' => 'N', - 'Grant_priv' => 'N', - ]; + $result = ['Alter_routine_priv' => 'N', 'Execute_priv' => 'N', 'Grant_priv' => 'N']; foreach (explode(',', $privs) as $priv) { if ($priv === 'Alter Routine') { $result['Alter_routine_priv'] = 'Y'; @@ -1842,10 +1673,7 @@ class Privileges if ($type === 'database') { $predDbArray = $this->dbi->getDatabaseList(); - $databasesToSkip = [ - 'information_schema', - 'performance_schema', - ]; + $databasesToSkip = ['information_schema', 'performance_schema']; $databases = []; $escapedDatabases = []; @@ -2031,13 +1859,7 @@ class Privileges // we also want users not in table `user` but in other table $tables = $this->dbi->fetchResult('SHOW TABLES FROM `mysql`;'); - $tablesSearchForUsers = [ - 'user', - 'db', - 'tables_priv', - 'columns_priv', - 'procs_priv', - ]; + $tablesSearchForUsers = ['user', 'db', 'tables_priv', 'columns_priv', 'procs_priv']; $dbRightsSqls = []; foreach ($tablesSearchForUsers as $tableSearchIn) { @@ -2049,13 +1871,7 @@ class Privileges . $tableSearchIn . '` ' . $this->rangeOfUsers($initial); } - $userDefaults = [ - 'User' => '', - 'Host' => '%', - 'Password' => '?', - 'Grant_priv' => 'N', - 'privs' => ['USAGE'], - ]; + $userDefaults = ['User' => '', 'Host' => '%', 'Password' => '?', 'Grant_priv' => 'N', 'privs' => ['USAGE']]; // for the rights $dbRights = []; @@ -2119,10 +1935,7 @@ class Privileges } } - return [ - $sqlQuery, - $message, - ]; + return [$sqlQuery, $message]; } /** @@ -2194,10 +2007,7 @@ class Privileges $message = Message::success(__('You have updated the privileges for %s.')); $message->addParam('\'' . $username . '\'@\'' . $hostname . '\''); - return [ - $sqlQuery, - $message, - ]; + return [$sqlQuery, $message]; } /** @@ -2335,9 +2145,7 @@ class Privileges public function getDataForDeleteUsers(array $queries): array { if (isset($_POST['change_copy'])) { - $selectedUsr = [ - $_POST['old_username'] . '&#27;' . $_POST['old_hostname'], - ]; + $selectedUsr = [$_POST['old_username'] . '&#27;' . $_POST['old_hostname']]; } else { // null happens when no user was selected $selectedUsr = $_POST['selected_usr'] ?? null; @@ -2696,14 +2504,7 @@ class Privileges // check if given $dbname is a wildcard or not $databaseNameIsWildcard = is_string($dbname) && preg_match('/(?getHtmlForLoginInformationFields(); } - $params = [ - 'username' => $username, - 'hostname' => $hostname, - ]; + $params = ['username' => $username, 'hostname' => $hostname]; $params['dbname'] = $dbname; if (! is_array($dbname) && $dbname !== '' && $tablename !== '') { $params['tablename'] = $tablename; @@ -3036,12 +2834,7 @@ class Privileges ); $tmpPrivs1 = $this->extractPrivInfo($row); - $tmpPrivs2 = [ - 'Select' => [], - 'Insert' => [], - 'Update' => [], - 'References' => [], - ]; + $tmpPrivs2 = ['Select' => [], 'Insert' => [], 'Update' => [], 'References' => []]; while ($row2 = $res2->fetchAssoc()) { $tmpArray = explode(',', $row2['Column_priv']); @@ -3211,10 +3004,7 @@ class Privileges } } - return [ - $sqlQuery, - $message, - ]; + return [$sqlQuery, $message]; } /** diff --git a/libraries/classes/Server/Status/Data.php b/libraries/classes/Server/Status/Data.php index 3f9f70dc71..50b118cc37 100644 --- a/libraries/classes/Server/Status/Data.php +++ b/libraries/classes/Server/Status/Data.php @@ -177,31 +177,19 @@ class Data ]; $links['table'][__('Show open tables')] = [ 'url' => Url::getFromRoute('/sql'), - 'params' => Url::getCommon([ - 'sql_query' => 'SHOW OPEN TABLES', - 'goto' => $selfUrl, - ], ''), + 'params' => Url::getCommon(['sql_query' => 'SHOW OPEN TABLES', 'goto' => $selfUrl], ''), ]; if ($primaryInfo['status']) { $links['repl'][__('Show replica hosts')] = [ 'url' => Url::getFromRoute('/sql'), - 'params' => Url::getCommon([ - 'sql_query' => 'SHOW SLAVE HOSTS', - 'goto' => $selfUrl, - ], ''), - ]; - $links['repl'][__('Show primary status')] = [ - 'url' => '#replication_primary', - 'params' => '', + 'params' => Url::getCommon(['sql_query' => 'SHOW SLAVE HOSTS', 'goto' => $selfUrl], ''), ]; + $links['repl'][__('Show primary status')] = ['url' => '#replication_primary', 'params' => '']; } if ($replicaInfo['status']) { - $links['repl'][__('Show replica status')] = [ - 'url' => '#replication_replica', - 'params' => '', - ]; + $links['repl'][__('Show replica status')] = ['url' => '#replication_replica', 'params' => '']; } $links['repl']['doc'] = 'replication'; @@ -220,10 +208,7 @@ class Data $links['Slow_queries']['doc'] = 'slow_query_log'; - $links['innodb'][__('Variables')] = [ - 'url' => Url::getFromRoute('/server/engines/InnoDB'), - 'params' => '', - ]; + $links['innodb'][__('Variables')] = ['url' => Url::getFromRoute('/server/engines/InnoDB'), 'params' => '']; $links['innodb'][__('InnoDB Status')] = [ 'url' => Url::getFromRoute('/server/engines/InnoDB/Status'), 'params' => '', @@ -337,11 +322,7 @@ class Data $sectionUsed['other'] = true; } - return [ - $allocationMap, - $sectionUsed, - $usedQueries, - ]; + return [$allocationMap, $sectionUsed, $usedQueries]; } public function __construct(private DatabaseInterface $dbi, private Config $config) diff --git a/libraries/classes/Server/Status/Monitor.php b/libraries/classes/Server/Status/Monitor.php index b49dbda830..ef7af497da 100644 --- a/libraries/classes/Server/Status/Monitor.php +++ b/libraries/classes/Server/Status/Monitor.php @@ -160,11 +160,7 @@ class Monitor } /* foreach */ } - return [ - $serverVars, - $statusVars, - $ret, - ]; + return [$serverVars, $statusVars, $ret]; } /** @@ -246,11 +242,7 @@ class Monitor break; } - return [ - $serverVars, - $statusVars, - $ret, - ]; + return [$serverVars, $statusVars, $ret]; } /** @@ -277,10 +269,7 @@ class Monitor return null; } - $return = [ - 'rows' => [], - 'sum' => [], - ]; + $return = ['rows' => [], 'sum' => []]; while ($row = $result->fetchAssoc()) { $type = mb_strtolower( @@ -360,10 +349,7 @@ class Monitor return null; } - $return = [ - 'rows' => [], - 'sum' => [], - ]; + $return = ['rows' => [], 'sum' => []]; $insertTables = []; $insertTablesFirst = -1; $i = 0; diff --git a/libraries/classes/Server/Status/Processes.php b/libraries/classes/Server/Status/Processes.php index 9abe55ff13..ad3da89aaf 100644 --- a/libraries/classes/Server/Status/Processes.php +++ b/libraries/classes/Server/Status/Processes.php @@ -96,47 +96,20 @@ final class Processes // This array contains display name and real column name of each // sortable column in the table $sortableColumns = [ - [ - 'column_name' => __('ID'), - 'order_by_field' => 'Id', - ], - [ - 'column_name' => __('User'), - 'order_by_field' => 'User', - ], - [ - 'column_name' => __('Host'), - 'order_by_field' => 'Host', - ], - [ - 'column_name' => __('Database'), - 'order_by_field' => 'Db', - ], - [ - 'column_name' => __('Command'), - 'order_by_field' => 'Command', - ], - [ - 'column_name' => __('Time'), - 'order_by_field' => 'Time', - ], - [ - 'column_name' => __('Status'), - 'order_by_field' => 'State', - ], + ['column_name' => __('ID'), 'order_by_field' => 'Id'], + ['column_name' => __('User'), 'order_by_field' => 'User'], + ['column_name' => __('Host'), 'order_by_field' => 'Host'], + ['column_name' => __('Database'), 'order_by_field' => 'Db'], + ['column_name' => __('Command'), 'order_by_field' => 'Command'], + ['column_name' => __('Time'), 'order_by_field' => 'Time'], + ['column_name' => __('Status'), 'order_by_field' => 'State'], ]; if ($this->dbi->isMariaDB()) { - $sortableColumns[] = [ - 'column_name' => __('Progress'), - 'order_by_field' => 'Progress', - ]; + $sortableColumns[] = ['column_name' => __('Progress'), 'order_by_field' => 'Progress']; } - $sortableColumns[] = [ - 'column_name' => __('SQL query'), - 'order_by_field' => 'Info', - ]; + $sortableColumns[] = ['column_name' => __('SQL query'), 'order_by_field' => 'Info']; $sortableColCount = count($sortableColumns); diff --git a/libraries/classes/Server/SysInfo/Linux.php b/libraries/classes/Server/SysInfo/Linux.php index 84f6937c04..a5914b5ee8 100644 --- a/libraries/classes/Server/SysInfo/Linux.php +++ b/libraries/classes/Server/SysInfo/Linux.php @@ -50,10 +50,7 @@ class Linux extends Base return ['busy' => 0, 'idle' => 0]; } - return [ - 'busy' => (int) $nums[1] + (int) $nums[2] + (int) $nums[3], - 'idle' => (int) $nums[4], - ]; + return ['busy' => (int) $nums[1] + (int) $nums[2] + (int) $nums[3], 'idle' => (int) $nums[4]]; } /** diff --git a/libraries/classes/Server/SysInfo/SysInfo.php b/libraries/classes/Server/SysInfo/SysInfo.php index ce3b7ff920..ee30929a4c 100644 --- a/libraries/classes/Server/SysInfo/SysInfo.php +++ b/libraries/classes/Server/SysInfo/SysInfo.php @@ -28,10 +28,7 @@ class SysInfo public static function getOs(string $phpOs = PHP_OS): string { // look for common UNIX-like systems - $unixLike = [ - 'FreeBSD', - 'DragonFly', - ]; + $unixLike = ['FreeBSD', 'DragonFly']; if (in_array($phpOs, $unixLike)) { $phpOs = 'Linux'; } diff --git a/libraries/classes/Setup/FormProcessing.php b/libraries/classes/Setup/FormProcessing.php index 7304ce5697..0efa6d786c 100644 --- a/libraries/classes/Setup/FormProcessing.php +++ b/libraries/classes/Setup/FormProcessing.php @@ -65,16 +65,9 @@ class FormProcessing $formId = $formDisplay->getConfigFile()->getServerCount(); } - $urlParams = [ - 'page' => $page, - 'formset' => $formset, - 'id' => $formId, - ]; + $urlParams = ['page' => $page, 'formset' => $formset, 'id' => $formId]; $template = new Template(); - echo $template->render('setup/error', [ - 'url_params' => $urlParams, - 'errors' => $formDisplay->displayErrors(), - ]); + echo $template->render('setup/error', ['url_params' => $urlParams, 'errors' => $formDisplay->displayErrors()]); } } diff --git a/libraries/classes/Setup/Index.php b/libraries/classes/Setup/Index.php index eaeba06586..393f46cec9 100644 --- a/libraries/classes/Setup/Index.php +++ b/libraries/classes/Setup/Index.php @@ -30,10 +30,7 @@ class Index public static function messagesBegin(): void { if (! isset($_SESSION['messages']) || ! is_array($_SESSION['messages'])) { - $_SESSION['messages'] = [ - 'error' => [], - 'notice' => [], - ]; + $_SESSION['messages'] = ['error' => [], 'notice' => []]; } else { // reset message states foreach ($_SESSION['messages'] as &$messages) { diff --git a/libraries/classes/Sql.php b/libraries/classes/Sql.php index 74ffc26c6e..79e38615bd 100644 --- a/libraries/classes/Sql.php +++ b/libraries/classes/Sql.php @@ -224,11 +224,7 @@ class Sql if ($foreignData['disp_row'] == null) { //Handle the case when number of values //is more than $cfg['ForeignKeyMaxLimit'] - $urlParams = [ - 'db' => $db, - 'table' => $table, - 'field' => $column, - ]; + $urlParams = ['db' => $db, 'table' => $table, 'field' => $column]; return $this->template->render('sql/relational_column_dropdown', [ 'current_value' => $_POST['curr_value'], @@ -250,12 +246,7 @@ class Sql /** @return array */ private function getDetailedProfilingStats(array $profilingResults): array { - $profiling = [ - 'total_time' => 0, - 'states' => [], - 'chart' => [], - 'profile' => [], - ]; + $profiling = ['total_time' => 0, 'states' => [], 'chart' => [], 'profile' => []]; foreach ($profilingResults as $oneResult) { $status = ucwords($oneResult['Status']); @@ -267,10 +258,7 @@ class Sql ]; if (! isset($profiling['states'][$status])) { - $profiling['states'][$status] = [ - 'total_time' => $oneResult['Duration'], - 'calls' => 1, - ]; + $profiling['states'][$status] = ['total_time' => $oneResult['Duration'], 'calls' => 1]; $profiling['chart'][$status] = $oneResult['Duration']; } else { $profiling['states'][$status]['calls']++; @@ -818,13 +806,7 @@ class Sql } } - return [ - $result, - $numRows, - $unlimNumRows, - $profilingResults, - $extraData, - ]; + return [$result, $numRows, $unlimNumRows, $profilingResults, $extraData]; } /** @@ -1631,13 +1613,7 @@ class Sql $GLOBALS['reload'] = $this->hasCurrentDbChanged($db); $this->dbi->selectDb($db); - [ - $result, - $numRows, - $unlimNumRows, - $profilingResults, - $extraData, - ] = $this->executeTheQuery( + [$result, $numRows, $unlimNumRows, $profilingResults, $extraData] = $this->executeTheQuery( $statementInfo, $fullSqlQuery, $isGotoFile, diff --git a/libraries/classes/SqlQueryForm.php b/libraries/classes/SqlQueryForm.php index 00d8a010aa..93d0f4269e 100644 --- a/libraries/classes/SqlQueryForm.php +++ b/libraries/classes/SqlQueryForm.php @@ -171,10 +171,6 @@ class SqlQueryForm $legend .= ': ' . MySQLDocumentation::show('SELECT'); - return [ - $legend, - $query, - $columnsList, - ]; + return [$legend, $query, $columnsList]; } } diff --git a/libraries/classes/Table.php b/libraries/classes/Table.php index 457cfd80d8..7d3de89c2e 100644 --- a/libraries/classes/Table.php +++ b/libraries/classes/Table.php @@ -1040,10 +1040,7 @@ class Table implements Stringable $tbl = new Table($targetTable, $targetDb, $GLOBALS['dbi']); $statement->options = new OptionsArray( - [ - $tbl->isView() ? 'VIEW' : 'TABLE', - 'IF EXISTS', - ], + [$tbl->isView() ? 'VIEW' : 'TABLE', 'IF EXISTS'], ); $statement->fields = [$destination]; @@ -1312,47 +1309,19 @@ class Table implements Stringable // just once per db $getFields = ['display_field']; - $whereFields = [ - 'db_name' => $sourceDb, - 'table_name' => $sourceTable, - ]; - $newFields = [ - 'db_name' => $targetDb, - 'table_name' => $targetTable, - ]; + $whereFields = ['db_name' => $sourceDb, 'table_name' => $sourceTable]; + $newFields = ['db_name' => $targetDb, 'table_name' => $targetTable]; self::duplicateInfo('displaywork', 'table_info', $getFields, $whereFields, $newFields); /** @todo revise this code when we support cross-db relations */ - $getFields = [ - 'master_field', - 'foreign_table', - 'foreign_field', - ]; - $whereFields = [ - 'master_db' => $sourceDb, - 'master_table' => $sourceTable, - ]; - $newFields = [ - 'master_db' => $targetDb, - 'foreign_db' => $targetDb, - 'master_table' => $targetTable, - ]; + $getFields = ['master_field', 'foreign_table', 'foreign_field']; + $whereFields = ['master_db' => $sourceDb, 'master_table' => $sourceTable]; + $newFields = ['master_db' => $targetDb, 'foreign_db' => $targetDb, 'master_table' => $targetTable]; self::duplicateInfo('relwork', 'relation', $getFields, $whereFields, $newFields); - $getFields = [ - 'foreign_field', - 'master_table', - 'master_field', - ]; - $whereFields = [ - 'foreign_db' => $sourceDb, - 'foreign_table' => $sourceTable, - ]; - $newFields = [ - 'master_db' => $targetDb, - 'foreign_db' => $targetDb, - 'foreign_table' => $targetTable, - ]; + $getFields = ['foreign_field', 'master_table', 'master_field']; + $whereFields = ['foreign_db' => $sourceDb, 'foreign_table' => $sourceTable]; + $newFields = ['master_db' => $targetDb, 'foreign_db' => $targetDb, 'foreign_table' => $targetTable]; self::duplicateInfo('relwork', 'relation', $getFields, $whereFields, $newFields); return true; @@ -1514,10 +1483,7 @@ class Table implements Stringable ); $uniques = $this->dbi->fetchResult( $sql, - [ - 'Key_name', - null, - ], + ['Key_name', null], 'Column_name', ); @@ -2386,12 +2352,7 @@ class Table implements Stringable } } - return [ - $htmlOutput, - $previewSqlData, - $displayQuery, - $seenError, - ]; + return [$htmlOutput, $previewSqlData, $displayQuery, $seenError]; } /** diff --git a/libraries/classes/Table/ColumnsDefinition.php b/libraries/classes/Table/ColumnsDefinition.php index 543112e087..1882a11e51 100644 --- a/libraries/classes/Table/ColumnsDefinition.php +++ b/libraries/classes/Table/ColumnsDefinition.php @@ -84,10 +84,7 @@ final class ColumnsDefinition $formParams = array_merge( $formParams, - [ - 'orig_field_where' => $_POST['field_where'] ?? null, - 'orig_after_field' => $_POST['after_field'] ?? null, - ], + ['orig_field_where' => $_POST['field_where'] ?? null, 'orig_after_field' => $_POST['after_field'] ?? null], ); if (is_array($selected)) { @@ -113,10 +110,7 @@ final class ColumnsDefinition $availableMime = $this->transformations->getAvailableMimeTypes(); } - $mimeTypes = [ - 'input_transformation', - 'transformation', - ]; + $mimeTypes = ['input_transformation', 'transformation']; foreach ($mimeTypes as $mimeType) { if (! isset($availableMime[$mimeType]) || ! is_array($availableMime[$mimeType])) { continue; @@ -260,12 +254,7 @@ final class ColumnsDefinition ); } elseif (isset($fieldsMeta[$columnNumber])) { $columnMeta = $fieldsMeta[$columnNumber]; - $virtual = [ - 'VIRTUAL', - 'PERSISTENT', - 'VIRTUAL GENERATED', - 'STORED GENERATED', - ]; + $virtual = ['VIRTUAL', 'PERSISTENT', 'VIRTUAL GENERATED', 'STORED GENERATED']; if (in_array($columnMeta['Extra'], $virtual)) { $tableObj = new Table($GLOBALS['table'], $GLOBALS['db'], $this->dbi); $expressions = $tableObj->getColumnGenerationExpression($columnMeta['Field']); @@ -394,10 +383,7 @@ final class ColumnsDefinition foreach ($charsets as $charset) { $collationsList = []; foreach ($collations[$charset->getName()] as $collation) { - $collationsList[] = [ - 'name' => $collation->getName(), - 'description' => $collation->getDescription(), - ]; + $collationsList[] = ['name' => $collation->getName(), 'description' => $collation->getDescription()]; } $charsetsList[] = [ @@ -458,10 +444,7 @@ final class ColumnsDefinition */ public static function decorateColumnMetaDefault(array $columnMeta): array { - $metaDefault = [ - 'DefaultType' => 'USER_DEFINED', - 'DefaultValue' => '', - ]; + $metaDefault = ['DefaultType' => 'USER_DEFINED', 'DefaultValue' => '']; switch ($columnMeta['Default']) { case null: diff --git a/libraries/classes/Table/Indexes.php b/libraries/classes/Table/Indexes.php index 34d38f17e3..a8c5fe02d2 100644 --- a/libraries/classes/Table/Indexes.php +++ b/libraries/classes/Table/Indexes.php @@ -88,10 +88,7 @@ final class Indexes $this->response->addJSON( 'index_table', $this->template->render('indexes', [ - 'url_params' => [ - 'db' => $db, - 'table' => $table, - ], + 'url_params' => ['db' => $db, 'table' => $table], 'indexes' => $indexes, 'indexes_duplicates' => $indexesDuplicates, ]), diff --git a/libraries/classes/Table/Search.php b/libraries/classes/Table/Search.php index 0cba54d1e7..d8cbff615b 100644 --- a/libraries/classes/Table/Search.php +++ b/libraries/classes/Table/Search.php @@ -264,12 +264,7 @@ final class Search string $types, string|null $geomFunc = null, ): string { - $geomUnaryFunctions = [ - 'IsEmpty' => 1, - 'IsSimple' => 1, - 'IsRing' => 1, - 'IsClosed' => 1, - ]; + $geomUnaryFunctions = ['IsEmpty' => 1, 'IsSimple' => 1, 'IsRing' => 1, 'IsClosed' => 1]; $where = ''; // Get details about the geometry functions diff --git a/libraries/classes/Template.php b/libraries/classes/Template.php index 021afa0d3b..2fc849257c 100644 --- a/libraries/classes/Template.php +++ b/libraries/classes/Template.php @@ -64,10 +64,7 @@ class Template } $loader = new FilesystemLoader(self::TEMPLATES_FOLDER); - $twig = new Environment($loader, [ - 'auto_reload' => true, - 'cache' => $cacheDir, - ]); + $twig = new Environment($loader, ['auto_reload' => true, 'cache' => $cacheDir]); $twig->addRuntimeLoader(new ContainerRuntimeLoader(Core::getContainerBuilder())); diff --git a/libraries/classes/Theme/Theme.php b/libraries/classes/Theme/Theme.php index 22863cfac9..fa79bbd16c 100644 --- a/libraries/classes/Theme/Theme.php +++ b/libraries/classes/Theme/Theme.php @@ -100,11 +100,7 @@ class Theme } // Check that all required data are there - $members = [ - 'name', - 'version', - 'supports', - ]; + $members = ['name', 'version', 'supports']; foreach ($members as $member) { if (! isset($data[$member])) { return false; diff --git a/libraries/classes/Tracking/Tracker.php b/libraries/classes/Tracking/Tracker.php index 576f9aeb95..7792278d45 100644 --- a/libraries/classes/Tracking/Tracker.php +++ b/libraries/classes/Tracking/Tracker.php @@ -220,10 +220,7 @@ class Tracker $indexes = $GLOBALS['dbi']->getTableIndexes($dbName, $tableName); - $snapshot = [ - 'COLUMNS' => $columns, - 'INDEXES' => $indexes, - ]; + $snapshot = ['COLUMNS' => $columns, 'INDEXES' => $indexes]; $snapshot = serialize($snapshot); // Get DROP TABLE / DROP VIEW and CREATE TABLE SQL statements @@ -557,12 +554,7 @@ class Tracker // PHP 7.4 fix for accessing array offset on null if ($mixed === []) { - $mixed = [ - 'schema_sql' => null, - 'data_sql' => null, - 'tracking' => null, - 'schema_snapshot' => null, - ]; + $mixed = ['schema_sql' => null, 'data_sql' => null, 'tracking' => null, 'schema_snapshot' => null]; } // Parse log @@ -594,11 +586,7 @@ class Tracker $statement = rtrim((string) mb_strstr($logEntry, "\n")); - $ddlog[] = [ - 'date' => $date, - 'username' => $username, - 'statement' => $statement, - ]; + $ddlog[] = ['date' => $date, 'username' => $username, 'statement' => $statement]; } $dateFrom = $ddlDateFrom; @@ -629,11 +617,7 @@ class Tracker $statement = rtrim((string) mb_strstr($logEntry, "\n")); - $dmlog[] = [ - 'date' => $date, - 'username' => $username, - 'statement' => $statement, - ]; + $dmlog[] = ['date' => $date, 'username' => $username, 'statement' => $statement]; } $dmlDateTo = $date; diff --git a/libraries/classes/Tracking/Tracking.php b/libraries/classes/Tracking/Tracking.php index 57dcf44fe4..cfc0775751 100644 --- a/libraries/classes/Tracking/Tracking.php +++ b/libraries/classes/Tracking/Tracking.php @@ -277,13 +277,7 @@ class Tracking $str5 = '' . ''; - return [ - $str1, - $str2, - $str3, - $str4, - $str5, - ]; + return [$str1, $str2, $str3, $str4, $str5]; } /** @@ -320,10 +314,7 @@ class Tracking $ddlogCount = 0; $html = '
'; - $html .= Url::getHiddenInputs($urlParams + [ - 'report' => 'true', - 'version' => $version, - ]); + $html .= Url::getHiddenInputs($urlParams + ['report' => 'true', 'version' => $version]); $html .= sprintf( __('Show %1$s with dates from %2$s to %3$s by user %4$s %5$s'), @@ -394,10 +385,7 @@ class Tracking string $users, ): string { $html = ''; - $html .= Url::getHiddenInputs($urlParams + [ - 'report' => 'true', - 'version' => $version, - ]); + $html .= Url::getHiddenInputs($urlParams + ['report' => 'true', 'version' => $version]); $html .= sprintf( __('Show %1$s with dates from %2$s to %3$s by user %4$s %5$s'), @@ -509,10 +497,7 @@ class Tracking $dateTo, ); - return [ - $html, - $lineNumber, - ]; + return [$html, $lineNumber]; } /** @@ -573,10 +558,7 @@ class Tracking 'drop_image_or_text' => $dropImageOrText, ]); - return [ - $html, - $lineNumber, - ]; + return [$html, $lineNumber]; } /** @@ -613,10 +595,7 @@ class Tracking // Unserialize snapshot $temp = Core::safeUnserialize($data['schema_snapshot']); if ($temp === null) { - $temp = [ - 'COLUMNS' => [], - 'INDEXES' => [], - ]; + $temp = ['COLUMNS' => [], 'INDEXES' => []]; } $columns = $temp['COLUMNS']; diff --git a/libraries/classes/Transformations.php b/libraries/classes/Transformations.php index 00a0ed7a5c..5b8bb17dfb 100644 --- a/libraries/classes/Transformations.php +++ b/libraries/classes/Transformations.php @@ -120,11 +120,7 @@ class Transformations } $stack = []; - $subDirs = [ - 'Input/' => 'input_', - 'Output/' => '', - '' => '', - ]; + $subDirs = ['Input/' => 'input_', 'Output/' => '', '' => '']; foreach ($subDirs as $sd => $prefix) { $handle = opendir(ROOT_PATH . 'libraries/classes/Plugins/Transformations/' . $sd); @@ -245,14 +241,8 @@ class Transformations public function fixUpMime(string $value): string { $value = str_replace( - [ - 'jpeg', - 'png', - ], - [ - 'JPEG', - 'PNG', - ], + ['jpeg', 'png'], + ['JPEG', 'PNG'], $value, ); diff --git a/libraries/classes/Twig/AssetExtension.php b/libraries/classes/Twig/AssetExtension.php index f7fca147ca..2092e51bd6 100644 --- a/libraries/classes/Twig/AssetExtension.php +++ b/libraries/classes/Twig/AssetExtension.php @@ -13,9 +13,7 @@ final class AssetExtension extends AbstractExtension /** @return TwigFunction[] */ public function getFunctions(): array { - return [ - new TwigFunction('image', $this->getImagePath(...)), - ]; + return [new TwigFunction('image', $this->getImagePath(...))]; } public function getImagePath(string|null $filename = null, string|null $fallback = null): string diff --git a/libraries/classes/TwoFactor.php b/libraries/classes/TwoFactor.php index fc62468c48..5833626a7e 100644 --- a/libraries/classes/TwoFactor.php +++ b/libraries/classes/TwoFactor.php @@ -145,24 +145,15 @@ class TwoFactor { $result = []; if (! class_exists(Google2FA::class)) { - $result[] = [ - 'class' => Application::getName(), - 'dep' => 'pragmarx/google2fa-qrcode', - ]; + $result[] = ['class' => Application::getName(), 'dep' => 'pragmarx/google2fa-qrcode']; } if (! class_exists(ImageRenderer::class)) { - $result[] = [ - 'class' => Application::getName(), - 'dep' => 'bacon/bacon-qr-code', - ]; + $result[] = ['class' => Application::getName(), 'dep' => 'bacon/bacon-qr-code']; } if (! class_exists(U2FServer::class)) { - $result[] = [ - 'class' => Key::getName(), - 'dep' => 'code-lts/u2f-php-server', - ]; + $result[] = ['class' => Key::getName(), 'dep' => 'code-lts/u2f-php-server']; } return $result; @@ -291,11 +282,7 @@ class TwoFactor $backends = []; foreach ($all as $name) { $cls = $this->getBackendClass($name); - $backends[] = [ - 'id' => $cls::$id, - 'name' => $cls::getName(), - 'description' => $cls::getDescription(), - ]; + $backends[] = ['id' => $cls::$id, 'name' => $cls::getName(), 'description' => $cls::getDescription()]; } return $backends; diff --git a/libraries/classes/Types.php b/libraries/classes/Types.php index 9367c0fe1a..c0f58646ca 100644 --- a/libraries/classes/Types.php +++ b/libraries/classes/Types.php @@ -37,12 +37,7 @@ class Types */ public function getUnaryOperators(): array { - return [ - 'IS NULL', - 'IS NOT NULL', - "= ''", - "!= ''", - ]; + return ['IS NULL', 'IS NOT NULL', "= ''", "!= ''"]; } /** @@ -62,10 +57,7 @@ class Types */ public function getNullOperators(): array { - return [ - 'IS NULL', - 'IS NOT NULL', - ]; + return ['IS NULL', 'IS NOT NULL']; } /** @@ -75,10 +67,7 @@ class Types */ public function getEnumOperators(): array { - return [ - '=', - '!=', - ]; + return ['=', '!=']; } /** @@ -139,16 +128,7 @@ class Types */ public function getUUIDOperators(): array { - return [ - '=', - '!=', - 'LIKE', - 'LIKE %...%', - 'NOT LIKE', - 'NOT LIKE %...%', - 'IN (...)', - 'NOT IN (...)', - ]; + return ['=', '!=', 'LIKE', 'LIKE %...%', 'NOT LIKE', 'NOT LIKE %...%', 'IN (...)', 'NOT IN (...)']; } /** @@ -640,13 +620,7 @@ class Types { $serverVersion = $this->dbi->getVersion(); - $attributes = [ - '', - 'BINARY', - 'UNSIGNED', - 'UNSIGNED ZEROFILL', - 'on update CURRENT_TIMESTAMP', - ]; + $attributes = ['', 'BINARY', 'UNSIGNED', 'UNSIGNED ZEROFILL', 'on update CURRENT_TIMESTAMP']; if (Compatibility::supportsCompressedColumns($serverVersion)) { $attributes[] = 'COMPRESSED=zlib'; @@ -670,12 +644,7 @@ class Types $isUUIDSupported = Compatibility::isUUIDSupported($this->dbi); // most used types - $ret = [ - 'INT', - 'VARCHAR', - 'TEXT', - 'DATE', - ]; + $ret = ['INT', 'VARCHAR', 'TEXT', 'DATE']; if ($isUUIDSupported) { $ret[] = 'UUID'; @@ -700,13 +669,7 @@ class Types ]; // Date/Time - $ret[_pgettext('date and time types', 'Date and time')] = [ - 'DATE', - 'DATETIME', - 'TIMESTAMP', - 'TIME', - 'YEAR', - ]; + $ret[_pgettext('date and time types', 'Date and time')] = ['DATE', 'DATETIME', 'TIMESTAMP', 'TIME', 'YEAR']; // Text $stringTypes = [ @@ -765,13 +728,7 @@ class Types */ public function getIntegerTypes(): array { - return [ - 'tinyint', - 'smallint', - 'mediumint', - 'int', - 'bigint', - ]; + return ['tinyint', 'smallint', 'mediumint', 'int', 'bigint']; } /** @@ -781,12 +738,7 @@ class Types */ public function getFloatTypes(): array { - return [ - 'decimal', - 'float', - 'double', - 'real', - ]; + return ['decimal', 'float', 'double', 'real']; } /** @@ -801,57 +753,24 @@ class Types { $minMaxData = [ 'unsigned' => [ - 'tinyint' => [ - '0', - '255', - ], - 'smallint' => [ - '0', - '65535', - ], - 'mediumint' => [ - '0', - '16777215', - ], - 'int' => [ - '0', - '4294967295', - ], - 'bigint' => [ - '0', - '18446744073709551615', - ], + 'tinyint' => ['0', '255'], + 'smallint' => ['0', '65535'], + 'mediumint' => ['0', '16777215'], + 'int' => ['0', '4294967295'], + 'bigint' => ['0', '18446744073709551615'], ], 'signed' => [ - 'tinyint' => [ - '-128', - '127', - ], - 'smallint' => [ - '-32768', - '32767', - ], - 'mediumint' => [ - '-8388608', - '8388607', - ], - 'int' => [ - '-2147483648', - '2147483647', - ], - 'bigint' => [ - '-9223372036854775808', - '9223372036854775807', - ], + 'tinyint' => ['-128', '127'], + 'smallint' => ['-32768', '32767'], + 'mediumint' => ['-8388608', '8388607'], + 'int' => ['-2147483648', '2147483647'], + 'bigint' => ['-9223372036854775808', '9223372036854775807'], ], ]; $relevantArray = $signed ? $minMaxData['signed'] : $minMaxData['unsigned']; - return $relevantArray[$type] ?? [ - '', - '', - ]; + return $relevantArray[$type] ?? ['', '']; } } diff --git a/libraries/classes/UserPassword.php b/libraries/classes/UserPassword.php index 7130f797b6..43f34992ad 100644 --- a/libraries/classes/UserPassword.php +++ b/libraries/classes/UserPassword.php @@ -49,10 +49,7 @@ class UserPassword } } - return [ - 'error' => $error, - 'msg' => $message, - ]; + return ['error' => $error, 'msg' => $message]; } /** diff --git a/libraries/classes/UserPreferences.php b/libraries/classes/UserPreferences.php index ed8f921037..224fd6bd08 100644 --- a/libraries/classes/UserPreferences.php +++ b/libraries/classes/UserPreferences.php @@ -51,10 +51,7 @@ class UserPreferences $cf->resetConfigData(); // start with a clean instance $cf->setAllowedKeys($formsAllKeys); $cf->setCfgUpdateReadMapping( - [ - 'Server/hide_db' => 'Servers/1/hide_db', - 'Server/only_db' => 'Servers/1/only_db', - ], + ['Server/hide_db' => 'Servers/1/hide_db', 'Server/only_db' => 'Servers/1/only_db'], ); $cf->updateWithGlobalConfig($GLOBALS['cfg']); } @@ -127,10 +124,7 @@ class UserPreferences || $relationParameters->db === null ) { // no pmadb table, use session storage - $_SESSION['userconfig'] = [ - 'db' => $configArray, - 'ts' => time(), - ]; + $_SESSION['userconfig'] = ['db' => $configArray, 'ts' => time()]; if (isset($_SESSION['cache'][$cacheKey]['userprefs'])) { unset($_SESSION['cache'][$cacheKey]['userprefs']); } diff --git a/libraries/classes/Util.php b/libraries/classes/Util.php index 758ebafb3b..14192574ba 100644 --- a/libraries/classes/Util.php +++ b/libraries/classes/Util.php @@ -336,10 +336,7 @@ class Util $returnValue = self::formatNumber($value, 0); } - return [ - trim($returnValue), - $unit, - ]; + return [trim($returnValue), $unit]; } /** @@ -820,11 +817,7 @@ class Util $whereClause = trim((string) preg_replace('|\s?AND$|', '', $preferredCondition)); - return [ - $whereClause, - $clauseIsUnique, - $conditionArray, - ]; + return [$whereClause, $clauseIsUnique, $conditionArray]; } /** @@ -1886,12 +1879,7 @@ class Util $indexesData[$row['Key_name']][$row['Seq_in_index']]['Sub_part'] = $row['Sub_part']; } - return [ - $primary, - $pkArray, - $indexesInfo, - $indexesData, - ]; + return [$primary, $pkArray, $indexesInfo, $indexesData]; } /** @@ -2256,18 +2244,12 @@ class Util $orderImg = ' ' . Generator::getImage( 's_asc', __('Ascending'), - [ - 'class' => 'sort_arrow', - 'title' => '', - ], + ['class' => 'sort_arrow', 'title' => ''], ); $orderImg .= ' ' . Generator::getImage( 's_desc', __('Descending'), - [ - 'class' => 'sort_arrow hide', - 'title' => '', - ], + ['class' => 'sort_arrow hide', 'title' => ''], ); // but on mouse over, show the reverse order (DESC) $orderLinkParams['onmouseover'] = "$('.sort_arrow').toggle();"; @@ -2279,18 +2261,12 @@ class Util $orderImg = ' ' . Generator::getImage( 's_asc', __('Ascending'), - [ - 'class' => 'sort_arrow hide', - 'title' => '', - ], + ['class' => 'sort_arrow hide', 'title' => ''], ); $orderImg .= ' ' . Generator::getImage( 's_desc', __('Descending'), - [ - 'class' => 'sort_arrow', - 'title' => '', - ], + ['class' => 'sort_arrow', 'title' => ''], ); // but on mouse over, show the reverse order (ASC) $orderLinkParams['onmouseover'] = "$('.sort_arrow').toggle();"; @@ -2347,10 +2323,7 @@ class Util continue; } - [ - $keyName, - $value, - ] = $keyValueArray; + [$keyName, $value] = $keyValueArray; $value = trim(strtolower($value)); if (strtolower(trim($keyName)) === 'proto' && in_array($value, ['http', 'https'])) { return $value; diff --git a/libraries/classes/Utils/Gis.php b/libraries/classes/Utils/Gis.php index b6030bcad8..b654d7e14d 100644 --- a/libraries/classes/Utils/Gis.php +++ b/libraries/classes/Utils/Gis.php @@ -134,30 +134,12 @@ final class Gis } // Unary functions common to all geometry types - $funcs['Dimension'] = [ - 'params' => 1, - 'type' => 'int', - ]; - $funcs['Envelope'] = [ - 'params' => 1, - 'type' => 'Polygon', - ]; - $funcs['GeometryType'] = [ - 'params' => 1, - 'type' => 'text', - ]; - $funcs['SRID'] = [ - 'params' => 1, - 'type' => 'int', - ]; - $funcs['IsEmpty'] = [ - 'params' => 1, - 'type' => 'int', - ]; - $funcs['IsSimple'] = [ - 'params' => 1, - 'type' => 'int', - ]; + $funcs['Dimension'] = ['params' => 1, 'type' => 'int']; + $funcs['Envelope'] = ['params' => 1, 'type' => 'Polygon']; + $funcs['GeometryType'] = ['params' => 1, 'type' => 'text']; + $funcs['SRID'] = ['params' => 1, 'type' => 'int']; + $funcs['IsEmpty'] = ['params' => 1, 'type' => 'int']; + $funcs['IsSimple'] = ['params' => 1, 'type' => 'int']; $geomType = mb_strtolower(trim((string) $geomType)); if ($display && $geomType !== 'geometry' && $geomType !== 'multipoint') { @@ -173,73 +155,28 @@ final class Gis // Unary functions that are specific to each geometry type if ($geomType === 'point') { - $funcs[$spatialPrefix . 'X'] = [ - 'params' => 1, - 'type' => 'float', - ]; - $funcs[$spatialPrefix . 'Y'] = [ - 'params' => 1, - 'type' => 'float', - ]; + $funcs[$spatialPrefix . 'X'] = ['params' => 1, 'type' => 'float']; + $funcs[$spatialPrefix . 'Y'] = ['params' => 1, 'type' => 'float']; } elseif ($geomType === 'linestring') { - $funcs['EndPoint'] = [ - 'params' => 1, - 'type' => 'point', - ]; - $funcs['GLength'] = [ - 'params' => 1, - 'type' => 'float', - ]; - $funcs['NumPoints'] = [ - 'params' => 1, - 'type' => 'int', - ]; - $funcs['StartPoint'] = [ - 'params' => 1, - 'type' => 'point', - ]; - $funcs['IsRing'] = [ - 'params' => 1, - 'type' => 'int', - ]; + $funcs['EndPoint'] = ['params' => 1, 'type' => 'point']; + $funcs['GLength'] = ['params' => 1, 'type' => 'float']; + $funcs['NumPoints'] = ['params' => 1, 'type' => 'int']; + $funcs['StartPoint'] = ['params' => 1, 'type' => 'point']; + $funcs['IsRing'] = ['params' => 1, 'type' => 'int']; } elseif ($geomType === 'multilinestring') { - $funcs['GLength'] = [ - 'params' => 1, - 'type' => 'float', - ]; - $funcs['IsClosed'] = [ - 'params' => 1, - 'type' => 'int', - ]; + $funcs['GLength'] = ['params' => 1, 'type' => 'float']; + $funcs['IsClosed'] = ['params' => 1, 'type' => 'int']; } elseif ($geomType === 'polygon') { - $funcs['Area'] = [ - 'params' => 1, - 'type' => 'float', - ]; - $funcs['ExteriorRing'] = [ - 'params' => 1, - 'type' => 'linestring', - ]; - $funcs['NumInteriorRings'] = [ - 'params' => 1, - 'type' => 'int', - ]; + $funcs['Area'] = ['params' => 1, 'type' => 'float']; + $funcs['ExteriorRing'] = ['params' => 1, 'type' => 'linestring']; + $funcs['NumInteriorRings'] = ['params' => 1, 'type' => 'int']; } elseif ($geomType === 'multipolygon') { - $funcs['Area'] = [ - 'params' => 1, - 'type' => 'float', - ]; - $funcs['Centroid'] = [ - 'params' => 1, - 'type' => 'point', - ]; + $funcs['Area'] = ['params' => 1, 'type' => 'float']; + $funcs['Centroid'] = ['params' => 1, 'type' => 'point']; // Not yet implemented in MySQL //$funcs['PointOnSurface'] = array('params' => 1, 'type' => 'point'); } elseif ($geomType === 'geometrycollection') { - $funcs['NumGeometries'] = [ - 'params' => 1, - 'type' => 'int', - ]; + $funcs['NumGeometries'] = ['params' => 1, 'type' => 'int']; } // If we are asked for binary functions as well @@ -249,72 +186,27 @@ final class Gis $funcs[] = ['display' => '--------']; } - $funcs[$spatialPrefix . 'Crosses'] = [ - 'params' => 2, - 'type' => 'int', - ]; - $funcs[$spatialPrefix . 'Contains'] = [ - 'params' => 2, - 'type' => 'int', - ]; - $funcs[$spatialPrefix . 'Disjoint'] = [ - 'params' => 2, - 'type' => 'int', - ]; - $funcs[$spatialPrefix . 'Equals'] = [ - 'params' => 2, - 'type' => 'int', - ]; - $funcs[$spatialPrefix . 'Intersects'] = [ - 'params' => 2, - 'type' => 'int', - ]; - $funcs[$spatialPrefix . 'Overlaps'] = [ - 'params' => 2, - 'type' => 'int', - ]; - $funcs[$spatialPrefix . 'Touches'] = [ - 'params' => 2, - 'type' => 'int', - ]; - $funcs[$spatialPrefix . 'Within'] = [ - 'params' => 2, - 'type' => 'int', - ]; + $funcs[$spatialPrefix . 'Crosses'] = ['params' => 2, 'type' => 'int']; + $funcs[$spatialPrefix . 'Contains'] = ['params' => 2, 'type' => 'int']; + $funcs[$spatialPrefix . 'Disjoint'] = ['params' => 2, 'type' => 'int']; + $funcs[$spatialPrefix . 'Equals'] = ['params' => 2, 'type' => 'int']; + $funcs[$spatialPrefix . 'Intersects'] = ['params' => 2, 'type' => 'int']; + $funcs[$spatialPrefix . 'Overlaps'] = ['params' => 2, 'type' => 'int']; + $funcs[$spatialPrefix . 'Touches'] = ['params' => 2, 'type' => 'int']; + $funcs[$spatialPrefix . 'Within'] = ['params' => 2, 'type' => 'int']; if ($display) { $funcs[] = ['display' => '--------']; } // Minimum bounding rectangle functions - $funcs['MBRContains'] = [ - 'params' => 2, - 'type' => 'int', - ]; - $funcs['MBRDisjoint'] = [ - 'params' => 2, - 'type' => 'int', - ]; - $funcs['MBREquals'] = [ - 'params' => 2, - 'type' => 'int', - ]; - $funcs['MBRIntersects'] = [ - 'params' => 2, - 'type' => 'int', - ]; - $funcs['MBROverlaps'] = [ - 'params' => 2, - 'type' => 'int', - ]; - $funcs['MBRTouches'] = [ - 'params' => 2, - 'type' => 'int', - ]; - $funcs['MBRWithin'] = [ - 'params' => 2, - 'type' => 'int', - ]; + $funcs['MBRContains'] = ['params' => 2, 'type' => 'int']; + $funcs['MBRDisjoint'] = ['params' => 2, 'type' => 'int']; + $funcs['MBREquals'] = ['params' => 2, 'type' => 'int']; + $funcs['MBRIntersects'] = ['params' => 2, 'type' => 'int']; + $funcs['MBROverlaps'] = ['params' => 2, 'type' => 'int']; + $funcs['MBRTouches'] = ['params' => 2, 'type' => 'int']; + $funcs['MBRWithin'] = ['params' => 2, 'type' => 'int']; } return $funcs; diff --git a/libraries/classes/Utils/HttpRequest.php b/libraries/classes/Utils/HttpRequest.php index 4107046f6c..3379a3c211 100644 --- a/libraries/classes/Utils/HttpRequest.php +++ b/libraries/classes/Utils/HttpRequest.php @@ -85,10 +85,7 @@ class HttpRequest private function handleContext(array $context): array { if (strlen($this->proxyUrl) > 0) { - $context['http'] = [ - 'proxy' => $this->proxyUrl, - 'request_fulluri' => true, - ]; + $context['http'] = ['proxy' => $this->proxyUrl, 'request_fulluri' => true]; if (strlen($this->proxyUser) > 0) { $auth = base64_encode($this->proxyUser . ':' . $this->proxyPass); $context['http']['header'] = 'Proxy-Authorization: Basic ' @@ -227,10 +224,7 @@ class HttpRequest 'user_agent' => 'phpMyAdmin', 'header' => 'Accept: */*', ], - 'ssl' => [ - 'verify_peer' => true, - 'verify_peer_name' => true, - ], + 'ssl' => ['verify_peer' => true, 'verify_peer_name' => true], ]; if ($header) { $context['http']['header'] .= "\n" . $header; diff --git a/libraries/classes/VersionInformation.php b/libraries/classes/VersionInformation.php index 85c4505279..2eafc36e94 100644 --- a/libraries/classes/VersionInformation.php +++ b/libraries/classes/VersionInformation.php @@ -67,10 +67,7 @@ class VersionInformation } if ($save) { - $_SESSION['cache']['version_check'] = [ - 'response' => $response, - 'timestamp' => time(), - ]; + $_SESSION['cache']['version_check'] = ['response' => $response, 'timestamp' => time()]; } return $data; @@ -182,10 +179,7 @@ class VersionInformation continue; } - $latestRelease = [ - 'version' => $release->version, - 'date' => $release->date, - ]; + $latestRelease = ['version' => $release->version, 'date' => $release->date]; } // no compatible version @@ -204,15 +198,7 @@ class VersionInformation { $operator = null; $version = null; - $operators = [ - '<=', - '>=', - '!=', - '<>', - '<', - '>', - '=', - ]; // preserve order + $operators = ['<=', '>=', '!=', '<>', '<', '>', '=']; // preserve order foreach ($operators as $oneOperator) { if (strpos($condition, $oneOperator) === 0) { $operator = $oneOperator; diff --git a/libraries/classes/WebAuthn/CustomServer.php b/libraries/classes/WebAuthn/CustomServer.php index c73edf9d6a..29863fcab8 100644 --- a/libraries/classes/WebAuthn/CustomServer.php +++ b/libraries/classes/WebAuthn/CustomServer.php @@ -435,10 +435,7 @@ final class CustomServer implements Server 'id' => $credential['id'], 'rawId' => $rawId, 'type' => 'public-key', - 'response' => [ - 'clientDataJSON' => $clientDataJSON, - 'attestationObject' => $attestationObject, - ], + 'response' => ['clientDataJSON' => $clientDataJSON, 'attestationObject' => $attestationObject], ]; } diff --git a/libraries/classes/ZipExtension.php b/libraries/classes/ZipExtension.php index d7e7cd2408..ba82ef0989 100644 --- a/libraries/classes/ZipExtension.php +++ b/libraries/classes/ZipExtension.php @@ -69,20 +69,14 @@ class ZipExtension $errorMessage = __('Error in ZIP archive:') . ' ' . $this->zip->getStatusString(); $this->zip->close(); - return [ - 'error' => $errorMessage, - 'data' => $fileData, - ]; + return ['error' => $errorMessage, 'data' => $fileData]; } if ($this->zip->numFiles === 0) { $errorMessage = __('No files found inside ZIP archive!'); $this->zip->close(); - return [ - 'error' => $errorMessage, - 'data' => $fileData, - ]; + return ['error' => $errorMessage, 'data' => $fileData]; } /* Is the the zip really an ODS file? */ @@ -96,10 +90,7 @@ class ZipExtension $fileData = $firstZipEntry; $this->zip->close(); - return [ - 'error' => $errorMessage, - 'data' => $fileData, - ]; + return ['error' => $errorMessage, 'data' => $fileData]; } /* Return the correct contents, not just the first entry */ @@ -118,10 +109,7 @@ class ZipExtension $this->zip->close(); - return [ - 'error' => $errorMessage, - 'data' => $fileData, - ]; + return ['error' => $errorMessage, 'data' => $fileData]; } /** diff --git a/libraries/services.php b/libraries/services.php index 9271491c16..34bd175d61 100644 --- a/libraries/services.php +++ b/libraries/services.php @@ -10,108 +10,49 @@ return [ 'services' => [ 'advisor' => [ 'class' => PhpMyAdmin\Advisory\Advisor::class, - 'arguments' => [ - '$dbi' => '@dbi', - '$expression' => '@expression_language', - ], + 'arguments' => ['$dbi' => '@dbi', '$expression' => '@expression_language'], ], 'browse_foreigners' => [ 'class' => PhpMyAdmin\BrowseForeigners::class, 'arguments' => ['@template', '@config'], ], - 'config' => [ - 'class' => PhpMyAdmin\Config::class, - ], - 'central_columns' => [ - 'class' => PhpMyAdmin\Database\CentralColumns::class, - 'arguments' => ['@dbi'], - ], - 'check_user_privileges' => [ - 'class' => PhpMyAdmin\CheckUserPrivileges::class, - 'arguments' => ['@dbi'], - ], - 'create_add_field' => [ - 'class' => PhpMyAdmin\CreateAddField::class, - 'arguments' => ['@dbi'], - ], + 'config' => ['class' => PhpMyAdmin\Config::class], + 'central_columns' => ['class' => PhpMyAdmin\Database\CentralColumns::class, 'arguments' => ['@dbi']], + 'check_user_privileges' => ['class' => PhpMyAdmin\CheckUserPrivileges::class, 'arguments' => ['@dbi']], + 'create_add_field' => ['class' => PhpMyAdmin\CreateAddField::class, 'arguments' => ['@dbi']], 'designer' => [ 'class' => PhpMyAdmin\Database\Designer::class, - 'arguments' => [ - '$dbi' => '@dbi', - '$relation' => '@relation', - '$template' => '@template', - ], + 'arguments' => ['$dbi' => '@dbi', '$relation' => '@relation', '$template' => '@template'], ], 'designer_common' => [ 'class' => PhpMyAdmin\Database\Designer\Common::class, - 'arguments' => [ - '$dbi' => '@dbi', - '$relation' => '@relation', - ], - ], - 'error_handler' => [ - 'class' => PhpMyAdmin\ErrorHandler::class, + 'arguments' => ['$dbi' => '@dbi', '$relation' => '@relation'], ], + 'error_handler' => ['class' => PhpMyAdmin\ErrorHandler::class], 'error_report' => [ 'class' => PhpMyAdmin\ErrorReport::class, - 'arguments' => [ - '@http_request', - '@relation', - '@template', - '@config', - ], - ], - 'events' => [ - 'class' => PhpMyAdmin\Database\Events::class, - 'arguments' => [ - '@dbi', - '@template', - '@response', - ], - ], - 'export' => [ - 'class' => PhpMyAdmin\Export::class, - 'arguments' => ['@dbi'], + 'arguments' => ['@http_request', '@relation', '@template', '@config'], ], + 'events' => ['class' => PhpMyAdmin\Database\Events::class, 'arguments' => ['@dbi','@template','@response']], + 'export' => ['class' => PhpMyAdmin\Export::class, 'arguments' => ['@dbi']], 'export_options' => [ 'class' => PhpMyAdmin\Export\Options::class, - 'arguments' => [ - '@relation', - '@export_template_model', - ], - ], - 'export_template_model' => [ - 'class' => PhpMyAdmin\Export\TemplateModel::class, - 'arguments' => ['@dbi'], - ], - 'expression_language' => [ - 'class' => Symfony\Component\ExpressionLanguage\ExpressionLanguage::class, + 'arguments' => ['@relation', '@export_template_model'], ], + 'export_template_model' => ['class' => PhpMyAdmin\Export\TemplateModel::class, 'arguments' => ['@dbi']], + 'expression_language' => ['class' => Symfony\Component\ExpressionLanguage\ExpressionLanguage::class], 'file_listing' => ['class' => PhpMyAdmin\FileListing::class], - 'flash' => [ - 'class' => PhpMyAdmin\FlashMessages::class, - ], - 'http_request' => [ - 'class' => PhpMyAdmin\Utils\HttpRequest::class, - ], - 'import' => [ - 'class' => PhpMyAdmin\Import::class, - ], - 'import_simulate_dml' => [ - 'class' => PhpMyAdmin\Import\SimulateDml::class, - 'arguments' => ['@dbi'], - ], + 'flash' => ['class' => PhpMyAdmin\FlashMessages::class], + 'http_request' => ['class' => PhpMyAdmin\Utils\HttpRequest::class], + 'import' => ['class' => PhpMyAdmin\Import::class], + 'import_simulate_dml' => ['class' => PhpMyAdmin\Import\SimulateDml::class, 'arguments' => ['@dbi']], 'insert_edit' => [ 'class' => PhpMyAdmin\InsertEdit::class, 'arguments' => ['@dbi', '@relation', '@transformations', '@file_listing', '@template'], ], 'navigation' => [ 'class' => PhpMyAdmin\Navigation\Navigation::class, - 'arguments' => [ - '@template', - '@relation', - '@dbi', - ], + 'arguments' => ['@template', '@relation', '@dbi'], ], 'normalization' => [ 'class' => PhpMyAdmin\Normalization::class, @@ -124,39 +65,19 @@ return [ ], 'operations' => [ 'class' => PhpMyAdmin\Operations::class, - 'arguments' => [ - '$dbi' => '@dbi', - '$relation' => '@relation', - ], + 'arguments' => ['$dbi' => '@dbi', '$relation' => '@relation'], ], 'partitioning_maintenance' => [ 'class' => PhpMyAdmin\Partitioning\Maintenance::class, 'arguments' => ['$dbi' => '@dbi'], ], - AuthenticationPluginFactory::class => [ - 'class' => AuthenticationPluginFactory::class, - ], - 'relation' => [ - 'class' => Relation::class, - 'arguments' => ['$dbi' => '@dbi'], - ], - 'relation_cleanup' => [ - 'class' => RelationCleanup::class, - 'arguments' => [ - '@dbi', - '@relation', - ], - ], - 'replication' => [ - 'class' => PhpMyAdmin\Replication\Replication::class, - 'arguments' => ['$dbi' => '@dbi'], - ], + AuthenticationPluginFactory::class => ['class' => AuthenticationPluginFactory::class], + 'relation' => ['class' => Relation::class, 'arguments' => ['$dbi' => '@dbi']], + 'relation_cleanup' => ['class' => RelationCleanup::class, 'arguments' => ['@dbi', '@relation']], + 'replication' => ['class' => PhpMyAdmin\Replication\Replication::class, 'arguments' => ['$dbi' => '@dbi']], 'replication_gui' => [ 'class' => PhpMyAdmin\Replication\ReplicationGui::class, - 'arguments' => [ - '$replication' => '@replication', - '$template' => '@template', - ], + 'arguments' => ['$replication' => '@replication', '$template' => '@template'], ], 'response' => [ 'class' => PhpMyAdmin\ResponseRenderer::class, @@ -164,25 +85,12 @@ return [ ], 'routines' => [ 'class' => PhpMyAdmin\Database\Routines::class, - 'arguments' => [ - '@dbi', - '@template', - '@response', - ], - ], - 'server_plugins' => [ - 'class' => PhpMyAdmin\Server\Plugins::class, - 'arguments' => ['@dbi'], + 'arguments' => ['@dbi', '@template', '@response'], ], + 'server_plugins' => ['class' => PhpMyAdmin\Server\Plugins::class, 'arguments' => ['@dbi']], 'server_privileges' => [ 'class' => PhpMyAdmin\Server\Privileges::class, - 'arguments' => [ - '@template', - '@dbi', - '@relation', - '@relation_cleanup', - '@server_plugins', - ], + 'arguments' => ['@template', '@dbi', '@relation', '@relation_cleanup', '@server_plugins'], ], 'server_privileges_account_locking' => [ 'class' => PhpMyAdmin\Server\Privileges\AccountLocking::class, @@ -190,31 +98,15 @@ return [ ], 'sql' => [ 'class' => PhpMyAdmin\Sql::class, - 'arguments' => [ - '@dbi', - '@relation', - '@relation_cleanup', - '@operations', - '@transformations', - '@template', - ], + 'arguments' => ['@dbi', '@relation', '@relation_cleanup', '@operations', '@transformations', '@template'], ], 'sql_query_form' => [ 'class' => PhpMyAdmin\SqlQueryForm::class, 'arguments' => ['$template' => '@template', '$dbi' => '@dbi'], ], - 'status_data' => [ - 'class' => PhpMyAdmin\Server\Status\Data::class, - 'arguments' => ['@dbi', '@config'], - ], - 'status_monitor' => [ - 'class' => PhpMyAdmin\Server\Status\Monitor::class, - 'arguments' => ['@dbi'], - ], - 'status_processes' => [ - 'class' => PhpMyAdmin\Server\Status\Processes::class, - 'arguments' => ['@dbi'], - ], + 'status_data' => ['class' => PhpMyAdmin\Server\Status\Data::class, 'arguments' => ['@dbi','@config']], + 'status_monitor' => ['class' => PhpMyAdmin\Server\Status\Monitor::class, 'arguments' => ['@dbi']], + 'status_processes' => ['class' => PhpMyAdmin\Server\Status\Processes::class, 'arguments' => ['@dbi']], 'table_columns_definition' => [ 'class' => PhpMyAdmin\Table\ColumnsDefinition::class, 'arguments' => ['$dbi' => '@dbi', '$relation' => '@relation', '$transformations' => '@transformations'], @@ -223,18 +115,9 @@ return [ 'class' => PhpMyAdmin\Table\Indexes::class, 'arguments' => ['$response' => '@response', '$template' => '@template', '$dbi' => '@dbi'], ], - 'table_maintenance' => [ - 'class' => PhpMyAdmin\Table\Maintenance::class, - 'arguments' => ['$dbi' => '@dbi'], - ], - 'table_search' => [ - 'class' => PhpMyAdmin\Table\Search::class, - 'arguments' => ['$dbi' => '@dbi'], - ], - 'template' => [ - 'class' => PhpMyAdmin\Template::class, - 'arguments' => ['$config' => '@config'], - ], + 'table_maintenance' => ['class' => PhpMyAdmin\Table\Maintenance::class, 'arguments' => ['$dbi' => '@dbi']], + 'table_search' => ['class' => PhpMyAdmin\Table\Search::class, 'arguments' => ['$dbi' => '@dbi']], + 'template' => ['class' => PhpMyAdmin\Template::class, 'arguments' => ['$config' => '@config']], 'tracking' => [ 'class' => PhpMyAdmin\Tracking\Tracking::class, 'arguments' => [ @@ -247,37 +130,19 @@ return [ ], 'tracking_checker' => [ 'class' => PhpMyAdmin\Tracking\TrackingChecker::class, - 'arguments' => [ - '$dbi' => '@dbi', - '$relation' => '@relation', - ], - ], - 'transformations' => [ - 'class' => PhpMyAdmin\Transformations::class, + 'arguments' => ['$dbi' => '@dbi', '$relation' => '@relation'], ], + 'transformations' => ['class' => PhpMyAdmin\Transformations::class], 'triggers' => [ 'class' => PhpMyAdmin\Database\Triggers::class, - 'arguments' => [ - '@dbi', - '@template', - '@response', - ], + 'arguments' => ['@dbi', '@template', '@response'], ], 'user_password' => [ 'class' => PhpMyAdmin\UserPassword::class, - 'arguments' => [ - '@server_privileges', - '@' . AuthenticationPluginFactory::class, - '@dbi', - ], - ], - 'user_preferences' => [ - 'class' => PhpMyAdmin\UserPreferences::class, - 'arguments' => ['@dbi'], - ], - 'version_information' => [ - 'class' => PhpMyAdmin\VersionInformation::class, + 'arguments' => ['@server_privileges', '@' . AuthenticationPluginFactory::class, '@dbi'], ], + 'user_preferences' => ['class' => PhpMyAdmin\UserPreferences::class, 'arguments' => ['@dbi']], + 'version_information' => ['class' => PhpMyAdmin\VersionInformation::class], PhpMyAdmin\DatabaseInterface::class => 'dbi', PhpMyAdmin\FlashMessages::class => 'flash', PhpMyAdmin\ResponseRenderer::class => 'response', diff --git a/libraries/services_controllers.php b/libraries/services_controllers.php index d241e04f89..f08bdf58c5 100644 --- a/libraries/services_controllers.php +++ b/libraries/services_controllers.php @@ -52,50 +52,27 @@ return [ ], ChangeLogController::class => [ 'class' => ChangeLogController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template'], ], CheckRelationsController::class => [ 'class' => CheckRelationsController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - '$relation' => '@relation', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template', '$relation' => '@relation'], ], CollationConnectionController::class => [ 'class' => CollationConnectionController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - '$config' => '@config', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template', '$config' => '@config'], ], ColumnController::class => [ 'class' => ColumnController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - '$dbi' => '@dbi', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template', '$dbi' => '@dbi'], ], Config\GetConfigController::class => [ 'class' => Config\GetConfigController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - '$config' => '@config', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template', '$config' => '@config'], ], Config\SetConfigController::class => [ 'class' => Config\SetConfigController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - '$config' => '@config', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template', '$config' => '@config'], ], Console\Bookmark\AddController::class => [ 'class' => Console\Bookmark\AddController::class, @@ -160,34 +137,19 @@ return [ ], Database\ImportController::class => [ 'class' => Database\ImportController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - '$dbi' => '@dbi', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template', '$dbi' => '@dbi'], ], Database\MultiTableQuery\QueryController::class => [ 'class' => Database\MultiTableQuery\QueryController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template'], ], Database\MultiTableQuery\TablesController::class => [ 'class' => Database\MultiTableQuery\TablesController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - '$dbi' => '@dbi', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template', '$dbi' => '@dbi'], ], Database\MultiTableQueryController::class => [ 'class' => Database\MultiTableQueryController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - '$dbi' => '@dbi', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template', '$dbi' => '@dbi'], ], Database\Operations\CollationController::class => [ 'class' => Database\Operations\CollationController::class, @@ -240,19 +202,11 @@ return [ ], Database\SearchController::class => [ 'class' => Database\SearchController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - '$dbi' => '@dbi', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template', '$dbi' => '@dbi'], ], Database\SqlAutoCompleteController::class => [ 'class' => Database\SqlAutoCompleteController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - '$dbi' => '@dbi', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template', '$dbi' => '@dbi'], ], Database\SqlController::class => [ 'class' => Database\SqlController::class, @@ -264,17 +218,11 @@ return [ ], Database\SqlFormatController::class => [ 'class' => Database\SqlFormatController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template'], ], Database\Structure\AddPrefixController::class => [ 'class' => Database\Structure\AddPrefixController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template'], ], Database\Structure\AddPrefixTableController::class => [ 'class' => Database\Structure\AddPrefixTableController::class, @@ -314,17 +262,11 @@ return [ ], Database\Structure\ChangePrefixFormController::class => [ 'class' => Database\Structure\ChangePrefixFormController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template'], ], Database\Structure\CopyFormController::class => [ 'class' => Database\Structure\CopyFormController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template'], ], Database\Structure\CopyTableController::class => [ 'class' => Database\Structure\CopyTableController::class, @@ -345,11 +287,7 @@ return [ ], Database\Structure\DropFormController::class => [ 'class' => Database\Structure\DropFormController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - '$dbi' => '@dbi', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template', '$dbi' => '@dbi'], ], Database\Structure\DropTableController::class => [ 'class' => Database\Structure\DropTableController::class, @@ -363,10 +301,7 @@ return [ ], Database\Structure\EmptyFormController::class => [ 'class' => Database\Structure\EmptyFormController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template'], ], Database\Structure\EmptyTableController::class => [ 'class' => Database\Structure\EmptyTableController::class, @@ -383,19 +318,11 @@ return [ ], Database\Structure\FavoriteTableController::class => [ 'class' => Database\Structure\FavoriteTableController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - '$relation' => '@relation', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template', '$relation' => '@relation'], ], Database\Structure\RealRowCountController::class => [ 'class' => Database\Structure\RealRowCountController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - '$dbi' => '@dbi', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template', '$dbi' => '@dbi'], ], Database\Structure\ReplacePrefixController::class => [ 'class' => Database\Structure\ReplacePrefixController::class, @@ -408,11 +335,7 @@ return [ ], Database\Structure\ShowCreateController::class => [ 'class' => Database\Structure\ShowCreateController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - '$dbi' => '@dbi', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template', '$dbi' => '@dbi'], ], Database\StructureController::class => [ 'class' => Database\StructureController::class, @@ -445,10 +368,7 @@ return [ ], DatabaseController::class => [ 'class' => DatabaseController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template'], ], ErrorReportController::class => [ 'class' => ErrorReportController::class, @@ -462,18 +382,11 @@ return [ ], Export\CheckTimeOutController::class => [ 'class' => Export\CheckTimeOutController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template'], ], Export\ExportController::class => [ 'class' => Export\ExportController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - '$export' => '@export', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template', '$export' => '@export'], ], Export\TablesController::class => [ 'class' => Export\TablesController::class, @@ -521,18 +434,11 @@ return [ ], GisDataEditorController::class => [ 'class' => GisDataEditorController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template'], ], GitInfoController::class => [ 'class' => GitInfoController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - '$config' => '@config', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template', '$config' => '@config'], ], HomeController::class => [ 'class' => HomeController::class, @@ -566,22 +472,14 @@ return [ 'class' => Import\StatusController::class, 'arguments' => ['$template' => '@template'], ], - JavaScriptMessagesController::class => [ - 'class' => JavaScriptMessagesController::class, - ], + JavaScriptMessagesController::class => ['class' => JavaScriptMessagesController::class], LicenseController::class => [ 'class' => LicenseController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template'], ], LintController::class => [ 'class' => LintController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template'], ], LogoutController::class => [ 'class' => LogoutController::class, @@ -722,17 +620,11 @@ return [ ], PhpInfoController::class => [ 'class' => PhpInfoController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template'], ], RecentTablesListController::class => [ 'class' => RecentTablesListController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template'], ], Preferences\ExportController::class => [ 'class' => Preferences\ExportController::class, @@ -806,11 +698,7 @@ return [ ], Preferences\TwoFactorController::class => [ 'class' => Preferences\TwoFactorController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - '$relation' => '@relation', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template', '$relation' => '@relation'], ], SchemaExportController::class => [ 'class' => SchemaExportController::class, @@ -818,27 +706,15 @@ return [ ], Server\BinlogController::class => [ 'class' => Server\BinlogController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - '$dbi' => '@dbi', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template', '$dbi' => '@dbi'], ], Server\CollationsController::class => [ 'class' => Server\CollationsController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - '$dbi' => '@dbi', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template', '$dbi' => '@dbi'], ], Server\Databases\CreateController::class => [ 'class' => Server\Databases\CreateController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - '$dbi' => '@dbi', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template', '$dbi' => '@dbi'], ], Server\Databases\DestroyController::class => [ 'class' => Server\Databases\DestroyController::class, @@ -852,19 +728,11 @@ return [ ], Server\DatabasesController::class => [ 'class' => Server\DatabasesController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - '$dbi' => '@dbi', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template', '$dbi' => '@dbi'], ], Server\EnginesController::class => [ 'class' => Server\EnginesController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - '$dbi' => '@dbi', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template', '$dbi' => '@dbi'], ], Server\ExportController::class => [ 'class' => Server\ExportController::class, @@ -877,11 +745,7 @@ return [ ], Server\ImportController::class => [ 'class' => Server\ImportController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - '$dbi' => '@dbi', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template', '$dbi' => '@dbi'], ], Server\PluginsController::class => [ 'class' => Server\PluginsController::class, @@ -928,11 +792,7 @@ return [ ], Server\ShowEngineController::class => [ 'class' => Server\ShowEngineController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - '$dbi' => '@dbi', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template', '$dbi' => '@dbi'], ], Server\SqlController::class => [ 'class' => Server\SqlController::class, @@ -1087,27 +947,15 @@ return [ ], Server\Variables\GetVariableController::class => [ 'class' => Server\Variables\GetVariableController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - '$dbi' => '@dbi', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template', '$dbi' => '@dbi'], ], Server\Variables\SetVariableController::class => [ 'class' => Server\Variables\SetVariableController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - '$dbi' => '@dbi', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template', '$dbi' => '@dbi'], ], Server\VariablesController::class => [ 'class' => Server\VariablesController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - '$dbi' => '@dbi', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template', '$dbi' => '@dbi'], ], Sql\ColumnPreferencesController::class => [ 'class' => Sql\ColumnPreferencesController::class, @@ -1193,11 +1041,7 @@ return [ ], Table\ChartController::class => [ 'class' => Table\ChartController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - '$dbi' => '@dbi', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template', '$dbi' => '@dbi'], ], Table\CreateController::class => [ 'class' => Table\CreateController::class, @@ -1212,25 +1056,15 @@ return [ ], Table\DeleteConfirmController::class => [ 'class' => Table\DeleteConfirmController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template'], ], Table\DeleteRowsController::class => [ 'class' => Table\DeleteRowsController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - '$dbi' => '@dbi', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template', '$dbi' => '@dbi'], ], Table\DropColumnConfirmationController::class => [ 'class' => Table\DropColumnConfirmationController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template'], ], Table\DropColumnController::class => [ 'class' => Table\DropColumnController::class, @@ -1244,11 +1078,7 @@ return [ ], Table\ExportController::class => [ 'class' => Table\ExportController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - '$export' => '@export_options', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template', '$export' => '@export_options'], ], Table\ExportRowsController::class => [ 'class' => Table\ExportRowsController::class, @@ -1260,35 +1090,19 @@ return [ ], Table\FindReplaceController::class => [ 'class' => Table\FindReplaceController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - '$dbi' => '@dbi', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template', '$dbi' => '@dbi'], ], Table\GetFieldController::class => [ 'class' => Table\GetFieldController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - '$dbi' => '@dbi', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template', '$dbi' => '@dbi'], ], Table\GisVisualizationController::class => [ 'class' => Table\GisVisualizationController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - '$dbi' => '@dbi', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template', '$dbi' => '@dbi'], ], Table\ImportController::class => [ 'class' => Table\ImportController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - '$dbi' => '@dbi', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template', '$dbi' => '@dbi'], ], Table\IndexesController::class => [ 'class' => Table\IndexesController::class, @@ -1431,10 +1245,7 @@ return [ ], Table\RecentFavoriteController::class => [ 'class' => Table\RecentFavoriteController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template'], ], Table\RelationController::class => [ 'class' => Table\RelationController::class, @@ -1494,11 +1305,7 @@ return [ ], Table\Structure\BrowseController::class => [ 'class' => Table\Structure\BrowseController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - '$sql' => '@sql', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template', '$sql' => '@sql'], ], Table\Structure\CentralColumnsAddController::class => [ 'class' => Table\Structure\CentralColumnsAddController::class, @@ -1538,11 +1345,7 @@ return [ ], Table\Structure\MoveColumnsController::class => [ 'class' => Table\Structure\MoveColumnsController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - '$dbi' => '@dbi', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template', '$dbi' => '@dbi'], ], Table\Structure\PartitioningController::class => [ 'class' => Table\Structure\PartitioningController::class, @@ -1565,10 +1368,7 @@ return [ ], Table\Structure\ReservedWordCheckController::class => [ 'class' => Table\Structure\ReservedWordCheckController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template'], ], Table\Structure\SaveController::class => [ 'class' => Table\Structure\SaveController::class, @@ -1639,11 +1439,7 @@ return [ ], TableController::class => [ 'class' => TableController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - '$dbi' => '@dbi', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template', '$dbi' => '@dbi'], ], ThemesController::class => [ 'class' => ThemesController::class, @@ -1699,11 +1495,7 @@ return [ ], View\CreateController::class => [ 'class' => View\CreateController::class, - 'arguments' => [ - '$response' => '@response', - '$template' => '@template', - '$dbi' => '@dbi', - ], + 'arguments' => ['$response' => '@response', '$template' => '@template', '$dbi' => '@dbi'], ], View\OperationsController::class => [ 'class' => View\OperationsController::class, diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 79ab41e36d..6f4d6ca806 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -4776,14 +4776,7 @@ escapeString - [ - $fieldCount, - $fieldPrimary, - $fieldIndex, - $fieldUnique, - $fieldFullText, - $fieldSpatial, - ] + [$fieldCount, $fieldPrimary, $fieldIndex, $fieldUnique, $fieldFullText, $fieldSpatial] @@ -6307,12 +6300,7 @@ $delUrlParams - [ - $deleteUrl, - $deleteString, - $jsConf, - $urlParams, - ] + [$deleteUrl, $deleteString, $jsConf, $urlParams] array{?string, ?string, ?string} @@ -6583,11 +6571,7 @@ $map - + ]]> string[] @@ -8708,17 +8692,13 @@ - __('End of step'), - 'headText' => $headText, - 'queryError' => false, - ]]]> __('End of step'), 'headText' => $headText, 'queryError' => $error, 'extra' => $message, ]]]> + __('End of step'), 'headText' => $headText, 'queryError' => false]]]> array{legendText: string, headText: string, queryError: bool, extra: Message} @@ -14746,10 +14726,7 @@ $this->centralColumns, CentralColumns::class, 'getHtmlForEditTableRow', - [ - $listDetailCols[0], - 0, - ], + [$listDetailCols[0], 0], )]]> @@ -14910,15 +14887,7 @@ $this->object, DisplayResults::class, 'handleNonPrintableContents', - [ - $category, - $content, - $transformationPlugin, - $transformOptions, - $meta, - $urlParams, - &$isTruncated, - ], + [$category, $content, $transformationPlugin, $transformOptions, $meta, $urlParams, &$isTruncated], )]]> @@ -15157,22 +15126,10 @@ [ - SlimServerRequestFactory::class, - 'Slim PSR-7', - ], - 'guzzlehttp/psr7' => [ - GuzzleHttpFactory::class, - 'Guzzle PSR-7', - ], - 'nyholm/psr7' => [ - NyholmPsr17Factory::class, - 'Nyholm PSR-7', - ], - 'laminas/laminas-diactoros' => [ - LaminasServerRequestFactory::class, - 'Laminas diactoros PSR-7', - ], + 'slim/psr7' => [SlimServerRequestFactory::class, 'Slim PSR-7'], + 'guzzlehttp/psr7' => [GuzzleHttpFactory::class, 'Guzzle PSR-7'], + 'nyholm/psr7' => [NyholmPsr17Factory::class, 'Nyholm PSR-7'], + 'laminas/laminas-diactoros' => [LaminasServerRequestFactory::class, 'Laminas diactoros PSR-7'], ]]]> diff --git a/test/classes/Advisory/AdvisorTest.php b/test/classes/Advisory/AdvisorTest.php index 7dbcdc915f..fed94a9382 100644 --- a/test/classes/Advisory/AdvisorTest.php +++ b/test/classes/Advisory/AdvisorTest.php @@ -38,26 +38,11 @@ class AdvisorTest extends AbstractTestCase public static function advisorTimes(): array { return [ - [ - 10, - '10 per second', - ], - [ - 0.02, - '1.2 per minute', - ], - [ - 0.003, - '10.8 per hour', - ], - [ - 0.00003, - '2.59 per day', - ], - [ - 0.0000000003, - '<0.01 per day', - ], + [10, '10 per second'], + [0.02, '1.2 per minute'], + [0.003, '10.8 per hour'], + [0.00003, '2.59 per day'], + [0.0000000003, '<0.01 per day'], ]; } diff --git a/test/classes/BrowseForeignersTest.php b/test/classes/BrowseForeignersTest.php index cead575efc..a56f0745ae 100644 --- a/test/classes/BrowseForeignersTest.php +++ b/test/classes/BrowseForeignersTest.php @@ -118,10 +118,7 @@ class BrowseForeignersTest extends AbstractTestCase $desc = 'foobarassertEquals( - [ - 'foobarcallFunction( $this->browseForeigners, BrowseForeigners::class, @@ -135,10 +132,7 @@ class BrowseForeignersTest extends AbstractTestCase $browseForeigners = new BrowseForeigners(new Template(), $config); $this->assertEquals( - [ - 'fooba...', - 'foobarcallFunction( $browseForeigners, BrowseForeigners::class, diff --git a/test/classes/CacheTest.php b/test/classes/CacheTest.php index 9e4b6c17c2..4b6d464446 100644 --- a/test/classes/CacheTest.php +++ b/test/classes/CacheTest.php @@ -19,18 +19,9 @@ class CacheTest extends AbstractTestCase public static function dataProviderCacheKeyValues(): array { return [ - 'normal key and false value' => [ - 'mykey', - false, - ], - 'normal key and null value' => [ - 'mykey', - null, - ], - 'normal key and object value' => [ - 'mykey', - new stdClass(), - ], + 'normal key and false value' => ['mykey', false], + 'normal key and null value' => ['mykey', null], + 'normal key and object value' => ['mykey', new stdClass()], ]; } diff --git a/test/classes/Charsets/CollationTest.php b/test/classes/Charsets/CollationTest.php index 3a0c06f54c..1b36129296 100644 --- a/test/classes/Charsets/CollationTest.php +++ b/test/classes/Charsets/CollationTest.php @@ -53,394 +53,106 @@ class CollationTest extends AbstractTestCase public static function providerTestBuildDescription(): array { return [ - [ - 'binary', - 'Binary', - ], - [ - 'foo_bulgarian_bar', - 'Bulgarian', - ], - [ - 'gb2312_chinese', - 'Simplified Chinese', - ], - [ - 'gbk_chinese', - 'Simplified Chinese', - ], - [ - 'big5_chinese_ci', - 'Traditional Chinese, case-insensitive', - ], - [ - 'big5_chinese', - 'Traditional Chinese', - ], - [ - 'foo_ci_bar', - 'Unknown, case-insensitive', - ], - [ - 'foo_croatian_bar', - 'Croatian', - ], - [ - 'foo_czech_bar', - 'Czech', - ], - [ - 'foo_danish_bar', - 'Danish', - ], - [ - 'foo_english_bar', - 'English', - ], - [ - 'foo_esperanto_bar', - 'Esperanto', - ], - [ - 'foo_estonian_bar', - 'Estonian', - ], - [ - 'foo_german1_bar', - 'German (dictionary order)', - ], - [ - 'foo_german2_bar', - 'German (phone book order)', - ], - [ - 'foo_hungarian_bar', - 'Hungarian', - ], - [ - 'foo_icelandic_bar', - 'Icelandic', - ], - [ - 'foo_japanese_bar', - 'Japanese', - ], - [ - 'foo_latvian_bar', - 'Latvian', - ], - [ - 'foo_lithuanian_bar', - 'Lithuanian', - ], - [ - 'foo_korean_bar', - 'Korean', - ], - [ - 'foo_persian_bar', - 'Persian', - ], - [ - 'foo_polish_bar', - 'Polish', - ], - [ - 'foo_roman_bar', - 'West European', - ], - [ - 'foo_romanian_bar', - 'Romanian', - ], - [ - 'foo_slovak_bar', - 'Slovak', - ], - [ - 'foo_slovenian_bar', - 'Slovenian', - ], - [ - 'foo_spanish_bar', - 'Spanish (modern)', - ], - [ - 'foo_spanish2_bar', - 'Spanish (traditional)', - ], - [ - 'foo_swedish_bar', - 'Swedish', - ], - [ - 'foo_thai_bar', - 'Thai', - ], - [ - 'foo_turkish_bar', - 'Turkish', - ], - [ - 'foo_ukrainian_bar', - 'Ukrainian', - ], - [ - 'foo_unicode_bar', - 'Unicode', - ], - [ - 'ucs2', - 'Unicode', - ], - [ - 'utf8', - 'Unicode', - ], - [ - 'ascii', - 'West European', - ], - [ - 'cp850', - 'West European', - ], - [ - 'dec8', - 'West European', - ], - [ - 'hp8', - 'West European', - ], - [ - 'latin1', - 'West European', - ], - [ - 'cp1250', - 'Central European', - ], - [ - 'cp852', - 'Central European', - ], - [ - 'latin2', - 'Central European', - ], - [ - 'macce', - 'Central European', - ], - [ - 'cp866', - 'Russian', - ], - [ - 'koi8r', - 'Russian', - ], - [ - 'gb2312', - 'Simplified Chinese', - ], - [ - 'gbk', - 'Simplified Chinese', - ], - [ - 'sjis', - 'Japanese', - ], - [ - 'ujis', - 'Japanese', - ], - [ - 'cp932', - 'Japanese', - ], - [ - 'eucjpms', - 'Japanese', - ], - [ - 'cp1257', - 'Baltic', - ], - [ - 'latin7', - 'Baltic', - ], - [ - 'armscii8', - 'Armenian', - ], - [ - 'armscii', - 'Armenian', - ], - [ - 'big5', - 'Traditional Chinese', - ], - [ - 'cp1251', - 'Cyrillic', - ], - [ - 'cp1256', - 'Arabic', - ], - [ - 'euckr', - 'Korean', - ], - [ - 'hebrew', - 'Hebrew', - ], - [ - 'geostd8', - 'Georgian', - ], - [ - 'greek', - 'Greek', - ], - [ - 'keybcs2', - 'Czech-Slovak', - ], - [ - 'koi8u', - 'Ukrainian', - ], - [ - 'latin5', - 'Turkish', - ], - [ - 'swe7', - 'Swedish', - ], - [ - 'tis620', - 'Thai', - ], - [ - 'foobar', - 'Unknown', - ], - [ - 'foo_test_bar', - 'Unknown', - ], - [ - 'foo_bin_bar', - 'Unknown, binary', - ], - [ - 'utf8mb4_0900_ai_ci', - 'Unicode (UCA 9.0.0), accent-insensitive, case-insensitive', - ], - [ - 'utf8mb4_unicode_520_ci', - 'Unicode (UCA 5.2.0), case-insensitive', - ], - [ - 'utf8mb4_unicode_ci', - 'Unicode (UCA 4.0.0), case-insensitive', - ], - [ - 'utf8mb4_tr_0900_ai_ci', - 'Turkish (UCA 9.0.0), accent-insensitive, case-insensitive', - ], - [ - 'utf8mb4_turkish_ci', - 'Turkish (UCA 4.0.0), case-insensitive', - ], - [ - 'utf32_thai_520_w2', - 'Thai (UCA 5.2.0), multi-level', - ], - [ - 'utf8mb4_czech_ci', - 'Czech (UCA 4.0.0), case-insensitive', - ], - [ - 'cp1250_czech_cs', - 'Czech, case-sensitive', - ], - [ - 'latin1_general_ci', - 'West European, case-insensitive', - ], - [ - 'utf8mb4_bin', - 'Unicode (UCA 4.0.0), binary', - ], - [ - 'utf8mb4_croatian_mysql561_ci', - 'Croatian (MySQL 5.6.1), case-insensitive', - ], - [ - 'ucs2_general_mysql500_ci', - 'Unicode (MySQL 5.0.0), case-insensitive', - ], - [ - 'utf32_general_ci', - 'Unicode, case-insensitive', - ], - [ - 'utf8mb4_es_trad_0900_ai_ci', - 'Spanish (traditional) (UCA 9.0.0), accent-insensitive, case-insensitive', - ], - [ - 'utf8mb4_es_0900_ai_ci', - 'Spanish (modern) (UCA 9.0.0), accent-insensitive, case-insensitive', - ], + ['binary', 'Binary'], + ['foo_bulgarian_bar', 'Bulgarian'], + ['gb2312_chinese', 'Simplified Chinese'], + ['gbk_chinese', 'Simplified Chinese'], + ['big5_chinese_ci', 'Traditional Chinese, case-insensitive'], + ['big5_chinese', 'Traditional Chinese'], + ['foo_ci_bar', 'Unknown, case-insensitive'], + ['foo_croatian_bar', 'Croatian'], + ['foo_czech_bar', 'Czech'], + ['foo_danish_bar', 'Danish'], + ['foo_english_bar', 'English'], + ['foo_esperanto_bar', 'Esperanto'], + ['foo_estonian_bar', 'Estonian'], + ['foo_german1_bar', 'German (dictionary order)'], + ['foo_german2_bar', 'German (phone book order)'], + ['foo_hungarian_bar', 'Hungarian'], + ['foo_icelandic_bar', 'Icelandic'], + ['foo_japanese_bar', 'Japanese'], + ['foo_latvian_bar', 'Latvian'], + ['foo_lithuanian_bar', 'Lithuanian'], + ['foo_korean_bar', 'Korean'], + ['foo_persian_bar', 'Persian'], + ['foo_polish_bar', 'Polish'], + ['foo_roman_bar', 'West European'], + ['foo_romanian_bar', 'Romanian'], + ['foo_slovak_bar', 'Slovak'], + ['foo_slovenian_bar', 'Slovenian'], + ['foo_spanish_bar', 'Spanish (modern)'], + ['foo_spanish2_bar', 'Spanish (traditional)'], + ['foo_swedish_bar', 'Swedish'], + ['foo_thai_bar', 'Thai'], + ['foo_turkish_bar', 'Turkish'], + ['foo_ukrainian_bar', 'Ukrainian'], + ['foo_unicode_bar', 'Unicode'], + ['ucs2', 'Unicode'], + ['utf8', 'Unicode'], + ['ascii', 'West European'], + ['cp850', 'West European'], + ['dec8', 'West European'], + ['hp8', 'West European'], + ['latin1', 'West European'], + ['cp1250', 'Central European'], + ['cp852', 'Central European'], + ['latin2', 'Central European'], + ['macce', 'Central European'], + ['cp866', 'Russian'], + ['koi8r', 'Russian'], + ['gb2312', 'Simplified Chinese'], + ['gbk', 'Simplified Chinese'], + ['sjis', 'Japanese'], + ['ujis', 'Japanese'], + ['cp932', 'Japanese'], + ['eucjpms', 'Japanese'], + ['cp1257', 'Baltic'], + ['latin7', 'Baltic'], + ['armscii8', 'Armenian'], + ['armscii', 'Armenian'], + ['big5', 'Traditional Chinese'], + ['cp1251', 'Cyrillic'], + ['cp1256', 'Arabic'], + ['euckr', 'Korean'], + ['hebrew', 'Hebrew'], + ['geostd8', 'Georgian'], + ['greek', 'Greek'], + ['keybcs2', 'Czech-Slovak'], + ['koi8u', 'Ukrainian'], + ['latin5', 'Turkish'], + ['swe7', 'Swedish'], + ['tis620', 'Thai'], + ['foobar', 'Unknown'], + ['foo_test_bar', 'Unknown'], + ['foo_bin_bar', 'Unknown, binary'], + ['utf8mb4_0900_ai_ci', 'Unicode (UCA 9.0.0), accent-insensitive, case-insensitive'], + ['utf8mb4_unicode_520_ci', 'Unicode (UCA 5.2.0), case-insensitive'], + ['utf8mb4_unicode_ci', 'Unicode (UCA 4.0.0), case-insensitive'], + ['utf8mb4_tr_0900_ai_ci', 'Turkish (UCA 9.0.0), accent-insensitive, case-insensitive'], + ['utf8mb4_turkish_ci', 'Turkish (UCA 4.0.0), case-insensitive'], + ['utf32_thai_520_w2', 'Thai (UCA 5.2.0), multi-level'], + ['utf8mb4_czech_ci', 'Czech (UCA 4.0.0), case-insensitive'], + ['cp1250_czech_cs', 'Czech, case-sensitive'], + ['latin1_general_ci', 'West European, case-insensitive'], + ['utf8mb4_bin', 'Unicode (UCA 4.0.0), binary'], + ['utf8mb4_croatian_mysql561_ci', 'Croatian (MySQL 5.6.1), case-insensitive'], + ['ucs2_general_mysql500_ci', 'Unicode (MySQL 5.0.0), case-insensitive'], + ['utf32_general_ci', 'Unicode, case-insensitive'], + ['utf8mb4_es_trad_0900_ai_ci', 'Spanish (traditional) (UCA 9.0.0), accent-insensitive, case-insensitive'], + ['utf8mb4_es_0900_ai_ci', 'Spanish (modern) (UCA 9.0.0), accent-insensitive, case-insensitive'], [ 'utf8mb4_de_pb_0900_ai_ci', 'German (phone book order) (UCA 9.0.0), accent-insensitive, case-insensitive', ], - [ - 'utf8mb4_de_0900_ai_ci', - 'German (dictionary order) (UCA 9.0.0), accent-insensitive, case-insensitive', - ], - [ - 'utf8_myanmar_ci', - 'Burmese, case-insensitive', - ], - [ - 'utf8mb4_la_0900_as_cs', - 'Classical Latin (UCA 9.0.0), accent-sensitive, case-sensitive', - ], - [ - 'utf8_sinhala_ci', - 'Sinhalese, case-insensitive', - ], - [ - 'utf8_vietnamese_ci', - 'Vietnamese, case-insensitive', - ], - [ - 'gb18030_chinese_ci', - 'Chinese, case-insensitive', - ], - [ - 'utf8mb4_ja_0900_as_cs_ks', - 'Japanese (UCA 9.0.0), accent-sensitive, case-sensitive, kana-sensitive', - ], - [ - 'utf8mb4_unicode_520_nopad_ci', - 'Unicode (UCA 5.2.0), no-pad, case-insensitive', - ], - [ - 'utf8mb4_ru_0900_as_cs', - 'Russian (UCA 9.0.0), accent-sensitive, case-sensitive', - ], + ['utf8mb4_de_0900_ai_ci', 'German (dictionary order) (UCA 9.0.0), accent-insensitive, case-insensitive'], + ['utf8_myanmar_ci', 'Burmese, case-insensitive'], + ['utf8mb4_la_0900_as_cs', 'Classical Latin (UCA 9.0.0), accent-sensitive, case-sensitive'], + ['utf8_sinhala_ci', 'Sinhalese, case-insensitive'], + ['utf8_vietnamese_ci', 'Vietnamese, case-insensitive'], + ['gb18030_chinese_ci', 'Chinese, case-insensitive'], + ['utf8mb4_ja_0900_as_cs_ks', 'Japanese (UCA 9.0.0), accent-sensitive, case-sensitive, kana-sensitive'], + ['utf8mb4_unicode_520_nopad_ci', 'Unicode (UCA 5.2.0), no-pad, case-insensitive'], + ['utf8mb4_ru_0900_as_cs', 'Russian (UCA 9.0.0), accent-sensitive, case-sensitive'], ]; } } diff --git a/test/classes/Command/TwigLintCommandTest.php b/test/classes/Command/TwigLintCommandTest.php index 23e884eb68..25342e9202 100644 --- a/test/classes/Command/TwigLintCommandTest.php +++ b/test/classes/Command/TwigLintCommandTest.php @@ -71,16 +71,8 @@ class TwigLintCommandTest extends AbstractTestCase sort($filesInfos, SORT_REGULAR); $this->assertEquals([ - [ - 'template' => '', - 'file' => $path . DIRECTORY_SEPARATOR . 'one.txt', - 'valid' => true, - ], - [ - 'template' => '', - 'file' => $path . DIRECTORY_SEPARATOR . 'two.md', - 'valid' => true, - ], + ['template' => '', 'file' => $path . DIRECTORY_SEPARATOR . 'one.txt', 'valid' => true], + ['template' => '', 'file' => $path . DIRECTORY_SEPARATOR . 'two.md', 'valid' => true], [ 'template' => '0000' . "\n", 'file' => $path . DIRECTORY_SEPARATOR . 'subfolder' . DIRECTORY_SEPARATOR . 'zero.txt', @@ -103,10 +95,7 @@ class TwigLintCommandTest extends AbstractTestCase $command->expects($this->exactly(1)) ->method('findFiles') ->willReturn( - [ - 'foo.twig', - 'foo-invalid.twig', - ], + ['foo.twig', 'foo-invalid.twig'], ); $command->expects($this->exactly(2))->method('getTemplateContents')->willReturnMap([ @@ -119,11 +108,7 @@ class TwigLintCommandTest extends AbstractTestCase ]); $this->assertEquals([ - [ - 'template' => '{{ file }}', - 'file' => 'foo.twig', - 'valid' => true, - ], + ['template' => '{{ file }}', 'file' => 'foo.twig', 'valid' => true], [ 'template' => '{{ file }', 'file' => 'foo-invalid.twig', @@ -139,24 +124,15 @@ class TwigLintCommandTest extends AbstractTestCase public function testGetContext(): void { - $context = $this->callFunction($this->command, TwigLintCommand::class, 'getContext', [ - '{{ file }', - 0, - ]); + $context = $this->callFunction($this->command, TwigLintCommand::class, 'getContext', ['{{ file }', 0]); $this->assertEquals([1 => '{{ file }'], $context); - $context = $this->callFunction($this->command, TwigLintCommand::class, 'getContext', [ - '{{ file }', - 3, - ]); + $context = $this->callFunction($this->command, TwigLintCommand::class, 'getContext', ['{{ file }', 3]); $this->assertEquals([1 => '{{ file }'], $context); - $context = $this->callFunction($this->command, TwigLintCommand::class, 'getContext', [ - '{{ file }', - 5, - ]); + $context = $this->callFunction($this->command, TwigLintCommand::class, 'getContext', ['{{ file }', 5]); $this->assertEquals([], $context); } diff --git a/test/classes/Command/WriteGitRevisionCommandTest.php b/test/classes/Command/WriteGitRevisionCommandTest.php index 348f6ec4cf..dcd89f2d2e 100644 --- a/test/classes/Command/WriteGitRevisionCommandTest.php +++ b/test/classes/Command/WriteGitRevisionCommandTest.php @@ -36,10 +36,7 @@ class WriteGitRevisionCommandTest extends AbstractTestCase $this->command, WriteGitRevisionCommand::class, 'getRevisionInfo', - [ - 'https://github.com/phpmyadmin/phpmyadmin/commit/%s', - 'https://github.com/phpmyadmin/phpmyadmin/tree/%s', - ], + ['https://github.com/phpmyadmin/phpmyadmin/commit/%s', 'https://github.com/phpmyadmin/phpmyadmin/tree/%s'], ); $template = <<<'PHP' object->set('c', 3); $this->assertEquals( - [ - 'a' => 1, - 'c' => 3, - ], + ['a' => 1, 'c' => 3], $this->object->getConfig(), ); @@ -141,11 +138,7 @@ class ConfigFileTest extends AbstractTestCase $this->object->set('b', 2); $this->assertEquals( - [ - 'a' => 1, - 'b' => 2, - 'c' => 3, - ], + ['a' => 1, 'b' => 2, 'c' => 3], $this->object->getConfig(), ); } @@ -156,25 +149,14 @@ class ConfigFileTest extends AbstractTestCase public function testConfigReadMapping(): void { $this->object->setCfgUpdateReadMapping( - [ - 'Servers/value1' => 'Servers/1/value1', - 'Servers/value2' => 'Servers/1/value2', - ], + ['Servers/value1' => 'Servers/1/value1', 'Servers/value2' => 'Servers/1/value2'], ); $this->object->set('Servers/1/passthrough1', 1); $this->object->set('Servers/1/passthrough2', 2); $this->object->updateWithGlobalConfig(['Servers/value1' => 3]); $this->assertEquals( - [ - 'Servers' => [ - 1 => [ - 'passthrough1' => 1, - 'passthrough2' => 2, - 'value1' => 3, - ], - ], - ], + ['Servers' => [1 => ['passthrough1' => 1, 'passthrough2' => 2, 'value1' => 3]]], $this->object->getConfig(), ); $this->assertEquals( @@ -324,10 +306,7 @@ class ConfigFileTest extends AbstractTestCase $this->object->updateWithGlobalConfig(['key' => 'ABC']); $this->assertEquals( - [ - 'key' => 'ABC', - 'key2' => 'value', - ], + ['key' => 'ABC', 'key2' => 'value'], $this->object->getConfig(), ); } @@ -397,19 +376,11 @@ class ConfigFileTest extends AbstractTestCase $this->object->get('ServerDefault'), ); $this->assertEquals( - [ - 'Servers' => [ - 1 => ['x' => 1], - 2 => ['x' => 4], - ], - ], + ['Servers' => [1 => ['x' => 1], 2 => ['x' => 4]]], $this->object->getConfig(), ); $this->assertEquals( - [ - 'Servers/1/x' => 1, - 'Servers/2/x' => 4, - ], + ['Servers/1/x' => 1, 'Servers/2/x' => 4], $this->object->getConfigArray(), ); } @@ -423,10 +394,7 @@ class ConfigFileTest extends AbstractTestCase $this->object->set('Servers/2/x', 'b'); $this->assertEquals( - [ - 1 => ['x' => 'a'], - 2 => ['x' => 'b'], - ], + [1 => ['x' => 'a'], 2 => ['x' => 'b']], $this->object->getServers(), ); } @@ -529,13 +497,7 @@ class ConfigFileTest extends AbstractTestCase $defaultValue = $this->object->getDefault(self::SIMPLE_KEY_WITH_DEFAULT_VALUE); $this->assertEquals( - [ - self::SIMPLE_KEY_WITH_DEFAULT_VALUE => $defaultValue, - 'Array/test' => [ - 'x', - 'y', - ], - ], + [self::SIMPLE_KEY_WITH_DEFAULT_VALUE => $defaultValue, 'Array/test' => ['x', 'y']], $this->object->getConfigArray(), ); } diff --git a/test/classes/Config/DescriptionTest.php b/test/classes/Config/DescriptionTest.php index 17d3f59dda..dcb9afd3cb 100644 --- a/test/classes/Config/DescriptionTest.php +++ b/test/classes/Config/DescriptionTest.php @@ -44,46 +44,18 @@ class DescriptionTest extends AbstractTestCase public static function getValues(): array { return [ - 'valid name' => [ - 'AllowArbitraryServer', - 'name', - 'Allow login to any MySQL server', - ], + 'valid name' => ['AllowArbitraryServer', 'name', 'Allow login to any MySQL server'], 'valid description' => [ 'AllowArbitraryServer', 'desc', 'If enabled, user can enter any MySQL server in login form for cookie auth.', ], - 'valid comment' => [ - 'MaxDbList', - 'cmt', - 'Users cannot set a higher value', - ], - 'invalid name' => [ - 'UnknownSetting', - 'name', - 'UnknownSetting', - ], - 'invalid description' => [ - 'UnknownSetting', - 'desc', - '', - ], - 'invalid comment' => [ - 'UnknownSetting', - 'cmt', - '', - ], - 'server number' => [ - 'Servers/1/DisableIS', - 'name', - 'Disable use of INFORMATION_SCHEMA', - ], - 'composed name' => [ - 'Import/format', - 'name', - 'Format of imported file', - ], + 'valid comment' => ['MaxDbList', 'cmt', 'Users cannot set a higher value'], + 'invalid name' => ['UnknownSetting', 'name', 'UnknownSetting'], + 'invalid description' => ['UnknownSetting', 'desc', ''], + 'invalid comment' => ['UnknownSetting', 'cmt', ''], + 'server number' => ['Servers/1/DisableIS', 'name', 'Disable use of INFORMATION_SCHEMA'], + 'composed name' => ['Import/format', 'name', 'Format of imported file'], 'bb code' => [ 'NavigationLogoLinkWindow', 'desc', @@ -109,14 +81,7 @@ class DescriptionTest extends AbstractTestCase */ public function testAll(): void { - $nested = [ - 'Export', - 'Import', - 'Schema', - 'DBG', - 'DefaultTransformations', - 'SQLQuery', - ]; + $nested = ['Export', 'Import', 'Schema', 'DBG', 'DefaultTransformations', 'SQLQuery']; $settings = new Settings([]); $cfg = $settings->asArray(); diff --git a/test/classes/Config/FormDisplayTemplateTest.php b/test/classes/Config/FormDisplayTemplateTest.php index cc8169bf0c..b1feca9d5f 100644 --- a/test/classes/Config/FormDisplayTemplateTest.php +++ b/test/classes/Config/FormDisplayTemplateTest.php @@ -151,15 +151,8 @@ class FormDisplayTemplateTest extends AbstractTestCase // select case 1 $opts['values_escaped'] = true; - $opts['values_disabled'] = [ - 1, - 2, - ]; - $opts['values'] = [ - 1 => 'test', - 'key1' => true, - 'key2' => false, - ]; + $opts['values_disabled'] = [1, 2]; + $opts['values'] = [1 => 'test', 'key1' => true, 'key2' => false]; $result = $this->formDisplayTemplate->displayInput('test/path', 'testName', 'select', true, '', true, $opts); $this->assertStringContainsString('', $result); @@ -192,10 +178,7 @@ class FormDisplayTemplateTest extends AbstractTestCase 'test/path', 'testName', 'list', - [ - 'foo', - 'bar', - ], + ['foo', 'bar'], '', true, $opts, @@ -250,13 +233,7 @@ class FormDisplayTemplateTest extends AbstractTestCase */ public function testAddJsValidate(): void { - $validators = [ - 'one' => [ - '\\\';', - '\r\n\\\'