Skip to content

Commit ddde2ff

Browse files
committed
Added regression test
1 parent 1b109da commit ddde2ff

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

tests/PHPStan/Rules/Variables/ParameterOutAssignedTypeRuleTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,9 @@ public function testBug13093b(): void
7474
$this->analyse([__DIR__ . '/data/bug-13093b.php'], []);
7575
}
7676

77+
public function testBug12754(): void
78+
{
79+
$this->analyse([__DIR__ . '/data/bug-12754.php'], []);
80+
}
81+
7782
}

tests/PHPStan/Rules/Variables/data/bug-12330.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function alterItems(array &$options): void
1717
* @param array{items: array<int, array<string, mixed>>} $options
1818
* @param-out array{items: array<int, array<string, mixed>>} $options
1919
*/
20-
function alterItems(array &$options): void
20+
function alterItems2(array &$options): void
2121
{
2222
foreach ($options['items'] as $i => $item) {
2323
$options['items'][$i]['options']['title'] = $item['name'];
Lines changed: 26 additions & 0 deletions
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)