1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-21 21:31:13 +01:00

Fix issue evaluating negated assertion

This commit is contained in:
Matthew Brown 2018-06-03 20:24:23 -04:00
parent b5cb2b34a2
commit a20bdaef45
2 changed files with 12 additions and 4 deletions

View File

@ -1531,10 +1531,6 @@ class IfChecker
return $stmt;
}
if ($stmt instanceof PhpParser\Node\Expr\BooleanNot) {
return self::getDefinitelyEvaluatedExpression($stmt->expr);
}
return $stmt;
}
}

View File

@ -47,6 +47,18 @@ class ArgTest extends TestCase
shuffle($a);
$a = [0, 1];',
],
'correctOrderValidation' => [
'<?php
function getString(int $i) : string {
return rand(0, 1) ? "hello" : "";
}
function takesInt(int $i) : void {}
$i = rand(0, 10);
if (!($i = getString($i))) {}',
],
];
}