aik099 / CodingStandard

The PHP_CodeSniffer coding standard I'm using on all of my projects
BSD 3-Clause "New" or "Revised" License
5 stars 2 forks source link

Avoid excessive errors during try/catch validation #52

Closed aik099 closed 9 years ago

aik099 commented 9 years ago

Code:

try {
    1;
}catch ( Exception $e ) {
    1;
}

Errors:

--------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 1 LINE
--------------------------------------------------------------------------------
 20 | ERROR | [x] Closing brace of the "try" control structure must be last
    |       |     content on the line
    |       |     (CodingStandard.WhiteSpace.ControlStructureSpacing.LineAfterClose)
 20 | ERROR | [ ] Expected "}\ncatch (...) {\n"; found "}}catch (...) {\n"
    |       |     (CodingStandard.ControlStructures.ControlSignature)
 20 | ERROR | [x] Beginning of the "catch" control structure must be first
    |       |     content on the line
    |       |     (CodingStandard.WhiteSpace.ControlStructureSpacing.LineBeforeOpen)

Problematic place: no space before catch instead of catch placed on new line.