single_line_empty_body.rst 628 B

12345678910111213141516171819202122232425262728293031323334
  1. ===============================
  2. Rule ``single_line_empty_body``
  3. ===============================
  4. Empty body of class, interface, trait, enum or function must be abbreviated as
  5. ``{}`` and placed on the same line as the previous symbol, separated by a single
  6. space.
  7. Examples
  8. --------
  9. Example #1
  10. ~~~~~~~~~~
  11. .. code-block:: diff
  12. --- Original
  13. +++ New
  14. <?php function foo(
  15. int $x
  16. -)
  17. -{
  18. -}
  19. +) {}
  20. Rule sets
  21. ---------
  22. The rule is part of the following rule sets:
  23. - `@PER <./../../ruleSets/PER.rst>`_
  24. - `@PER-CS2.0 <./../../ruleSets/PER-CS2.0.rst>`_
  25. - `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_