coding-standard icon indicating copy to clipboard operation
coding-standard copied to clipboard

False negative SlevomatCodingStandard.ControlStructures.DisallowTrailingMultiLineTernaryOperator

Open rmikalkenas opened this issue 2 years ago • 1 comments

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';

rmikalkenas avatar Jan 03 '24 05:01 rmikalkenas

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.

kukulich avatar Mar 09 '24 12:03 kukulich