Skip to content

Generic.Formatting.DisallowMultipleStatements false positive for FOR loop with no body #2994

Closed
@gmponos

Description

@gmponos

Hi,

When I run phpcs against this file https://github.com/doctrine/coding-standard/pull/208/files#diff-9023c633b2425ded52916bf44f88ede1R17

The error I get are:

  7 | ERROR | [x] Useless semicolon. (SlevomatCodingStandard.PHP.UselessSemicolon.UselessSemicolon)
 10 | ERROR | [x] Useless semicolon. (SlevomatCodingStandard.PHP.UselessSemicolon.UselessSemicolon)
 10 | ERROR | [x] Each PHP statement must be on a line by itself (Generic.Formatting.DisallowMultipleStatements.SameLine)
 15 | ERROR | [x] Useless semicolon. (SlevomatCodingStandard.PHP.UselessSemicolon.UselessSemicolon)
 17 | ERROR | [x] Whitespace found before first semicolon of FOR loop
    |       |     (Squiz.ControlStructures.ForLoopDeclaration.SpacingBeforeFirst)
 17 | ERROR | [x] Space found before semicolon; expected "0;" but found "0 ;" (Squiz.WhiteSpace.SemicolonSpacing.Incorrect)
 17 | ERROR | [x] Each PHP statement must be on a line by itself (Generic.Formatting.DisallowMultipleStatements.SameLine)
 26 | ERROR | [x] Each PHP statement must be on a line by itself (Generic.Formatting.DisallowMultipleStatements.SameLine)
 26 | ERROR | [x] Useless semicolon. (SlevomatCodingStandard.PHP.UselessSemicolon.UselessSemicolon)

I care mainly for 17 | ERROR | [x] Each PHP statement must be on a line by itself (Generic.Formatting.DisallowMultipleStatements.SameLine)

The autofix is this:

https://github.com/doctrine/coding-standard/pull/208/files#diff-df7e22f20fb934baed4dd64e4ff1cd75R17

which seems wrong.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions