As title says. I am looking for a rule similar to eslint's eqeqeq, but for PHP. I would want to enforce the use of ===/!== instead of ==/!=.
I have tried googling and searched through their repo as well, but unfortunately to no avail. Just wanna ask here if someone knows of a rule that I have missed before I open an issue on Github :)
Try including the Squiz.Operators.ComparisonOperatorUsage sniff. It enforces strict type comparisons, including banning the use of !$foo in favour of === false.
It also bans implicit true comparisons, so you can't do something like if ($foo), but you can disable that by excluding the Squiz.Operators.ComparisonOperatorUsage.ImplicitTrue error code if that it too strict for your standard.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With