I've inherited a large codebase that almost exclusively uses loose comparisons:
$foo = 1
$bar = "1"
if ($foo == $bar)
{
doThing();
}
In some cases, this has led to bugs.
I know that I could switch all of the ==
operands to ===
, but I'm afraid that that could cause new issues that remain unnoticed until the code gets pushed to the production environment. Obviously that would be very bad.
Is there some global setting that I can enable to make PHP produce warnings when comparing two different types?