PHP_CodeSniffer icon indicating copy to clipboard operation
PHP_CodeSniffer copied to clipboard

Sniffs for comparison operators

Open Kifah opened this issue 7 years ago • 2 comments

I want to make sure, my code always has Identical used, when using comparison operators

so this is false: $a == $b this is correct $a === $b

so instead of re-inventing the wheel, is there some sniff available for that? I checked the available rules but was not lucky.

Kifah avatar Dec 10 '18 11:12 Kifah

@Kifah check this out: https://github.com/squizlabs/PHP_CodeSniffer/blob/master/src/Standards/Squiz/Sniffs/Operators/ComparisonOperatorUsageSniff.php

Squiz.Operators.ComparisonOperatorUsage is what you are looking for!

michalbundyra avatar Dec 10 '18 11:12 michalbundyra

thank you. I also found this: https://github.com/slevomat/coding-standard which is pretty useful as well.

Kifah avatar Dec 10 '18 11:12 Kifah