phpinspectionsea icon indicating copy to clipboard operation
phpinspectionsea copied to clipboard

False Positive: It’s not safe to use "===" here: $bool == 'string'

Open j-applese3d opened this issue 2 years ago • 0 comments

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.

image

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.

j-applese3d avatar Mar 25 '22 22:03 j-applese3d