-
-
Notifications
You must be signed in to change notification settings - Fork 189
Closed
Labels
Description
The rule SlevomatCodingStandard.ControlStructures.EarlyExit will cause the following error at line 1 (but there is nothing on line 1), and there shouldn't be any error, the code is valid and doesn't contains any if without a curly brace
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------------------
1 | ERROR | An error occurred during processing; checking has been aborted. The error message was: "if" without curly braces is not supported.
------------------------------------------------------------------------------------------------------------------------------------------------
To reproduce:
function testBugCurly(): void
{
foreach ([1,2] as $step) {
if (1 !== 1) {
continue;
}
if (1 !== null) {
if (!match (1) {
default => 1,
}) {
}
}
}
}Strangely, adding anything (even a comment) on the last line inside foreach avoid the error. Like this :
function testBugCurly(): void
{
foreach ([1,2] as $step) {
if (1 !== 1) {
continue;
}
if (1 !== null) {
if (!match (1) {
default => 1,
}) {
}
}
// hello
}
}