1.2.172. Collect Compared Literals¶
This collects the different literals (null, integers, floats, strings) that are used in comparisons.
Comparisons include all the comparison operators : <, >, <=, >=, !=, <>, ==.
This analysis also covers switch(), array_keys() and in_array().
Strict searches are omitted. So, ===, !==, match(), in_array() and array_keys() with 3rd parameter are omitted.
Some comparisons are not covered yet : sort().
<?php
// Collects '>' and 3
if ($x > 3) {
// doSomething()
}
?>
1.2.172.1. Specs¶
Short name |
Dump/DumpComparedLiterals |
Rulesets |
|
Exakat since |
2.5.3 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
High |
Available in |