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:
parent
b5cb2b34a2
commit
a20bdaef45
@ -1531,10 +1531,6 @@ class IfChecker
|
||||
return $stmt;
|
||||
}
|
||||
|
||||
if ($stmt instanceof PhpParser\Node\Expr\BooleanNot) {
|
||||
return self::getDefinitelyEvaluatedExpression($stmt->expr);
|
||||
}
|
||||
|
||||
return $stmt;
|
||||
}
|
||||
}
|
||||
|
@ -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))) {}',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user