Skip to content

Commit

Permalink
Fix #4206 - add shortcut for if ((bool) $foo)
Browse files Browse the repository at this point in the history
  • Loading branch information
muglug committed Sep 19, 2020
1 parent 0ae436d commit 62d4381
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/Psalm/Type/Algebra.php
Expand Up @@ -345,6 +345,19 @@ public static function getFormula(
}
}

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) {
Expand Down

0 comments on commit 62d4381

Please sign in to comment.