Skip to content

Commit 383fcaf

Browse files
committed
Feat: Change phpdoc order so that @throws is after @return
1 parent 0fe0f17 commit 383fcaf

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

ecs.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,6 @@
337337
PhpdocNoEmptyReturnFixer::class,
338338
// `@package` and `@subpackage` annotations should be omitted from PHPDoc.
339339
PhpdocNoPackageFixer::class,
340-
// Annotations in PHPDoc should be ordered.
341-
PhpdocOrderFixer::class,
342340
// The type of `@return` annotations of methods returning a reference to itself must the configured one.
343341
PhpdocReturnSelfReferenceFixer::class,
344342
// Scalar types should always be written in the same form.
@@ -502,6 +500,8 @@
502500
])
503501
// All items of the given PHPDoc tags must be left-aligned.
504502
->withConfiguredRule(PhpdocAlignFixer::class, ['align' => 'left'])
503+
// Annotations in PHPDoc should be ordered in defined sequence.
504+
->withConfiguredRule(PhpdocOrderFixer::class, ['order' => ['param', 'return', 'throws']])
505505
// Order phpdoc tags by value.
506506
->withConfiguredRule(PhpdocOrderByValueFixer::class, ['annotations' => ['covers', 'group', 'throws']])
507507
// Calls to `PHPUnit\Framework\TestCase` static methods must all be of the same type (`$this->...`)

tests/Integration/Fixtures/Basic.correct.php.inc

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ class Basic
8383
* It tests PhpdocAlignFixer, NoSuperfluousPhpdocTagsFixer and possibly other Phpdoc rules.
8484
* @param int|float $second Second parameter does have a comment, unlike the first one.
8585
* @param string|null $third Third parameter is optional and has a default value.
86-
* @throws \Exception
8786
* @return mixed There is also information about return type.
87+
* @throws \Exception
8888
*/
8989
public function veryWellDocumented(string $first, int|float $second, ?string $third = '3rd'): mixed
9090
{

0 commit comments

Comments
 (0)