align_multiline_comment.rst 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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'``, ``'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. @@ -1,6 +1,6 @@
  24. <?php
  25. /**
  26. - * This is a DOC Comment
  27. -with a line not prefixed with asterisk
  28. -
  29. - */
  30. + * This is a DOC Comment
  31. + * with a line not prefixed with asterisk
  32. + *
  33. + */
  34. Example #2
  35. ~~~~~~~~~~
  36. With configuration: ``['comment_type' => 'phpdocs_like']``.
  37. .. code-block:: diff
  38. --- Original
  39. +++ New
  40. @@ -1,4 +1,4 @@
  41. <?php
  42. /*
  43. - * This is a doc-like multiline comment
  44. -*/
  45. + * This is a doc-like multiline comment
  46. + */
  47. Example #3
  48. ~~~~~~~~~~
  49. With configuration: ``['comment_type' => 'all_multiline']``.
  50. .. code-block:: diff
  51. --- Original
  52. +++ New
  53. @@ -1,6 +1,6 @@
  54. <?php
  55. /*
  56. - * This is a doc-like multiline comment
  57. + * This is a doc-like multiline comment
  58. with a line not prefixed with asterisk
  59. - */
  60. + */
  61. Rule sets
  62. ---------
  63. The rule is part of the following rule set:
  64. @PhpCsFixer
  65. Using the ``@PhpCsFixer`` rule set will enable the ``align_multiline_comment`` rule with the default config.