space_after_semicolon.rst 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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]``