File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -173,6 +173,7 @@ public function dataFileAsserts(): iterable
173173yield from $ this ->gatherAssertTypes (__DIR__ . '/data/bug-3875.php ' );
174174yield from $ this ->gatherAssertTypes (__DIR__ . '/data/bug-2611.php ' );
175175yield from $ this ->gatherAssertTypes (__DIR__ . '/data/bug-3548.php ' );
176+ yield from $ this ->gatherAssertTypes (__DIR__ . '/data/bug-10131.php ' );
176177yield from $ this ->gatherAssertTypes (__DIR__ . '/data/bug-3866.php ' );
177178yield from $ this ->gatherAssertTypes (__DIR__ . '/data/bug-1014.php ' );
178179yield from $ this ->gatherAssertTypes (__DIR__ . '/data/bug-pr-339.php ' );
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Bug10131 ;
4+
5+ use function PHPStan \Testing \assertType ;
6+
7+ class A {
8+ }
9+
10+ class B {
11+ public A |null $ a = null ;
12+ }
13+
14+ /**
15+ * @phpstan-return array{0:A|null, 1:B|null}
16+ */
17+ function foo (A |null $ a , B |null $ b ): array
18+ {
19+ $ a ??= $ b ?->a ?? throw new \Exception ();
20+
21+ assertType (A::class, $ a );
22+ assertType (B::class . '|null ' , $ b );
23+
24+ return [$ a , $ b ];
25+ }
You can’t perform that action at this time.
0 commit comments