switch_case_semicolon_to_colon.rst 821 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. =======================================
  2. Rule ``switch_case_semicolon_to_colon``
  3. =======================================
  4. A case should be followed by a colon and not a semicolon.
  5. Examples
  6. --------
  7. Example #1
  8. ~~~~~~~~~~
  9. .. code-block:: diff
  10. --- Original
  11. +++ New
  12. <?php
  13. switch ($a) {
  14. - case 1;
  15. + case 1:
  16. break;
  17. - default;
  18. + default:
  19. break;
  20. }
  21. Rule sets
  22. ---------
  23. The rule is part of the following rule sets:
  24. - `@PER <./../../ruleSets/PER.rst>`_
  25. - `@PER-CS1.0 <./../../ruleSets/PER-CS1.0.rst>`_
  26. - `@PER-CS2.0 <./../../ruleSets/PER-CS2.0.rst>`_
  27. - `@PSR2 <./../../ruleSets/PSR2.rst>`_
  28. - `@PSR12 <./../../ruleSets/PSR12.rst>`_
  29. - `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_
  30. - `@Symfony <./../../ruleSets/Symfony.rst>`_