switch_continue_to_break.rst 939 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. =================================
  2. Rule ``switch_continue_to_break``
  3. =================================
  4. Switch case must not be ended with ``continue`` but with ``break``.
  5. Examples
  6. --------
  7. Example #1
  8. ~~~~~~~~~~
  9. .. code-block:: diff
  10. --- Original
  11. +++ New
  12. <?php
  13. switch ($foo) {
  14. case 1:
  15. - continue;
  16. + break;
  17. }
  18. Example #2
  19. ~~~~~~~~~~
  20. .. code-block:: diff
  21. --- Original
  22. +++ New
  23. <?php
  24. switch ($foo) {
  25. case 1:
  26. while($bar) {
  27. do {
  28. - continue 3;
  29. + break 3;
  30. } while(false);
  31. if ($foo + 1 > 3) {
  32. continue;
  33. }
  34. - continue 2;
  35. + break 2;
  36. }
  37. }
  38. Rule sets
  39. ---------
  40. The rule is part of the following rule sets:
  41. - `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_
  42. - `@Symfony <./../../ruleSets/Symfony.rst>`_