From 28611589871b0efec71b251c633fdf70317ee8f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Machulda?= Date: Mon, 6 May 2024 23:58:00 +0200 Subject: [PATCH] Feat: Change phpdoc order so that `@throws` is after `@return` --- ecs.php | 4 ++-- tests/Integration/Fixtures/Basic.correct.php.inc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ecs.php b/ecs.php index 9041c2c..dd04801 100644 --- a/ecs.php +++ b/ecs.php @@ -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. @@ -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->...`) diff --git a/tests/Integration/Fixtures/Basic.correct.php.inc b/tests/Integration/Fixtures/Basic.correct.php.inc index c575d1f..52131b0 100644 --- a/tests/Integration/Fixtures/Basic.correct.php.inc +++ b/tests/Integration/Fixtures/Basic.correct.php.inc @@ -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 {