From d8b6467b1a1e64065430d05e50e6a3b23370442f Mon Sep 17 00:00:00 2001 From: Matthew Brown Date: Fri, 21 Feb 2020 01:27:42 -0500 Subject: [PATCH] Fix #2852 - no duplicatearraykey warning for non string-keyed arrays --- src/Psalm/Type/Union.php | 1 - tests/ArrayFunctionCallTest.php | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) 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()]; + } + }' + ], ]; }