Moxio/php-codesniffer-sniffs

DisallowImplicitLooseComparisonSniff does not work for short-array syntax

ondrejmirtes opened this issue · 1 comments

Hi,
the DisallowImplicitLooseComparisonSniff does not detect this case:

if (in_array($str, ['a', 'b', 'c'])) {

}

Because something goes wrong when counting the nested parentheses inside AbstractFunctionCallSniff. I'm not able to fix this, mainly because these sniffs do not have any tests and I'm afraid I'd break something :(

aboks commented

This issue is now fixed in version 1.1.1. I also added some tests in the process.

Thanks for reporting this issue!