phpdoc_align.rst 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. =====================
  2. Rule ``phpdoc_align``
  3. =====================
  4. All items of the given phpdoc tags must be either left-aligned or (by default)
  5. aligned vertically.
  6. Configuration
  7. -------------
  8. ``tags``
  9. ~~~~~~~~
  10. The tags that should be aligned.
  11. Allowed types: ``array``
  12. Default value: ``['method', 'param', 'property', 'return', 'throws', 'type', 'var']``
  13. ``align``
  14. ~~~~~~~~~
  15. How comments should be aligned.
  16. Allowed values: ``'left'``, ``'vertical'``
  17. Default value: ``'vertical'``
  18. Examples
  19. --------
  20. Example #1
  21. ~~~~~~~~~~
  22. *Default* configuration.
  23. .. code-block:: diff
  24. --- Original
  25. +++ New
  26. <?php
  27. /**
  28. - * @param EngineInterface $templating
  29. - * @param string $format
  30. - * @param int $code an HTTP response status code
  31. - * @param bool $debug
  32. - * @param mixed &$reference a parameter passed by reference
  33. + * @param EngineInterface $templating
  34. + * @param string $format
  35. + * @param int $code an HTTP response status code
  36. + * @param bool $debug
  37. + * @param mixed &$reference a parameter passed by reference
  38. */
  39. Example #2
  40. ~~~~~~~~~~
  41. With configuration: ``['align' => 'vertical']``.
  42. .. code-block:: diff
  43. --- Original
  44. +++ New
  45. <?php
  46. /**
  47. - * @param EngineInterface $templating
  48. - * @param string $format
  49. - * @param int $code an HTTP response status code
  50. - * @param bool $debug
  51. - * @param mixed &$reference a parameter passed by reference
  52. + * @param EngineInterface $templating
  53. + * @param string $format
  54. + * @param int $code an HTTP response status code
  55. + * @param bool $debug
  56. + * @param mixed &$reference a parameter passed by reference
  57. */
  58. Example #3
  59. ~~~~~~~~~~
  60. With configuration: ``['align' => 'left']``.
  61. .. code-block:: diff
  62. --- Original
  63. +++ New
  64. <?php
  65. /**
  66. - * @param EngineInterface $templating
  67. - * @param string $format
  68. - * @param int $code an HTTP response status code
  69. - * @param bool $debug
  70. - * @param mixed &$reference a parameter passed by reference
  71. + * @param EngineInterface $templating
  72. + * @param string $format
  73. + * @param int $code an HTTP response status code
  74. + * @param bool $debug
  75. + * @param mixed &$reference a parameter passed by reference
  76. */
  77. Rule sets
  78. ---------
  79. The rule is part of the following rule sets:
  80. @PhpCsFixer
  81. Using the `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_ rule set will enable the ``phpdoc_align`` rule with the default config.
  82. @Symfony
  83. Using the `@Symfony <./../../ruleSets/Symfony.rst>`_ rule set will enable the ``phpdoc_align`` rule with the default config.