diff --git a/src/Standards/Generic/Sniffs/ControlStructures/InlineControlStructureSniff.php b/src/Standards/Generic/Sniffs/ControlStructures/InlineControlStructureSniff.php index d48a477ce1..19a58833be 100644 --- a/src/Standards/Generic/Sniffs/ControlStructures/InlineControlStructureSniff.php +++ b/src/Standards/Generic/Sniffs/ControlStructures/InlineControlStructureSniff.php @@ -142,8 +142,10 @@ public function process(File $phpcsFile, $stackPtr) return; } - if ($tokens[$nextNonEmpty]['code'] === T_COLON) { - // Alternative control structure. + if ($tokens[$nextNonEmpty]['code'] === T_OPEN_CURLY_BRACKET + || $tokens[$nextNonEmpty]['code'] === T_COLON + ) { + // T_CLOSE_CURLY_BRACKET missing, or alternative control structure with // T_END... missing. Either live coding, parse error or end // tag in short open tags and scan run with short_open_tag=Off. // Bow out completely as any further detection will be unreliable