Skip to content

Commit 09645b1

Browse files
committed
added regression test
1 parent cebec02 commit 09645b1

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

tests/PHPStan/Rules/Arrays/NonexistentOffsetInArrayDimFetchRuleTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,4 +1113,12 @@ public function testBug12805(): void
11131113
$this->analyse([__DIR__ . '/data/bug-12805.php'], []);
11141114
}
11151115

1116+
public function testBug6209(): void
1117+
{
1118+
$this->checkExplicitMixed = true;
1119+
$this->checkImplicitMixed = false;
1120+
1121+
$this->analyse([__DIR__ . '/data/bug-6209.php'], []);
1122+
}
1123+
11161124
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
namespace Bug6209;
4+
5+
/**
6+
* @param mixed[] $values
7+
* @return mixed[]
8+
*/
9+
function apply(array $values): array
10+
{
11+
if (!array_key_exists('key', $values)) {
12+
$values['key'][] = 'any';
13+
}
14+
15+
return $values;
16+
}

0 commit comments

Comments
 (0)