Skip to content

Commit a14e962

Browse files
committed
Add regression test for #10172
Closes phpstan/phpstan#10172
1 parent 3afcdd8 commit a14e962

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

tests/PHPStan/Rules/Methods/ReturnTypeRuleTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,4 +1310,9 @@ public function testBug9669(): void
13101310
$this->analyse([__DIR__ . '/data/bug-9669.php'], []);
13111311
}
13121312

1313+
public function testBug10172(): void
1314+
{
1315+
$this->analyse([__DIR__ . '/data/bug-10172.php'], []);
1316+
}
1317+
13131318
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace Bug10172;
4+
5+
class HelloWorld
6+
{
7+
/**
8+
* @template T of array{data: array<mixed>}
9+
*
10+
* @param T $a
11+
*
12+
* @return T
13+
*/
14+
public function foo(array $a): array
15+
{
16+
foreach ($a['data'] as $i) {
17+
}
18+
19+
return $a;
20+
}
21+
}

0 commit comments

Comments
 (0)