space_after_semicolon.rst 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. ==============================
  2. Rule ``space_after_semicolon``
  3. ==============================
  4. Fix whitespace after a semicolon.
  5. Configuration
  6. -------------
  7. ``remove_in_empty_for_expressions``
  8. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  9. Whether spaces should be removed for empty ``for`` expressions.
  10. Allowed types: ``bool``
  11. Default value: ``false``
  12. Examples
  13. --------
  14. Example #1
  15. ~~~~~~~~~~
  16. *Default* configuration.
  17. .. code-block:: diff
  18. --- Original
  19. +++ New
  20. <?php
  21. - sample(); $test = 1;
  22. - sample();$test = 2;
  23. - for ( ;;++$sample) {
  24. + sample(); $test = 1;
  25. + sample(); $test = 2;
  26. + for ( ; ; ++$sample) {
  27. }
  28. Example #2
  29. ~~~~~~~~~~
  30. With configuration: ``['remove_in_empty_for_expressions' => true]``.
  31. .. code-block:: diff
  32. --- Original
  33. +++ New
  34. <?php
  35. -for ($i = 0; ; ++$i) {
  36. +for ($i = 0;; ++$i) {
  37. }
  38. Rule sets
  39. ---------
  40. The rule is part of the following rule sets:
  41. - `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_ with config:
  42. ``['remove_in_empty_for_expressions' => true]``
  43. - `@Symfony <./../../ruleSets/Symfony.rst>`_ with config:
  44. ``['remove_in_empty_for_expressions' => true]``
  45. References
  46. ----------
  47. - Fixer class: `PhpCsFixer\\Fixer\\Semicolon\\SpaceAfterSemicolonFixer <./../../../src/Fixer/Semicolon/SpaceAfterSemicolonFixer.php>`_
  48. - Test class: `PhpCsFixer\\Tests\\Fixer\\Semicolon\\SpaceAfterSemicolonFixerTest <./../../../tests/Fixer/Semicolon/SpaceAfterSemicolonFixerTest.php>`_
  49. The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.