Skip to content

Commit 536dc88

Browse files
committed
more tests
1 parent c6c286d commit 536dc88

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

tests/PHPStan/Rules/Arrays/DuplicateKeysInLiteralArraysRuleTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ public function testDuplicateKeys(): void
8989
"Array has 2 duplicate keys with value 'bar' ('bar', \$key).",
9090
152,
9191
],
92+
[
93+
"Array has 2 duplicate keys with value 'baz' (\$key, 'baz').",
94+
171,
95+
],
9296
]);
9397
}
9498

tests/PHPStan/Rules/Arrays/data/duplicate-keys.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,4 +154,22 @@ public function sureDuplicate3(string $key): void
154154
];
155155
}
156156

157+
/**
158+
* @param 'foo'|'bar'|'baz' $key
159+
*/
160+
public function sureDuplicate4(string $key): void
161+
{
162+
$a = [
163+
'foo' => 'foo',
164+
'bar' => 'bar',
165+
$key => 'foo|bar',
166+
];
167+
168+
$b = [
169+
'foo' => 'foo',
170+
'bar' => 'bar',
171+
$key => 'foo|bar',
172+
'baz' => 'baz',
173+
];
174+
}
157175
}

0 commit comments

Comments
 (0)