Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SpacingAfterDefaultBreak confused by multi-line statements #787

Closed
okdana opened this issue Nov 25, 2015 · 2 comments
Closed

SpacingAfterDefaultBreak confused by multi-line statements #787

okdana opened this issue Nov 25, 2015 · 2 comments

Comments

@okdana
Copy link

okdana commented Nov 25, 2015

Maybe i just don't understand its purpose, but i don't think the Squiz.ControlStructures.SwitchDeclaration.SpacingAfterDefaultBreak sniff behaves as expected wrt statements spanning multiple lines.

Test file:

<?php
switch ($foo) {
    default:
        throw new \Exception(
            'bar'
        );
}

PHPCS reports:

 4 | ERROR | [ ] Blank lines are not allowed after the DEFAULT case's
   |       |     breaking statement
   |       |     (Squiz.ControlStructures.SwitchDeclaration.SpacingAfterDefaultBreak)

Putting the statement on a single line (throw new \Exception('bar');) makes the error go away.

@gsherwood
Copy link
Member

Thanks for reporting.

@okdana
Copy link
Author

okdana commented Nov 25, 2015

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants