align_multiline_comment.rst 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. ================================
  2. Rule ``align_multiline_comment``
  3. ================================
  4. Each line of multi-line DocComments must have an asterisk [PSR-5] and must be
  5. aligned with the first one.
  6. Configuration
  7. -------------
  8. ``comment_type``
  9. ~~~~~~~~~~~~~~~~
  10. Whether to fix PHPDoc comments only (``phpdocs_only``), any multi-line comment
  11. whose lines all start with an asterisk (``phpdocs_like``) or any multi-line
  12. comment (``all_multiline``).
  13. Allowed values: ``'all_multiline'``, ``'phpdocs_like'`` and ``'phpdocs_only'``
  14. Default value: ``'phpdocs_only'``
  15. Examples
  16. --------
  17. Example #1
  18. ~~~~~~~~~~
  19. *Default* configuration.
  20. .. code-block:: diff
  21. --- Original
  22. +++ New
  23. <?php
  24. /**
  25. - * This is a DOC Comment
  26. -with a line not prefixed with asterisk
  27. -
  28. - */
  29. + * This is a DOC Comment
  30. + * with a line not prefixed with asterisk
  31. + *
  32. + */
  33. Example #2
  34. ~~~~~~~~~~
  35. With configuration: ``['comment_type' => 'phpdocs_like']``.
  36. .. code-block:: diff
  37. --- Original
  38. +++ New
  39. <?php
  40. /*
  41. - * This is a doc-like multiline comment
  42. -*/
  43. + * This is a doc-like multiline comment
  44. + */
  45. Example #3
  46. ~~~~~~~~~~
  47. With configuration: ``['comment_type' => 'all_multiline']``.
  48. .. code-block:: diff
  49. --- Original
  50. +++ New
  51. <?php
  52. /*
  53. - * This is a doc-like multiline comment
  54. + * This is a doc-like multiline comment
  55. with a line not prefixed with asterisk
  56. - */
  57. + */
  58. Rule sets
  59. ---------
  60. The rule is part of the following rule sets:
  61. - `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_
  62. - `@Symfony <./../../ruleSets/Symfony.rst>`_