From 26acd5431f9e8fb4a66a87f15ddeac5c0a0fc982 Mon Sep 17 00:00:00 2001 From: John Rayes Date: Tue, 13 Oct 2026 19:55:50 -0700 Subject: [PATCH 1/2] Partially apply StatementIndentationFixer to ./Sources --- Languages/en_US/Admin.php | 2 +- Sources/Actions/Moderation/Main.php | 8 ++-- Sources/BBCode/GenericBBCode.php | 2 +- Sources/Calendar/RecurrenceIterator.php | 2 +- Sources/Db/APIs/MySQL.php | 46 +++++++++---------- Sources/Db/APIs/PostgreSQL.php | 18 ++++---- .../Migration/v2_1/MysqlModFixes.php | 42 ++++++++--------- Sources/Maintenance/Tools/ToolsBase.php | 2 +- Sources/Maintenance/Tools/Upgrade.php | 2 +- Sources/PersonalMessage/Search.php | 10 ++-- Sources/ServerSideIncludes.php | 2 +- 11 files changed, 68 insertions(+), 68 deletions(-) diff --git a/Languages/en_US/Admin.php b/Languages/en_US/Admin.php index d50cd2913e3..84416b1565b 100644 --- a/Languages/en_US/Admin.php +++ b/Languages/en_US/Admin.php @@ -788,7 +788,7 @@ $txt['notifications'] = 'Notifications'; $txt['notify_settings'] = 'Notification Settings'; $txt['notifications_desc'] = 'This page allows you to set the default notification options for users.'; - // The GDPR page of the EU exists in several languages; change the language code at the end of the url +// The GDPR page of the EU exists in several languages; change the language code at the end of the url $txt['notify_announcements_desc'] = 'Enabling this default option violates the rules of the GDPR and many other countries’ privacy and anti-spam laws.'; $txt['enable_sm_stats'] = 'Allow Stat Collection'; diff --git a/Sources/Actions/Moderation/Main.php b/Sources/Actions/Moderation/Main.php index 6524261a18d..6679095e4ec 100644 --- a/Sources/Actions/Moderation/Main.php +++ b/Sources/Actions/Moderation/Main.php @@ -432,10 +432,10 @@ protected function setModerationAreas(): void $this->moderation_areas, function (&$value, $key) { if (\is_string($value)) { - $value = strtr($value, [ - '{scripturl}' => Config::$scripturl, - '{boardurl}' => Config::$boardurl, - ]); + $value = strtr($value, [ + '{scripturl}' => Config::$scripturl, + '{boardurl}' => Config::$boardurl, + ]); } }, ); diff --git a/Sources/BBCode/GenericBBCode.php b/Sources/BBCode/GenericBBCode.php index 9c7074b13e6..fea150112a6 100644 --- a/Sources/BBCode/GenericBBCode.php +++ b/Sources/BBCode/GenericBBCode.php @@ -124,7 +124,7 @@ function ($v, $k) { }, ARRAY_FILTER_USE_BOTH, ); - } + } } if (\is_string($definition['test'] ?? null)) { diff --git a/Sources/Calendar/RecurrenceIterator.php b/Sources/Calendar/RecurrenceIterator.php index 6e49e2a61d9..754d7342904 100644 --- a/Sources/Calendar/RecurrenceIterator.php +++ b/Sources/Calendar/RecurrenceIterator.php @@ -1091,7 +1091,7 @@ private function limit(\DateTime $current): bool } } break; - } + } $valid &= \in_array($current_value, $allowed_values); } diff --git a/Sources/Db/APIs/MySQL.php b/Sources/Db/APIs/MySQL.php index c078884da6a..d68559e8282 100644 --- a/Sources/Db/APIs/MySQL.php +++ b/Sources/Db/APIs/MySQL.php @@ -444,13 +444,13 @@ public function insert(string $method, string $table, array $columns, array $dat foreach ($data as $dataRow) { if (\count($indexed_columns) !== \count($dataRow)) { - $this->error_backtrace( - 'Invalid insert query. Requested column count does not match the number of keys on inserted data.', - '', - E_USER_ERROR, - __FILE__, - __LINE__, - ); + $this->error_backtrace( + 'Invalid insert query. Requested column count does not match the number of keys on inserted data.', + '', + E_USER_ERROR, + __FILE__, + __LINE__, + ); } $insertRows[] = $this->quote($insertData, array_combine($indexed_columns, $dataRow), $connection); } @@ -1237,24 +1237,24 @@ public function table_sql(string $table_name): string default: $line .= 'KEY `' . $index['name'] . '`'; break; - } + } - $index_columns = []; + $index_columns = []; - foreach ($index['columns'] as $index_column) { - // A column can be indexed by its first so many characters. - // The count belongs after the name rather than inside it, - // so it has to be left outside the quoting. - if (preg_match('~^(.+)\((\d+)\)$~', $index_column, $matches) === 1) { - $index_columns[] = '`' . $matches[1] . '`(' . $matches[2] . ')'; - } else { - $index_columns[] = '`' . $index_column . '`'; - } - } + foreach ($index['columns'] as $index_column) { + // A column can be indexed by its first so many characters. + // The count belongs after the name rather than inside it, + // so it has to be left outside the quoting. + if (preg_match('~^(.+)\((\d+)\)$~', $index_column, $matches) === 1) { + $index_columns[] = '`' . $matches[1] . '`(' . $matches[2] . ')'; + } else { + $index_columns[] = '`' . $index_column . '`'; + } + } - $line .= ' (' . implode(', ', $index_columns) . ')'; + $line .= ' (' . implode(', ', $index_columns) . ')'; - $inner_lines[] = $line; + $inner_lines[] = $line; } $schema_create .= implode(",\n", $inner_lines) . "\n"; @@ -2807,7 +2807,7 @@ protected function replacement__callback(array $matches, array $db_values, objec case 'string': case 'text': - // MySQL folds the case of the value in the collation as well. + // MySQL folds the case of the value in the collation as well. case 'string_ci': return \sprintf('\'%1$s\'', mysqli_real_escape_string($connection, $this->fix_mb4((string) $replacement))); @@ -2833,7 +2833,7 @@ protected function replacement__callback(array $matches, array $db_values, objec break; case 'array_string': - // As above, the collation folds each of these too. + // As above, the collation folds each of these too. case 'array_string_ci': if (\is_array($replacement)) { if (empty($replacement)) { diff --git a/Sources/Db/APIs/PostgreSQL.php b/Sources/Db/APIs/PostgreSQL.php index 9c3edfaea25..a01b698d0cf 100644 --- a/Sources/Db/APIs/PostgreSQL.php +++ b/Sources/Db/APIs/PostgreSQL.php @@ -545,13 +545,13 @@ public function insert(string $method, string $table, array $columns, array $dat foreach ($data as $dataRow) { if (\count($indexed_columns) !== \count($dataRow)) { - $this->error_backtrace( - 'Invalid insert query. Requested column count does not match the number of keys on inserted data.', - '', - E_USER_ERROR, - __FILE__, - __LINE__, - ); + $this->error_backtrace( + 'Invalid insert query. Requested column count does not match the number of keys on inserted data.', + '', + E_USER_ERROR, + __FILE__, + __LINE__, + ); } $insertRows[] = $this->quote($insertData, array_combine($indexed_columns, $dataRow), $connection); @@ -2747,7 +2747,7 @@ protected function replacement__callback(array $matches, array $db_values, objec case 'text': return \sprintf('\'%1$s\'', pg_escape_string($this->connection, (string) $replacement)); - // Folded to match a column that {column_ci:} has folded. + // Folded to match a column that {column_ci:} has folded. case 'string_ci': return \sprintf('LOWER(\'%1$s\')', pg_escape_string($this->connection, (string) $replacement)); @@ -2789,7 +2789,7 @@ protected function replacement__callback(array $matches, array $db_values, objec break; - // Each of these folded to match a column that {column_ci:} has folded. + // Each of these folded to match a column that {column_ci:} has folded. case 'array_string_ci': if (\is_array($replacement)) { if (empty($replacement)) { diff --git a/Sources/Maintenance/Migration/v2_1/MysqlModFixes.php b/Sources/Maintenance/Migration/v2_1/MysqlModFixes.php index 7e3228d8511..4228369f014 100644 --- a/Sources/Maintenance/Migration/v2_1/MysqlModFixes.php +++ b/Sources/Maintenance/Migration/v2_1/MysqlModFixes.php @@ -69,14 +69,14 @@ public function execute(): bool ); while ($row = Db::$db->fetch_assoc($request)) { - $this->query( - 'ALTER TABLE {db_prefix}members + $this->query( + 'ALTER TABLE {db_prefix}members MODIFY {raw:col_name} {raw:col_type} NULL', - [ - 'col_name' => $row['COLUMN_NAME'], - 'col_type' => $row['COLUMN_TYPE'], - ], - ); + [ + 'col_name' => $row['COLUMN_NAME'], + 'col_type' => $row['COLUMN_TYPE'], + ], + ); } $this->handleTimeout(++$start); @@ -101,14 +101,14 @@ public function execute(): bool ); while ($row = Db::$db->fetch_assoc($request)) { - $this->query( - 'ALTER TABLE {db_prefix}boards + $this->query( + 'ALTER TABLE {db_prefix}boards MODIFY {raw:col_name} {raw:col_type} NULL', - [ - 'col_name' => $row['COLUMN_NAME'], - 'col_type' => $row['COLUMN_TYPE'], - ], - ); + [ + 'col_name' => $row['COLUMN_NAME'], + 'col_type' => $row['COLUMN_TYPE'], + ], + ); } $this->handleTimeout(++$start); @@ -131,14 +131,14 @@ public function execute(): bool ); while ($row = Db::$db->fetch_assoc($request)) { - $this->query( - 'ALTER TABLE {db_prefix}topics + $this->query( + 'ALTER TABLE {db_prefix}topics MODIFY {raw:col_name} {raw:col_type} NULL', - [ - 'col_name' => $row['COLUMN_NAME'], - 'col_type' => $row['COLUMN_TYPE'], - ], - ); + [ + 'col_name' => $row['COLUMN_NAME'], + 'col_type' => $row['COLUMN_TYPE'], + ], + ); } $this->handleTimeout(++$start); diff --git a/Sources/Maintenance/Tools/ToolsBase.php b/Sources/Maintenance/Tools/ToolsBase.php index fbaaf71aa89..8ba86c02335 100644 --- a/Sources/Maintenance/Tools/ToolsBase.php +++ b/Sources/Maintenance/Tools/ToolsBase.php @@ -427,7 +427,7 @@ final public function makeFilesWritable(array &$files): bool if ($ftp->error === false) { // Try it without /home/abc just in case they messed up. if (!$ftp->chdir(Utils::$context['chmod']['path'])) { - Utils::$context['chmod']['ftp_error'] = $ftp->last_message; + Utils::$context['chmod']['ftp_error'] = $ftp->last_message; $ftp->chdir(preg_replace('~^/home[2]?/[^/]+?~', '', Utils::$context['chmod']['path'])); } } diff --git a/Sources/Maintenance/Tools/Upgrade.php b/Sources/Maintenance/Tools/Upgrade.php index 22d59581117..b477796b6c8 100644 --- a/Sources/Maintenance/Tools/Upgrade.php +++ b/Sources/Maintenance/Tools/Upgrade.php @@ -776,7 +776,7 @@ public function welcomeLogin(): bool // Next, check the custom avatar directory... Note this is optional in 2.0. if (!empty(Config::$modSettings['custom_avatar_dir']) && !is_dir(Config::$modSettings['custom_avatar_dir'])) { - Maintenance::$warnings[] = Lang::getTxt('warning_custom_av_missing', file: 'Maintenance'); + Maintenance::$warnings[] = Lang::getTxt('warning_custom_av_missing', file: 'Maintenance'); $this->logProgress(Lang::getTxt('warning_custom_av_missing', file: 'Maintenance')); } diff --git a/Sources/PersonalMessage/Search.php b/Sources/PersonalMessage/Search.php index 4a6ac3f47c1..db863211207 100644 --- a/Sources/PersonalMessage/Search.php +++ b/Sources/PersonalMessage/Search.php @@ -494,12 +494,12 @@ protected function setUserQuery(): void if (Db::$db->num_rows($request) > $this->max_members_to_search) { $this->user_query = ''; } else { - $clauses = []; + $clauses = []; - foreach ($possible_users as $k => $v) { - $this->searchq_parameters['name_' . $k] = $v; - $clauses[] = '{column_ci:pm.from_name} LIKE {string:name_' . $k . '}'; - } + foreach ($possible_users as $k => $v) { + $this->searchq_parameters['name_' . $k] = $v; + $clauses[] = '{column_ci:pm.from_name} LIKE {string:name_' . $k . '}'; + } if (Db::$db->num_rows($request) == 0) { $this->user_query = 'AND pm.id_member_from = 0 AND (' . implode(' OR ', $clauses) . ')'; diff --git a/Sources/ServerSideIncludes.php b/Sources/ServerSideIncludes.php index 87e22bca887..c811c380a3c 100644 --- a/Sources/ServerSideIncludes.php +++ b/Sources/ServerSideIncludes.php @@ -1358,7 +1358,7 @@ public static function latestMember(string $output_method = 'echo'): ?array return null; } - return Utils::$context['common_stats']['latest_member']; + return Utils::$context['common_stats']['latest_member']; } /** From 1cc7d9631f40f3bcd178f896657a3c8355160117 Mon Sep 17 00:00:00 2001 From: John Rayes Date: Tue, 13 Oct 2026 21:46:49 -0700 Subject: [PATCH 2/2] Apply batched suggestions from code review Co-authored-by: John Rayes --- Sources/Db/APIs/MySQL.php | 4 ++-- Sources/Db/APIs/PostgreSQL.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/Db/APIs/MySQL.php b/Sources/Db/APIs/MySQL.php index d68559e8282..d9ee29b82e6 100644 --- a/Sources/Db/APIs/MySQL.php +++ b/Sources/Db/APIs/MySQL.php @@ -2807,7 +2807,7 @@ protected function replacement__callback(array $matches, array $db_values, objec case 'string': case 'text': - // MySQL folds the case of the value in the collation as well. + // MySQL folds the case of the value in the collation as well. case 'string_ci': return \sprintf('\'%1$s\'', mysqli_real_escape_string($connection, $this->fix_mb4((string) $replacement))); @@ -2833,7 +2833,7 @@ protected function replacement__callback(array $matches, array $db_values, objec break; case 'array_string': - // As above, the collation folds each of these too. + // As above, the collation folds each of these too. case 'array_string_ci': if (\is_array($replacement)) { if (empty($replacement)) { diff --git a/Sources/Db/APIs/PostgreSQL.php b/Sources/Db/APIs/PostgreSQL.php index a01b698d0cf..9a684152fce 100644 --- a/Sources/Db/APIs/PostgreSQL.php +++ b/Sources/Db/APIs/PostgreSQL.php @@ -2747,7 +2747,7 @@ protected function replacement__callback(array $matches, array $db_values, objec case 'text': return \sprintf('\'%1$s\'', pg_escape_string($this->connection, (string) $replacement)); - // Folded to match a column that {column_ci:} has folded. + // Folded to match a column that {column_ci:} has folded. case 'string_ci': return \sprintf('LOWER(\'%1$s\')', pg_escape_string($this->connection, (string) $replacement)); @@ -2789,7 +2789,7 @@ protected function replacement__callback(array $matches, array $db_values, objec break; - // Each of these folded to match a column that {column_ci:} has folded. + // Each of these folded to match a column that {column_ci:} has folded. case 'array_string_ci': if (\is_array($replacement)) { if (empty($replacement)) {