phpdoc_add_missing_param_annotation.rst 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. ============================================
  2. Rule ``phpdoc_add_missing_param_annotation``
  3. ============================================
  4. PHPDoc should contain ``@param`` for all params.
  5. Configuration
  6. -------------
  7. ``only_untyped``
  8. ~~~~~~~~~~~~~~~~
  9. Whether to add missing ``@param`` annotations for untyped parameters only.
  10. Allowed types: ``bool``
  11. Default value: ``true``
  12. Examples
  13. --------
  14. Example #1
  15. ~~~~~~~~~~
  16. *Default* configuration.
  17. .. code-block:: diff
  18. --- Original
  19. +++ New
  20. <?php
  21. /**
  22. * @param int $bar
  23. + * @param mixed $baz
  24. *
  25. * @return void
  26. */
  27. function f9(string $foo, $bar, $baz) {}
  28. Example #2
  29. ~~~~~~~~~~
  30. With configuration: ``['only_untyped' => true]``.
  31. .. code-block:: diff
  32. --- Original
  33. +++ New
  34. <?php
  35. /**
  36. * @param int $bar
  37. + * @param mixed $baz
  38. *
  39. * @return void
  40. */
  41. function f9(string $foo, $bar, $baz) {}
  42. Example #3
  43. ~~~~~~~~~~
  44. With configuration: ``['only_untyped' => false]``.
  45. .. code-block:: diff
  46. --- Original
  47. +++ New
  48. <?php
  49. /**
  50. * @param int $bar
  51. + * @param string $foo
  52. + * @param mixed $baz
  53. *
  54. * @return void
  55. */
  56. function f9(string $foo, $bar, $baz) {}
  57. Rule sets
  58. ---------
  59. The rule is part of the following rule set:
  60. - `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_