1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-23 06:11:25 +01:00

Fix #4206 - add shortcut for if ((bool) $foo)

This commit is contained in:
Brown 2020-09-19 18:15:12 -04:00 committed by Daniil Gentili
parent ec64ae930a
commit 5302936e76
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7

View File

@ -345,6 +345,19 @@ class Algebra
}
}
if ($conditional instanceof PhpParser\Node\Expr\Cast\Bool_) {
return self::getFormula(
$conditional_object_id,
\spl_object_id($conditional->expr),
$conditional->expr,
$this_class_name,
$source,
$codebase,
$inside_negation,
$cache
);
}
$assertions = null;
if ($cache && $source instanceof \Psalm\Internal\Analyzer\StatementsAnalyzer) {