1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-21 21:31:13 +01:00

Fix #98 - add support for logical and/or

This commit is contained in:
Matthew Brown 2017-02-16 20:43:23 -05:00
parent 32dd5d5512
commit 2d58531631

View File

@ -723,7 +723,9 @@ class ExpressionChecker
) {
if ($stmt instanceof PhpParser\Node\Expr\BinaryOp\Concat && $nesting > 20) {
// ignore deeply-nested string concatenation
} elseif ($stmt instanceof PhpParser\Node\Expr\BinaryOp\BooleanAnd) {
} elseif ($stmt instanceof PhpParser\Node\Expr\BinaryOp\BooleanAnd ||
$stmt instanceof PhpParser\Node\Expr\BinaryOp\LogicalAnd
) {
$if_clauses = TypeChecker::getFormula(
$stmt->left,
$statements_checker->getFQCLN(),
@ -782,7 +784,9 @@ class ExpressionChecker
$context->vars_possibly_in_scope
);
}
} elseif ($stmt instanceof PhpParser\Node\Expr\BinaryOp\BooleanOr) {
} elseif ($stmt instanceof PhpParser\Node\Expr\BinaryOp\BooleanOr ||
$stmt instanceof PhpParser\Node\Expr\BinaryOp\LogicalOr
) {
$if_clauses = TypeChecker::getFormula(
$stmt->left,
$statements_checker->getFQCLN(),