Bug report
phpstan/phpstan 0.12.80
phpstan/phpstan-phpunit 0.12.17
phpstan/phpstan-strict-rules 0.12.9
phpstan/phpstan-webmozart-assert 0.12.12
$value = null;
$callback = function () use (&$value) : void {
$value = new DateTime();
};
$callback();
// phpstan: Call to static method Webmozart\Assert\Assert::notNull() with DateTime|null will always evaluate to false.
\Webmozart\Assert\Assert::notNull($value);
Same happens when using PHPUnit's $this->assertNotNull($command); together with phpstan/phpstan-phpunit. So I believe this is not a webmozart / phpunit extension issue.
// phpstan: Call to method PHPUnit\Framework\Assert::assertNotNull() with DateTime|null will always evaluate to false.
$this->assertNotNull($value);
It's interesting because the error correctly says $value is DateTime|null.
Code snippet that reproduces the problem
Not possible as phpstan/phpstan-webmozart-assert is not installed. It would be great if the official extensions could be enabled on the playground.
Expected output
No error.