1.2.1182. Suspicious Comparison¶
The comparison seems to be misplaced.
A comparison happens in the last argument, while the actual function expect another type : this may be the case of a badly placed parenthesis. Original idea by Vladimir Reznichenko.
<?php
// trim expect a string, a boolean is given.
if (trim($str === '')){
}
// Just move the first closing parenthesis to give back its actual meaning
if (trim($str) === ''){
}
?>
1.2.1182.1. Connex PHP features¶
1.2.1182.1.1. Suggestions¶
Remove the comparison altogether
Move the comparison to its right place : that, or more the parenthesis.
This may be what is intended : just leave it.
1.2.1182.1.2. Specs¶
Short name |
Structures/SuspiciousComparison |
Rulesets |
|
Exakat since |
0.11.0 |
PHP Version |
All |
Severity |
Major |
Time To Fix |
Instant (5 mins) |
Precision |
Very high |
Examples |
|
Available in |