comment_to_phpdoc.rst 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. ==========================
  2. Rule ``comment_to_phpdoc``
  3. ==========================
  4. Comments with annotation should be docblock when used on structural elements.
  5. .. warning:: Using this rule is risky.
  6. Risky as new docblocks might mean more, e.g. a Doctrine entity might have a
  7. new column in database.
  8. Configuration
  9. -------------
  10. ``ignored_tags``
  11. ~~~~~~~~~~~~~~~~
  12. List of ignored tags
  13. Allowed types: ``array``
  14. Default value: ``[]``
  15. Examples
  16. --------
  17. Example #1
  18. ~~~~~~~~~~
  19. *Default* configuration.
  20. .. code-block:: diff
  21. --- Original
  22. +++ New
  23. @@ -1 +1 @@
  24. -<?php /* header */ $x = true; /* @var bool $isFoo */ $isFoo = true;
  25. +<?php /* header */ $x = true; /** @var bool $isFoo */ $isFoo = true;
  26. Example #2
  27. ~~~~~~~~~~
  28. With configuration: ``['ignored_tags' => ['todo']]``.
  29. .. code-block:: diff
  30. --- Original
  31. +++ New
  32. @@ -2,5 +2,5 @@
  33. // @todo do something later
  34. $foo = 1;
  35. -// @var int $a
  36. +/** @var int $a */
  37. $a = foo();
  38. Rule sets
  39. ---------
  40. The rule is part of the following rule set:
  41. @PhpCsFixer:risky
  42. Using the ``@PhpCsFixer:risky`` rule set will enable the ``comment_to_phpdoc`` rule with the default config.