diff --git a/src/Psalm/Internal/Visitor/ReflectorVisitor.php b/src/Psalm/Internal/Visitor/ReflectorVisitor.php index 6d2271e83..3282243bc 100644 --- a/src/Psalm/Internal/Visitor/ReflectorVisitor.php +++ b/src/Psalm/Internal/Visitor/ReflectorVisitor.php @@ -1052,6 +1052,11 @@ class ReflectorVisitor extends PhpParser\NodeVisitorAbstract implements PhpParse $rules = \Psalm\Type\Algebra::getTruthsFromFormula($negated_formula); + if (!$rules) { + $var_assertions = []; + break; + } + foreach ($rules as $var_id => $rule) { foreach ($rule as $rule_part) { if (count($rule_part) > 1) { diff --git a/tests/AssertTest.php b/tests/AssertTest.php index 7fe876b1e..5a8baa5ad 100644 --- a/tests/AssertTest.php +++ b/tests/AssertTest.php @@ -124,6 +124,28 @@ class AssertTest extends TestCase } }', ], + 'assertWithoutRedundantCondition' => [ + ' [ '