1.2.537. Identical On Both Sides¶
Operands should be different when comparing or making a logical combination. Of course, the value each operand holds may be identical. When the same operand appears on both sides of the expression, the result is know before execution.
<?php
// Trying to confirm consistency
if ($login == $login) {
doSomething();
}
// Works with every operators
if ($object->login( ) !== $object->login()) {
doSomething();
}
if ($sum >= $sum) {
doSomething();
}
//
if ($mask && $mask) {
doSomething();
}
if ($mask || $mask) {
doSomething();
}
?>
1.2.537.1. Suggestions¶
Remove one of the alternative, and remove the logical link
Modify one of the alternative, and make it different from the other
1.2.537.2. Specs¶
Short name |
Structures/IdenticalOnBothSides |
Rulesets |
|
Exakat since |
1.0.8 |
PHP Version |
All |
Severity |
Major |
Time To Fix |
Quick (30 mins) |
Precision |
Very high |
Features |
if-then |
Examples |
|
Available in |