From ee484735689ff2e8f7dee18c0081fcfa2a85909b Mon Sep 17 00:00:00 2001 From: Simon Mundy Date: Mon, 5 Oct 2026 10:39:47 +1100 Subject: [PATCH] Recurse directly for a bare Select in Combine::combine() A bare Select in the combine list is passed straight back to combine() instead of being wrapped in a one-element array, whose missing type and modifier keys the analyzer reports as undefined. Signed-off-by: Simon Mundy --- analyzer-baseline.toml | 12 ------------ src/Sql/Combine.php | 3 ++- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/analyzer-baseline.toml b/analyzer-baseline.toml index 9db6379b..52b507d3 100644 --- a/analyzer-baseline.toml +++ b/analyzer-baseline.toml @@ -2064,18 +2064,6 @@ code = "possibly-undefined-string-array-index" message = "Possibly undefined array key `string('combine')` accessed on `array|null>>|string>`." count = 1 -[[issues]] -file = "src/Sql/Combine.php" -code = "undefined-int-array-index" -message = 'Undefined list index `1` accessed on `list{PhpDb\Sql\Select}`.' -count = 1 - -[[issues]] -file = "src/Sql/Combine.php" -code = "undefined-int-array-index" -message = 'Undefined list index `2` accessed on `list{PhpDb\Sql\Select}`.' -count = 1 - [[issues]] file = "src/Sql/Ddl/AlterTable.php" code = "class-must-be-final" diff --git a/src/Sql/Combine.php b/src/Sql/Combine.php index 0971b481..5053ba64 100644 --- a/src/Sql/Combine.php +++ b/src/Sql/Combine.php @@ -93,7 +93,8 @@ public function combine(Select|array $select, string $type = self::COMBINE_UNION if (is_array($select)) { foreach ($select as $combine) { if ($combine instanceof Select) { - $combine = [$combine]; + $this->combine($combine, $type, $modifier); + continue; } $this->combine(