Skip to content

Commit 38147db

Browse files
committed
Added regression test
1 parent 8fb5645 commit 38147db

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

tests/PHPStan/Rules/Variables/ParameterOutAssignedTypeRuleTest.php

+5
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,9 @@ public function testBenevolentArrayKey(): void
6464
$this->analyse([__DIR__ . '/data/benevolent-array-key.php'], []);
6565
}
6666

67+
public function testBug12754(): void
68+
{
69+
$this->analyse([__DIR__ . '/data/bug-12754.php'], []);
70+
}
71+
6772
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
namespace Bug12754;
4+
5+
class HelloWorld
6+
{
7+
/**
8+
* @param list<array{string, string}> $list
9+
* @return void
10+
*/
11+
public function modify(array &$list): void
12+
{
13+
foreach ($list as $int => $array) {
14+
$list[$int][1] = $this->apply($array[1]);
15+
}
16+
}
17+
18+
/**
19+
* @param string $value
20+
* @return string
21+
*/
22+
public function apply(string $value): mixed
23+
{
24+
return $value;
25+
}
26+
}

0 commit comments

Comments
 (0)