Given the following sniff configuration:
<rule ref="SlevomatCodingStandard.ControlStructures.RequireMultiLineTernaryOperator">
<properties>
<property name="lineLengthLimit" value="100"/>
</properties>
</rule>
and the following test file/code:
<?php
declare(strict_types=1);
class PHPTest {
public static function testPhpCs(): void {
$config = isset($_GET['config']);
?>
<a href="?">
<?=$config ? 'Hide' : 'Show'?> Configuration
</a>
<?php
echo '';
}
}
Expected result: no error
Actual result:
The false-positive shows up depending on the terminating semicolon after the ternary. Without it, PHPCS scan until the next ; in the code which commonly exceeds the configured line limit.
However, in PHP the closing tag has the same function as a semicolon (statement terminator).