You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ phpstan a PHPStanTest.php
Note: Using configuration file phpstan.neon.dist.
1/1 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
------ -----------------------------------------------------------------------------
Line PHPStanTest.php
------ -----------------------------------------------------------------------------
18 Only iterables can be unpacked, array<int, int>|false given in argument #1.
------ -----------------------------------------------------------------------------
[ERROR] Found 1 error
Replacing self::assertNotFalse($data) with assert($data !== false) works around the problem.
The text was updated successfully, but these errors were encountered:
I have a similar problem with self::assertNotNull. Plain assert($var !== null) has the desired effect.
Shall I open a new issue or is it the same thing underneath?
public function testFoo(): void {
$items = [null, new \DateTimeImmutable()];
$var = $items[rand(0, 1)];
self::assertNotNull($var);
echo $var->format('Ymd'); // PHPStan error reported here
assert($var !== null);
echo $var->format('Ymd'); // ... but not here
}
Consider the following test:
PHPStan flags it as:
Replacing
self::assertNotFalse($data)
withassert($data !== false)
works around the problem.The text was updated successfully, but these errors were encountered: