Skip to content

Commit

Permalink
Feat: Change phpdoc order so that @throws is after @return
Browse files Browse the repository at this point in the history
  • Loading branch information
OndraM committed May 6, 2024
1 parent de4a9b3 commit 2861158
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,6 @@
PhpdocNoEmptyReturnFixer::class,
// `@package` and `@subpackage` annotations should be omitted from PHPDoc.
PhpdocNoPackageFixer::class,
// Annotations in PHPDoc should be ordered.
PhpdocOrderFixer::class,
// The type of `@return` annotations of methods returning a reference to itself must the configured one.
PhpdocReturnSelfReferenceFixer::class,
// Scalar types should always be written in the same form.
Expand Down Expand Up @@ -500,6 +498,8 @@
])
// All items of the given PHPDoc tags must be left-aligned.
->withConfiguredRule(PhpdocAlignFixer::class, ['align' => 'left'])
// Annotations in PHPDoc should be ordered in defined sequence.
->withConfiguredRule(PhpdocOrderFixer::class, ['order' => ['param', 'return', 'throws']])
// Order phpdoc tags by value.
->withConfiguredRule(PhpdocOrderByValueFixer::class, ['annotations' => ['covers', 'group', 'throws']])
// Calls to `PHPUnit\Framework\TestCase` static methods must all be of the same type (`$this->...`)
Expand Down
2 changes: 1 addition & 1 deletion tests/Integration/Fixtures/Basic.correct.php.inc
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ class Basic
* It tests PhpdocAlignFixer, NoSuperfluousPhpdocTagsFixer and possibly other Phpdoc rules.
* @param int|float $second Second parameter does have a comment, unlike the first one.
* @param string|null $third Third parameter is optional and has a default value.
* @throws \Exception
* @return mixed There is also information about return type.
* @throws \Exception
*/
public function veryWellDocumented(string $first, int|float $second, ?string $third = '3rd'): mixed
{
Expand Down

0 comments on commit 2861158

Please sign in to comment.