phpinspectionsea
phpinspectionsea copied to clipboard
False Positive: It’s not safe to use "===" here: $bool == 'string'
Subject | Details |
---|---|
Plugin | Php Inspections (EA Extended) 4.0.7.1 |
Language level | PHP 8.0 |
Current behaviour
When using ==
or !=
to compare a boolean with a string, it says that you can safely use ===.
However, PHP will cast a string to a bool, and then do the comparison, so "" -> false, and "anything" -> true.
Expected behaviour
Suggestion should be to Please consider using more strict '===' here (hidden types casting will not be applied anymore).
Environment details
Build #PS-213.7172.28, built on March 17, 2022 Runtime version: 11.0.14.1+1-b1751.46 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.