Steps to replicate the issue (include links if applicable):
Create a PHP file with the following content:
<?php class Weird { /** @var ?array */ public $stuff; } class TestPhan { public function doStuff( Weird $w ) { if ( $w->stuff !== null ) { $this->doSubStuff( $w->stuff ); } } private function doSubStuff( array $arg ) { //nop } }
Run phan on it.
What happens?:
Phan returns TestPhan.php:12 PhanTypeMismatchArgumentNullable Argument 1 ($arg) is $w->stuff of type ?array but \TestPhan::doSubStuff() takes array defined at TestPhan.php:16 (expected type to be non-nullable) despite the check on the line above that it's not null.
What should have happened instead?:
$w->stuff should not be detected as being possibly null.