control_structure_continuation_position.rst 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. ================================================
  2. Rule ``control_structure_continuation_position``
  3. ================================================
  4. Control structure continuation keyword must be on the configured line.
  5. Configuration
  6. -------------
  7. ``position``
  8. ~~~~~~~~~~~~
  9. The position of the keyword that continues the control structure.
  10. Allowed values: ``'next_line'`` and ``'same_line'``
  11. Default value: ``'same_line'``
  12. Examples
  13. --------
  14. Example #1
  15. ~~~~~~~~~~
  16. *Default* configuration.
  17. .. code-block:: diff
  18. --- Original
  19. +++ New
  20. <?php
  21. if ($baz == true) {
  22. echo "foo";
  23. -}
  24. -else {
  25. +} else {
  26. echo "bar";
  27. }
  28. Example #2
  29. ~~~~~~~~~~
  30. With configuration: ``['position' => 'next_line']``.
  31. .. code-block:: diff
  32. --- Original
  33. +++ New
  34. <?php
  35. if ($baz == true) {
  36. echo "foo";
  37. -} else {
  38. +}
  39. +else {
  40. echo "bar";
  41. }
  42. Rule sets
  43. ---------
  44. The rule is part of the following rule sets:
  45. - `@PER <./../../ruleSets/PER.rst>`_
  46. - `@PER-CS1.0 <./../../ruleSets/PER-CS1.0.rst>`_
  47. - `@PER-CS2.0 <./../../ruleSets/PER-CS2.0.rst>`_
  48. - `@PSR2 <./../../ruleSets/PSR2.rst>`_
  49. - `@PSR12 <./../../ruleSets/PSR12.rst>`_
  50. - `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_
  51. - `@Symfony <./../../ruleSets/Symfony.rst>`_