Fork me on GitHub
a Sensio Labs Product

BerSzcz against war! (v3.8.0) edition

Rule phpdoc_order

Annotations in PHPDoc should be ordered so that @param annotations come first, then @throws annotations, then @return annotations.


Example #1

--- Original
+++ New
  * Hello there!
- * @throws Exception|RuntimeException foo
  * @custom Test!
- * @return int  Return the number of changes.
  * @param string $foo
  * @param bool   $bar Bar
+ * @throws Exception|RuntimeException foo
+ * @return int  Return the number of changes.

Rule sets

The rule is part of the following rule set:


Using the @PhpCsFixer rule set will enable the phpdoc_order rule.

The logo is © 2010-2022 Sensio Labs