Skip to content
Permalink
Browse files

Fix #1985 - prevent complicatedExpressionException from breaking anal…

…ysis
  • Loading branch information...
muglug committed Aug 7, 2019
1 parent 16a1dc8 commit 50bd18c40463d899f9ce36daeb80462db21bda34
Showing with 15 additions and 6 deletions.
  1. +15 −6 src/Psalm/Internal/Analyzer/Statements/Block/IfAnalyzer.php
@@ -989,8 +989,13 @@ function (Clause $c) use ($conditional_assigned_var_ids) {
)
);
$reconcilable_elseif_types = Algebra::getTruthsFromFormula($elseif_context->clauses);
$negated_elseif_types = Algebra::getTruthsFromFormula(Algebra::negateFormula($elseif_clauses));
try {
$reconcilable_elseif_types = Algebra::getTruthsFromFormula($elseif_context->clauses);
$negated_elseif_types = Algebra::getTruthsFromFormula(Algebra::negateFormula($elseif_clauses));
} catch (\Psalm\Exception\ComplicatedExpressionException $e) {
$reconcilable_elseif_types = [];
$negated_elseif_types = [];
}
$all_negated_vars = array_unique(
array_merge(
@@ -1303,10 +1308,14 @@ function (Clause $c) use ($conditional_assigned_var_ids) {
$outer_context->mergeExceptions($elseif_context);
}
$if_scope->negated_clauses = array_merge(
$if_scope->negated_clauses,
Algebra::negateFormula($elseif_clauses)
);
try {
$if_scope->negated_clauses = array_merge(
$if_scope->negated_clauses,
Algebra::negateFormula($elseif_clauses)
);
} catch (\Psalm\Exception\ComplicatedExpressionException $e) {
$if_scope->negated_clauses = [];
}
}
/**

0 comments on commit 50bd18c

Please sign in to comment.
You can’t perform that action at this time.