From 2d0c72da8efe7ca34322ce4550d038a83ad3f4b7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 5 Nov 2026 19:51:20 +0000 Subject: [PATCH 1/4] Initial plan From 5d6bd8ad73120c3fd64843c64adeac24bc8340ca Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 5 Nov 2026 19:53:09 +0000 Subject: [PATCH 2/4] Use explicit nullable union types Co-authored-by: iMattPro <303711+iMattPro@users.noreply.github.com> --- console/command/repair_tags.php | 2 +- tags/manager.php | 2 +- tags/reply_repairer.php | 2 +- tags/title_repairer.php | 4 ++-- tags/topic_repairer.php | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/console/command/repair_tags.php b/console/command/repair_tags.php index 25ab1cf..a42c927 100644 --- a/console/command/repair_tags.php +++ b/console/command/repair_tags.php @@ -342,7 +342,7 @@ protected function ask_replacements(SymfonyStyle $io, string $source_name): arra * @param array $catalog Tag catalog * @return int|null Selected target identifier, or null when cancelled */ - protected function ask_merge_target(SymfonyStyle $io, int $source_id, array $catalog): ?int + protected function ask_merge_target(SymfonyStyle $io, int $source_id, array $catalog): int|null { $target_ids = []; $choices = []; diff --git a/tags/manager.php b/tags/manager.php index 6fbc05b..774fb2d 100644 --- a/tags/manager.php +++ b/tags/manager.php @@ -57,7 +57,7 @@ class manager * @param string $forums_table Forums table * @param cache|null $cache Cache driver */ - public function __construct(driver_interface $db, string $tags_table, string $forums_map_table, string $topic_map_table, string $forums_table, ?cache $cache = null) + public function __construct(driver_interface $db, string $tags_table, string $forums_map_table, string $topic_map_table, string $forums_table, cache|null $cache = null) { $this->db = $db; $this->tags_table = $tags_table; diff --git a/tags/reply_repairer.php b/tags/reply_repairer.php index 91dc155..55f4aa2 100644 --- a/tags/reply_repairer.php +++ b/tags/reply_repairer.php @@ -178,7 +178,7 @@ protected function reply_plan_from_row( array $tag_ids, array $posts, array $forum_caches - ): ?array + ): array|null { $post_id = (int) $row['post_id']; $topic_id = (int) $row['topic_id']; diff --git a/tags/title_repairer.php b/tags/title_repairer.php index ab3d970..36c7c44 100644 --- a/tags/title_repairer.php +++ b/tags/title_repairer.php @@ -288,7 +288,7 @@ protected function load_forum_caches(array $topics): array * @return array|null Repair snapshot, or null when the topic is unmatched * @throws \InvalidArgumentException When the prefix is invalid */ - protected function plan_from_row(array $row, string $prefix, array $posts, array $forum_caches): ?array + protected function plan_from_row(array $row, string $prefix, array $posts, array $forum_caches): array|null { $topic_id = (int) $row['topic_id']; $forum_id = (int) $row['forum_id']; @@ -857,7 +857,7 @@ protected function literal(string $text): string * @param string $sql SQL query * @return array|null First row, or null when no row exists */ - protected function fetch(string $sql): ?array + protected function fetch(string $sql): array|null { $result = $this->db->sql_query($sql); $row = $this->db->sql_fetchrow($result); diff --git a/tags/topic_repairer.php b/tags/topic_repairer.php index aa111a1..5e98b75 100644 --- a/tags/topic_repairer.php +++ b/tags/topic_repairer.php @@ -200,7 +200,7 @@ protected function get_forum_tags(int $forum_id): array * @param array $tags Tag rows available in the topic's forum * @return array|null Matched prefix and tags, or null when no prefix matches */ - protected function match_prefix(string $title, array $tags): ?array + protected function match_prefix(string $title, array $tags): array|null { $states = [0 => ['' => []]]; $matches = []; From 750ad3b69f4f93b12bbfdc273914c7777229ddf3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 5 Nov 2026 20:01:05 +0000 Subject: [PATCH 3/4] Restore PHP 7.2-compatible nullable types Co-authored-by: iMattPro <303711+iMattPro@users.noreply.github.com> --- console/command/repair_tags.php | 2 +- tags/manager.php | 2 +- tags/reply_repairer.php | 2 +- tags/title_repairer.php | 4 ++-- tags/topic_repairer.php | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/console/command/repair_tags.php b/console/command/repair_tags.php index a42c927..25ab1cf 100644 --- a/console/command/repair_tags.php +++ b/console/command/repair_tags.php @@ -342,7 +342,7 @@ protected function ask_replacements(SymfonyStyle $io, string $source_name): arra * @param array $catalog Tag catalog * @return int|null Selected target identifier, or null when cancelled */ - protected function ask_merge_target(SymfonyStyle $io, int $source_id, array $catalog): int|null + protected function ask_merge_target(SymfonyStyle $io, int $source_id, array $catalog): ?int { $target_ids = []; $choices = []; diff --git a/tags/manager.php b/tags/manager.php index 774fb2d..6fbc05b 100644 --- a/tags/manager.php +++ b/tags/manager.php @@ -57,7 +57,7 @@ class manager * @param string $forums_table Forums table * @param cache|null $cache Cache driver */ - public function __construct(driver_interface $db, string $tags_table, string $forums_map_table, string $topic_map_table, string $forums_table, cache|null $cache = null) + public function __construct(driver_interface $db, string $tags_table, string $forums_map_table, string $topic_map_table, string $forums_table, ?cache $cache = null) { $this->db = $db; $this->tags_table = $tags_table; diff --git a/tags/reply_repairer.php b/tags/reply_repairer.php index 55f4aa2..91dc155 100644 --- a/tags/reply_repairer.php +++ b/tags/reply_repairer.php @@ -178,7 +178,7 @@ protected function reply_plan_from_row( array $tag_ids, array $posts, array $forum_caches - ): array|null + ): ?array { $post_id = (int) $row['post_id']; $topic_id = (int) $row['topic_id']; diff --git a/tags/title_repairer.php b/tags/title_repairer.php index 36c7c44..ab3d970 100644 --- a/tags/title_repairer.php +++ b/tags/title_repairer.php @@ -288,7 +288,7 @@ protected function load_forum_caches(array $topics): array * @return array|null Repair snapshot, or null when the topic is unmatched * @throws \InvalidArgumentException When the prefix is invalid */ - protected function plan_from_row(array $row, string $prefix, array $posts, array $forum_caches): array|null + protected function plan_from_row(array $row, string $prefix, array $posts, array $forum_caches): ?array { $topic_id = (int) $row['topic_id']; $forum_id = (int) $row['forum_id']; @@ -857,7 +857,7 @@ protected function literal(string $text): string * @param string $sql SQL query * @return array|null First row, or null when no row exists */ - protected function fetch(string $sql): array|null + protected function fetch(string $sql): ?array { $result = $this->db->sql_query($sql); $row = $this->db->sql_fetchrow($result); diff --git a/tags/topic_repairer.php b/tags/topic_repairer.php index 5e98b75..aa111a1 100644 --- a/tags/topic_repairer.php +++ b/tags/topic_repairer.php @@ -200,7 +200,7 @@ protected function get_forum_tags(int $forum_id): array * @param array $tags Tag rows available in the topic's forum * @return array|null Matched prefix and tags, or null when no prefix matches */ - protected function match_prefix(string $title, array $tags): array|null + protected function match_prefix(string $title, array $tags): ?array { $states = [0 => ['' => []]]; $matches = []; From 59fc057599950eddbe3ca9ef046cb481ea8d632d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 5 Nov 2026 20:04:25 +0000 Subject: [PATCH 4/4] Require PHP 8 for union type declarations Co-authored-by: iMattPro <303711+iMattPro@users.noreply.github.com> --- composer.json | 2 +- console/command/repair_tags.php | 2 +- tags/manager.php | 2 +- tags/reply_repairer.php | 2 +- tags/title_repairer.php | 4 ++-- tags/topic_repairer.php | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index c47541a..9a5f213 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ } ], "require": { - "php": ">=7.2", + "php": ">=8.0", "composer/installers": "^1.0 || ^2.0" }, "require-dev": { diff --git a/console/command/repair_tags.php b/console/command/repair_tags.php index 25ab1cf..a42c927 100644 --- a/console/command/repair_tags.php +++ b/console/command/repair_tags.php @@ -342,7 +342,7 @@ protected function ask_replacements(SymfonyStyle $io, string $source_name): arra * @param array $catalog Tag catalog * @return int|null Selected target identifier, or null when cancelled */ - protected function ask_merge_target(SymfonyStyle $io, int $source_id, array $catalog): ?int + protected function ask_merge_target(SymfonyStyle $io, int $source_id, array $catalog): int|null { $target_ids = []; $choices = []; diff --git a/tags/manager.php b/tags/manager.php index 6fbc05b..774fb2d 100644 --- a/tags/manager.php +++ b/tags/manager.php @@ -57,7 +57,7 @@ class manager * @param string $forums_table Forums table * @param cache|null $cache Cache driver */ - public function __construct(driver_interface $db, string $tags_table, string $forums_map_table, string $topic_map_table, string $forums_table, ?cache $cache = null) + public function __construct(driver_interface $db, string $tags_table, string $forums_map_table, string $topic_map_table, string $forums_table, cache|null $cache = null) { $this->db = $db; $this->tags_table = $tags_table; diff --git a/tags/reply_repairer.php b/tags/reply_repairer.php index 91dc155..55f4aa2 100644 --- a/tags/reply_repairer.php +++ b/tags/reply_repairer.php @@ -178,7 +178,7 @@ protected function reply_plan_from_row( array $tag_ids, array $posts, array $forum_caches - ): ?array + ): array|null { $post_id = (int) $row['post_id']; $topic_id = (int) $row['topic_id']; diff --git a/tags/title_repairer.php b/tags/title_repairer.php index ab3d970..36c7c44 100644 --- a/tags/title_repairer.php +++ b/tags/title_repairer.php @@ -288,7 +288,7 @@ protected function load_forum_caches(array $topics): array * @return array|null Repair snapshot, or null when the topic is unmatched * @throws \InvalidArgumentException When the prefix is invalid */ - protected function plan_from_row(array $row, string $prefix, array $posts, array $forum_caches): ?array + protected function plan_from_row(array $row, string $prefix, array $posts, array $forum_caches): array|null { $topic_id = (int) $row['topic_id']; $forum_id = (int) $row['forum_id']; @@ -857,7 +857,7 @@ protected function literal(string $text): string * @param string $sql SQL query * @return array|null First row, or null when no row exists */ - protected function fetch(string $sql): ?array + protected function fetch(string $sql): array|null { $result = $this->db->sql_query($sql); $row = $this->db->sql_fetchrow($result); diff --git a/tags/topic_repairer.php b/tags/topic_repairer.php index aa111a1..5e98b75 100644 --- a/tags/topic_repairer.php +++ b/tags/topic_repairer.php @@ -200,7 +200,7 @@ protected function get_forum_tags(int $forum_id): array * @param array $tags Tag rows available in the topic's forum * @return array|null Matched prefix and tags, or null when no prefix matches */ - protected function match_prefix(string $title, array $tags): ?array + protected function match_prefix(string $title, array $tags): array|null { $states = [0 => ['' => []]]; $matches = [];