comment_to_phpdoc.rst 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. -<?php /* header */ $x = true; /* @var bool $isFoo */ $isFoo = true;
  24. +<?php /* header */ $x = true; /** @var bool $isFoo */ $isFoo = true;
  25. Example #2
  26. ~~~~~~~~~~
  27. With configuration: ``['ignored_tags' => ['todo']]``.
  28. .. code-block:: diff
  29. --- Original
  30. +++ New
  31. <?php
  32. // @todo do something later
  33. $foo = 1;
  34. -// @var int $a
  35. +/** @var int $a */
  36. $a = foo();
  37. Rule sets
  38. ---------
  39. The rule is part of the following rule set:
  40. @PhpCsFixer:risky
  41. Using the `@PhpCsFixer:risky <./../../ruleSets/PhpCsFixerRisky.rst>`_ rule set will enable the ``comment_to_phpdoc`` rule with the default config.