slevomat / coding-standard

Slevomat Coding Standard for PHP_CodeSniffer provides many useful sniffs
MIT License
1.39k stars 171 forks source link

False negative SlevomatCodingStandard.ControlStructures.DisallowTrailingMultiLineTernaryOperator #1650

Open rmikalkenas opened 9 months ago

rmikalkenas commented 9 months ago

Hello, looks like this sniff does not report error for such cases:

function foo() {}

$a = $b === 'a' ? foo()
    : 'c';
function foo() {}

$a = $b === 'a' ? foo(
) : 'c';
kukulich commented 6 months ago

It's intentional: https://github.com/slevomat/coding-standard/commit/f02675182fca6ba88e839a9433ebf4557e356015

The actual report matches the sniff name.

Your version does make sense but it will need another sniff.