phpdoc_to_comment.rst 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. ==========================
  2. Rule ``phpdoc_to_comment``
  3. ==========================
  4. Docblocks should only be used on structural elements.
  5. Configuration
  6. -------------
  7. ``ignored_tags``
  8. ~~~~~~~~~~~~~~~~
  9. List of ignored tags (matched case insensitively)
  10. Allowed types: ``array``
  11. Default value: ``[]``
  12. Examples
  13. --------
  14. Example #1
  15. ~~~~~~~~~~
  16. *Default* configuration.
  17. .. code-block:: diff
  18. --- Original
  19. +++ New
  20. <?php
  21. $first = true;// needed because by default first docblock is never fixed.
  22. -/** This should be a comment */
  23. +/* This should be a comment */
  24. foreach($connections as $key => $sqlite) {
  25. $sqlite->open($path);
  26. }
  27. Example #2
  28. ~~~~~~~~~~
  29. With configuration: ``['ignored_tags' => ['todo']]``.
  30. .. code-block:: diff
  31. --- Original
  32. +++ New
  33. <?php
  34. $first = true;// needed because by default first docblock is never fixed.
  35. -/** This should be a comment */
  36. +/* This should be a comment */
  37. foreach($connections as $key => $sqlite) {
  38. $sqlite->open($path);
  39. }
  40. /** @todo This should be a PHPDoc as the tag is on "ignored_tags" list */
  41. foreach($connections as $key => $sqlite) {
  42. $sqlite->open($path);
  43. }
  44. Rule sets
  45. ---------
  46. The rule is part of the following rule sets:
  47. @PhpCsFixer
  48. Using the `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_ rule set will enable the ``phpdoc_to_comment`` rule with the default config.
  49. @Symfony
  50. Using the `@Symfony <./../../ruleSets/Symfony.rst>`_ rule set will enable the ``phpdoc_to_comment`` rule with the default config.