Skip to content

Commit a91aa68

Browse files
committed
Create bug-14084.php
1 parent 84a3788 commit a91aa68

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Bug14084;
6+
7+
use function PHPStan\Testing\assertType;
8+
9+
/**
10+
* @param array<string, list<string>> $convert
11+
*/
12+
function example(array $convert): void
13+
{
14+
foreach ($convert as &$inner) {
15+
foreach ($inner as &$val) {
16+
$val = strtoupper($val); // https://github.com/phpstan/phpstan/issues/14083
17+
}
18+
}
19+
assertType('array<string, list<string>>', $convert);
20+
}
21+
22+
/**
23+
* @param array<string, list<string>> $convert
24+
*/
25+
function example2(array $convert): void
26+
{
27+
foreach ($convert as &$inner) {
28+
foreach ($inner as $key => $val) {
29+
$inner[$key] = strtoupper($val);
30+
}
31+
}
32+
assertType('array<string, list<string>>', $convert);
33+
}
34+
35+
/**
36+
* @param array<string, list<string>> $convert
37+
*/
38+
function example3(array &$convert): void
39+
{
40+
foreach ($convert as $outerKey => $inner) {
41+
foreach ($inner as $key => $val) {
42+
$convert[$outerKey][$key] = strtoupper($val);
43+
}
44+
}
45+
assertType('array<string, list<string>>', $convert);
46+
}

0 commit comments

Comments
 (0)