general_phpdoc_annotation_remove.rst 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. =========================================
  2. Rule ``general_phpdoc_annotation_remove``
  3. =========================================
  4. Configured annotations should be omitted from PHPDoc.
  5. Configuration
  6. -------------
  7. ``annotations``
  8. ~~~~~~~~~~~~~~~
  9. List of annotations to remove, e.g. ``["author"]``.
  10. Allowed types: ``list<string>``
  11. Default value: ``[]``
  12. ``case_sensitive``
  13. ~~~~~~~~~~~~~~~~~~
  14. Should annotations be case sensitive.
  15. Allowed types: ``bool``
  16. Default value: ``true``
  17. Examples
  18. --------
  19. Example #1
  20. ~~~~~~~~~~
  21. With configuration: ``['annotations' => ['author']]``.
  22. .. code-block:: diff
  23. --- Original
  24. +++ New
  25. <?php
  26. /**
  27. * @internal
  28. - * @author John Doe
  29. * @AuThOr Jane Doe
  30. */
  31. function foo() {}
  32. Example #2
  33. ~~~~~~~~~~
  34. With configuration: ``['annotations' => ['author'], 'case_sensitive' => false]``.
  35. .. code-block:: diff
  36. --- Original
  37. +++ New
  38. <?php
  39. /**
  40. * @internal
  41. - * @author John Doe
  42. - * @AuThOr Jane Doe
  43. */
  44. function foo() {}
  45. Example #3
  46. ~~~~~~~~~~
  47. With configuration: ``['annotations' => ['package', 'subpackage']]``.
  48. .. code-block:: diff
  49. --- Original
  50. +++ New
  51. <?php
  52. /**
  53. * @author John Doe
  54. - * @package ACME API
  55. - * @subpackage Authorization
  56. * @version 1.0
  57. */
  58. function foo() {}
  59. References
  60. ----------
  61. - Fixer class: `PhpCsFixer\\Fixer\\Phpdoc\\GeneralPhpdocAnnotationRemoveFixer <./../../../src/Fixer/Phpdoc/GeneralPhpdocAnnotationRemoveFixer.php>`_
  62. - Test class: `PhpCsFixer\\Tests\\Fixer\\Phpdoc\\GeneralPhpdocAnnotationRemoveFixerTest <./../../../tests/Fixer/Phpdoc/GeneralPhpdocAnnotationRemoveFixerTest.php>`_
  63. The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.