Skip to content

Commit c6da45b

Browse files
staabmondrejmirtes
authored andcommittedOct 22, 2022
added regression test
1 parent d9fe729 commit c6da45b

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed
 

‎tests/PHPStan/Analyser/NodeScopeResolverTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -1091,6 +1091,7 @@ public function dataFileAsserts(): iterable
10911091
yield from $this->gatherAssertTypes(__DIR__ . '/../Rules/Comparison/data/bug-8169.php');
10921092
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-7519.php');
10931093
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-8087.php');
1094+
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-5785.php');
10941095
}
10951096

10961097
/**
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace Bug5785;
4+
5+
use function PHPStan\Testing\assertType;
6+
7+
class HelloWorld
8+
{
9+
}
10+
11+
class IterableHelper
12+
{
13+
/**
14+
* @template T
15+
* @param iterable<T> $iterable
16+
* @param-out iterable<T> $iterable
17+
*/
18+
public static function act(iterable &$iterable): void
19+
{
20+
}
21+
}
22+
23+
function doFoo() {
24+
/** @var HelloWorld[] $a */
25+
$a = [];
26+
27+
assertType('array<Bug5785\HelloWorld>', $a);
28+
IterableHelper::act($a);
29+
assertType('iterable<Bug5785\HelloWorld>', $a);
30+
31+
}
32+
33+

0 commit comments

Comments
 (0)
Please sign in to comment.