1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Only complain about redundant conditions when check_variables is true

This commit is contained in:
Matt Brown 2018-04-11 14:37:01 -04:00
parent 6426dbbf0e
commit 6e6ae7aaa6

View File

@ -254,7 +254,12 @@ class IfChecker
$changed_var_ids,
$cond_referenced_var_ids,
$statements_checker,
new CodeLocation($statements_checker->getSource(), $stmt->cond, $context->include_location),
$context->check_variables
? new CodeLocation(
$statements_checker->getSource(),
$stmt->cond,
$context->include_location
) : null,
$statements_checker->getSuppressedIssues()
);
@ -293,7 +298,12 @@ class IfChecker
$changed_var_ids,
$stmt->else || $stmt->elseifs ? $cond_referenced_var_ids : [],
$statements_checker,
new CodeLocation($statements_checker->getSource(), $stmt->cond, $context->include_location),
$context->check_variables
? new CodeLocation(
$statements_checker->getSource(),
$stmt->cond,
$context->include_location
) : null,
$statements_checker->getSuppressedIssues()
);