empty_loop_body.rst 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. ========================
  2. Rule ``empty_loop_body``
  3. ========================
  4. Empty loop-body must be in configured style.
  5. Configuration
  6. -------------
  7. ``style``
  8. ~~~~~~~~~
  9. Style of empty loop-bodies.
  10. Allowed values: ``'braces'`` and ``'semicolon'``
  11. Default value: ``'semicolon'``
  12. Examples
  13. --------
  14. Example #1
  15. ~~~~~~~~~~
  16. *Default* configuration.
  17. .. code-block:: diff
  18. --- Original
  19. +++ New
  20. -<?php while(foo()){}
  21. +<?php while(foo());
  22. Example #2
  23. ~~~~~~~~~~
  24. With configuration: ``['style' => 'braces']``.
  25. .. code-block:: diff
  26. --- Original
  27. +++ New
  28. -<?php while(foo());
  29. +<?php while(foo()){}
  30. Rule sets
  31. ---------
  32. The rule is part of the following rule sets:
  33. - `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_
  34. - `@Symfony <./../../ruleSets/Symfony.rst>`_ with config:
  35. ``['style' => 'braces']``
  36. References
  37. ----------
  38. - Fixer class: `PhpCsFixer\\Fixer\\ControlStructure\\EmptyLoopBodyFixer <./../../../src/Fixer/ControlStructure/EmptyLoopBodyFixer.php>`_
  39. - Test class: `PhpCsFixer\\Tests\\Fixer\\ControlStructure\\EmptyLoopBodyFixerTest <./../../../tests/Fixer/ControlStructure/EmptyLoopBodyFixerTest.php>`_
  40. The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.