space_after_semicolon.rst 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. @@ -1,5 +1,5 @@
  21. <?php
  22. - sample(); $test = 1;
  23. - sample();$test = 2;
  24. - for ( ;;++$sample) {
  25. + sample(); $test = 1;
  26. + sample(); $test = 2;
  27. + for ( ; ; ++$sample) {
  28. }
  29. Example #2
  30. ~~~~~~~~~~
  31. With configuration: ``['remove_in_empty_for_expressions' => true]``.
  32. .. code-block:: diff
  33. --- Original
  34. +++ New
  35. @@ -1,3 +1,3 @@
  36. <?php
  37. -for ($i = 0; ; ++$i) {
  38. +for ($i = 0;; ++$i) {
  39. }
  40. Rule sets
  41. ---------
  42. The rule is part of the following rule sets:
  43. @Symfony
  44. Using the ``@Symfony`` rule set will enable the ``space_after_semicolon`` rule with the config below:
  45. ``['remove_in_empty_for_expressions' => true]``
  46. @PhpCsFixer
  47. Using the ``@PhpCsFixer`` rule set will enable the ``space_after_semicolon`` rule with the config below:
  48. ``['remove_in_empty_for_expressions' => true]``