Skip to content

Commit

Permalink
Fix #2852 - no duplicatearraykey warning for non string-keyed arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
muglug committed Feb 21, 2020
1 parent 9bdca3c commit d8b6467
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/Psalm/Type/Union.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
16 changes: 16 additions & 0 deletions tests/ArrayFunctionCallTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1297,6 +1297,22 @@ function takesString(string $string): void {}
return array_map(fn ($a, $b) => [$a => $b], $as, $bs);'
],
'allowUnpackWithArrayKey' => [
'<?php
class Foo {
protected function one(): array {
return [];
}
protected function two(): array {
return [];
}
public function three(): array {
return [...$this->one(), ...$this->two()];
}
}'
],
];
}

Expand Down

0 comments on commit d8b6467

Please sign in to comment.