diff --git a/src/Psalm/Type/Union.php b/src/Psalm/Type/Union.php index 527d1b0f1e6..d6ad2bc4256 100644 --- a/src/Psalm/Type/Union.php +++ b/src/Psalm/Type/Union.php @@ -784,7 +784,6 @@ public function hasString() || isset($this->types['class-string']) || isset($this->types['trait-string']) || isset($this->types['numeric-string']) - || isset($this->types['array-key']) || $this->literal_string_types || $this->typed_class_strings; } diff --git a/tests/ArrayFunctionCallTest.php b/tests/ArrayFunctionCallTest.php index 47bf6e48947..65013980253 100644 --- a/tests/ArrayFunctionCallTest.php +++ b/tests/ArrayFunctionCallTest.php @@ -1297,6 +1297,22 @@ function takesString(string $string): void {} return array_map(fn ($a, $b) => [$a => $b], $as, $bs);' ], + 'allowUnpackWithArrayKey' => [ + 'one(), ...$this->two()]; + } + }' + ], ]; }