phpdoc_order.rst 788 B

12345678910111213141516171819202122232425262728293031323334353637
  1. =====================
  2. Rule ``phpdoc_order``
  3. =====================
  4. Annotations in PHPDoc should be ordered so that ``@param`` annotations come
  5. first, then ``@throws`` annotations, then ``@return`` annotations.
  6. Examples
  7. --------
  8. Example #1
  9. ~~~~~~~~~~
  10. .. code-block:: diff
  11. --- Original
  12. +++ New
  13. @@ -2,9 +2,9 @@
  14. /**
  15. * Hello there!
  16. *
  17. - * @throws Exception|RuntimeException foo
  18. * @custom Test!
  19. - * @return int Return the number of changes.
  20. * @param string $foo
  21. * @param bool $bar Bar
  22. + * @throws Exception|RuntimeException foo
  23. + * @return int Return the number of changes.
  24. */
  25. Rule sets
  26. ---------
  27. The rule is part of the following rule set:
  28. @PhpCsFixer
  29. Using the ``@PhpCsFixer`` rule set will enable the ``phpdoc_order`` rule.