switch_case_space.rst 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. ==========================
  2. Rule ``switch_case_space``
  3. ==========================
  4. Removes extra spaces between colon and case value.
  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. return 2;
  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\\SwitchCaseSpaceFixer <./../../../src/Fixer/ControlStructure/SwitchCaseSpaceFixer.php>`_
  35. - Test class: `PhpCsFixer\\Tests\\Fixer\\ControlStructure\\SwitchCaseSpaceFixerTest <./../../../tests/Fixer/ControlStructure/SwitchCaseSpaceFixerTest.php>`_
  36. The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.