Skip to content

Commit 113c7d4

Browse files
committed
test void can be null
1 parent 0560ae2 commit 113c7d4

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/PHPStan/Analyser/nsrt/bug-12393b.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,24 @@ public function doBar(): void
297297
}
298298
}
299299

300+
class FooVoidInt {
301+
private ?int $foo;
302+
private int $fooNonNull;
303+
304+
public function doFoo(): void {
305+
$this->foo = $this->returnVoid();
306+
assertType('null', $this->foo);
307+
308+
$this->fooNonNull = $this->returnVoid();
309+
assertType('null', $this->foo); // should be *ERROR*
310+
}
311+
312+
public function returnVoid(): void {
313+
return;
314+
}
315+
}
316+
317+
300318
class FooBoolString
301319
{
302320

0 commit comments

Comments
 (0)