Skip to content
Permalink
Browse files

Skip descendants if required class in && expr cannot be found

Fixes #2375
  • Loading branch information
muglug committed Nov 27, 2019
1 parent c75f7dc commit 1b850c4026cfe39ca23b932974bc960d7169f6b2
Showing with 10 additions and 0 deletions.
  1. +10 −0 src/Psalm/Internal/Visitor/ReflectorVisitor.php
@@ -524,6 +524,16 @@ public function enterNode(PhpParser\Node $node)
)
) {
$this->exists_cond_expr = $node->cond;
} elseif ($node->cond instanceof PhpParser\Node\Expr\BinaryOp\BooleanAnd
&& $node->cond->left instanceof PhpParser\Node\Expr\FuncCall
&& $node->cond->left->name instanceof PhpParser\Node\Name
&& (
$node->cond->left->name->parts === ['function_exists']
|| $node->cond->left->name->parts === ['class_exists']
|| $node->cond->left->name->parts === ['interface_exists']
)
) {
$this->exists_cond_expr = $node->cond->left;
}
}

0 comments on commit 1b850c4

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