operator_linebreak.rst 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. ===========================
  2. Rule ``operator_linebreak``
  3. ===========================
  4. Operators - when multiline - must always be at the beginning or at the end of
  5. the line.
  6. Configuration
  7. -------------
  8. ``only_booleans``
  9. ~~~~~~~~~~~~~~~~~
  10. Whether to limit operators to only boolean ones.
  11. Allowed types: ``bool``
  12. Default value: ``false``
  13. ``position``
  14. ~~~~~~~~~~~~
  15. Whether to place operators at the beginning or at the end of the line.
  16. Allowed values: ``'beginning'`` and ``'end'``
  17. Default value: ``'beginning'``
  18. Examples
  19. --------
  20. Example #1
  21. ~~~~~~~~~~
  22. *Default* configuration.
  23. .. code-block:: diff
  24. --- Original
  25. +++ New
  26. <?php
  27. function foo() {
  28. - return $bar ||
  29. - $baz;
  30. + return $bar
  31. + || $baz;
  32. }
  33. Example #2
  34. ~~~~~~~~~~
  35. With configuration: ``['position' => 'end']``.
  36. .. code-block:: diff
  37. --- Original
  38. +++ New
  39. <?php
  40. function foo() {
  41. - return $bar
  42. - || $baz;
  43. + return $bar ||
  44. + $baz;
  45. }
  46. Rule sets
  47. ---------
  48. The rule is part of the following rule sets:
  49. - `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_ with config:
  50. ``['only_booleans' => true]``
  51. - `@Symfony <./../../ruleSets/Symfony.rst>`_ with config:
  52. ``['only_booleans' => true]``