comment_to_phpdoc.rst 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. ==========================
  2. Rule ``comment_to_phpdoc``
  3. ==========================
  4. Comments with annotation should be docblock when used on structural elements.
  5. Warning
  6. -------
  7. Using this rule is risky
  8. ~~~~~~~~~~~~~~~~~~~~~~~~
  9. Risky as new docblocks might mean more, e.g. a Doctrine entity might have a new
  10. column in database.
  11. Configuration
  12. -------------
  13. ``ignored_tags``
  14. ~~~~~~~~~~~~~~~~
  15. List of ignored tags.
  16. Allowed types: ``list<string>``
  17. Default value: ``[]``
  18. Examples
  19. --------
  20. Example #1
  21. ~~~~~~~~~~
  22. *Default* configuration.
  23. .. code-block:: diff
  24. --- Original
  25. +++ New
  26. -<?php /* header */ $x = true; /* @var bool $isFoo */ $isFoo = true;
  27. +<?php /* header */ $x = true; /** @var bool $isFoo */ $isFoo = true;
  28. Example #2
  29. ~~~~~~~~~~
  30. With configuration: ``['ignored_tags' => ['todo']]``.
  31. .. code-block:: diff
  32. --- Original
  33. +++ New
  34. <?php
  35. // @todo do something later
  36. $foo = 1;
  37. -// @var int $a
  38. +/** @var int $a */
  39. $a = foo();
  40. Rule sets
  41. ---------
  42. The rule is part of the following rule set:
  43. - `@PhpCsFixer:risky <./../../ruleSets/PhpCsFixerRisky.rst>`_
  44. References
  45. ----------
  46. - Fixer class: `PhpCsFixer\\Fixer\\Comment\\CommentToPhpdocFixer <./../../../src/Fixer/Comment/CommentToPhpdocFixer.php>`_
  47. - Test class: `PhpCsFixer\\Tests\\Fixer\\Comment\\CommentToPhpdocFixerTest <./../../../tests/Fixer/Comment/CommentToPhpdocFixerTest.php>`_
  48. The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.