This rule raises an issue when a constant expression is used as a condition in an if, elif, a conditional expression or
other boolean expressions.
When a constant is used as a condition, either it has no effect on the execution flow and it can be removed, or some code will never be executed and it is a bug.
function foo() {
if (true) { // Noncompliant: the condition is always true
return 1;
} else {
return 2;
}
}
function foo() {
$a = bar();
if ($a) {
return 1;
} else {
return 2;
}
}