File tree Expand file tree Collapse file tree
tests/PHPStan/Analyser/nsrt Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments