multiline_whitespace_before_semicolons.rst 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. ===============================================
  2. Rule ``multiline_whitespace_before_semicolons``
  3. ===============================================
  4. Forbid multi-line whitespace before the closing semicolon or move the semicolon
  5. to the new line for chained calls.
  6. Configuration
  7. -------------
  8. ``strategy``
  9. ~~~~~~~~~~~~
  10. Forbid multi-line whitespace or move the semicolon to the new line for chained
  11. calls.
  12. Allowed values: ``'new_line_for_chained_calls'`` and ``'no_multi_line'``
  13. Default value: ``'no_multi_line'``
  14. Examples
  15. --------
  16. Example #1
  17. ~~~~~~~~~~
  18. *Default* configuration.
  19. .. code-block:: diff
  20. --- Original
  21. +++ New
  22. <?php
  23. function foo() {
  24. - return 1 + 2
  25. - ;
  26. + return 1 + 2;
  27. }
  28. Example #2
  29. ~~~~~~~~~~
  30. With configuration: ``['strategy' => 'new_line_for_chained_calls']``.
  31. .. code-block:: diff
  32. --- Original
  33. +++ New
  34. <?php
  35. $object->method1()
  36. ->method2()
  37. - ->method(3);
  38. + ->method(3)
  39. +;
  40. Rule sets
  41. ---------
  42. The rule is part of the following rule set:
  43. - `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_ with config:
  44. ``['strategy' => 'new_line_for_chained_calls']``
  45. References
  46. ----------
  47. - Fixer class: `PhpCsFixer\\Fixer\\Semicolon\\MultilineWhitespaceBeforeSemicolonsFixer <./../../../src/Fixer/Semicolon/MultilineWhitespaceBeforeSemicolonsFixer.php>`_
  48. - Test class: `PhpCsFixer\\Tests\\Fixer\\Semicolon\\MultilineWhitespaceBeforeSemicolonsFixerTest <./../../../tests/Fixer/Semicolon/MultilineWhitespaceBeforeSemicolonsFixerTest.php>`_
  49. The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.