switch_case_semicolon_to_colon.rst 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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-CS <./../../ruleSets/PER-CS.rst>`_
  26. - `@PER-CS1.0 <./../../ruleSets/PER-CS1.0.rst>`_
  27. - `@PER-CS2.0 <./../../ruleSets/PER-CS2.0.rst>`_
  28. - `@PSR2 <./../../ruleSets/PSR2.rst>`_
  29. - `@PSR12 <./../../ruleSets/PSR12.rst>`_
  30. - `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_
  31. - `@Symfony <./../../ruleSets/Symfony.rst>`_
  32. References
  33. ----------
  34. - Fixer class: `PhpCsFixer\\Fixer\\ControlStructure\\SwitchCaseSemicolonToColonFixer <./../../../src/Fixer/ControlStructure/SwitchCaseSemicolonToColonFixer.php>`_
  35. - Test class: `PhpCsFixer\\Tests\\Fixer\\ControlStructure\\SwitchCaseSemicolonToColonFixerTest <./../../../tests/Fixer/ControlStructure/SwitchCaseSemicolonToColonFixerTest.php>`_
  36. The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.