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

Fall-through false-positive on cases that contains a throw #2101

Closed
Taluu opened this issue Jul 26, 2018 · 2 comments
Closed

Fall-through false-positive on cases that contains a throw #2101

Taluu opened this issue Jul 26, 2018 · 2 comments

Comments

@Taluu
Copy link

Taluu commented Jul 26, 2018

For the given code :

<?php
//...
switch ($content) {
     case 'foo':
          throw new ...;
     case 'bar':
          // ...
}

I have the warning that says that there should be a comment line saying the fall-through is intentional.... But a throw interrupts the case anyway (unless it is caught in the same block, which is not the case here). It seems the sames goes for a return.

Adding a break or a fall-through comments is over-kill as it will never be reached...

@Taluu
Copy link
Author

Taluu commented Jul 26, 2018

More or less a duplicate of #834. Feel free to close and continue in this issue.

@Taluu
Copy link
Author

Taluu commented Jul 26, 2018

Nevermind, it's because I was in a nested switch which needed the comment / break. Closing.

@Taluu Taluu closed this as completed Jul 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant