1.2.205. Comparison On Different Types¶
This rule reports comparisons and spaceship operator that are used with distinct types. When the types are distinct, PHP apply silent type juggling, and it may result in unexpected results.
<?php
1 == 'a';
?>
1.2.205.1. Suggestions¶
Ensure both operands are using the same type.
1.2.205.2. Specs¶
Short name |
Php/ComparisonOnDifferentTypes |
Rulesets |
|
Exakat since |
2.5.3 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
Medium |
Available in |