From 1b9da3f782906cc49b9717ad0985b22c5a71ece1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Machulda?= Date: Tue, 28 May 2024 10:34:15 +0200 Subject: [PATCH 1/2] Test: Add testcase showing unexpected PhpdocAlignFixer behavior --- tests/Integration/Fixtures/PhpDoc.correct.php.inc | 4 +++- tests/Integration/Fixtures/PhpDoc.wrong.php.inc | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/Integration/Fixtures/PhpDoc.correct.php.inc b/tests/Integration/Fixtures/PhpDoc.correct.php.inc index b680816..3897179 100644 --- a/tests/Integration/Fixtures/PhpDoc.correct.php.inc +++ b/tests/Integration/Fixtures/PhpDoc.correct.php.inc @@ -16,7 +16,9 @@ class PhpDoc * 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. + * @param string|null $third Third parameter is optional and has a default value and multilne comment. Lorem + * ipsum dolor sit amet, consectetur adipiscing elit. Nullam nec purus nec nunc ultricies ultricies. + * Nullam nec purus nec nunc ultricies ultricies. Nullam nec purus nec nunc ultricies ultricies. * @return mixed There is also information about return type. * @throws \Exception */ diff --git a/tests/Integration/Fixtures/PhpDoc.wrong.php.inc b/tests/Integration/Fixtures/PhpDoc.wrong.php.inc index a13aede..73f803c 100644 --- a/tests/Integration/Fixtures/PhpDoc.wrong.php.inc +++ b/tests/Integration/Fixtures/PhpDoc.wrong.php.inc @@ -23,7 +23,9 @@ class PhpDoc * @param string $first * @throws \Exception * @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. + * @param string|null $third Third parameter is optional and has a default value and multilne comment. Lorem + * ipsum dolor sit amet, consectetur adipiscing elit. Nullam nec purus nec nunc ultricies ultricies. + * Nullam nec purus nec nunc ultricies ultricies. Nullam nec purus nec nunc ultricies ultricies. * @return mixed There is also information about return type. */ public function veryWellDocumented(string $first, int|float $second, ?string $third = '3rd'): mixed From 580967a4cc35f0cd89b3051519a387fc24064541 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Machulda?= Date: Tue, 28 May 2024 11:01:40 +0200 Subject: [PATCH 2/2] Fix: Disable incorrectly behaving PhpdocAlignFixer --- ecs.php | 3 ++- tests/Integration/Fixtures/PhpDoc.wrong.php.inc | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ecs.php b/ecs.php index 7412b2f..17d3a18 100644 --- a/ecs.php +++ b/ecs.php @@ -522,7 +522,8 @@ 'remove_inheritdoc' => true, // remove @inheritDoc tags ]) // All items of the given PHPDoc tags must be left-aligned. - ->withConfiguredRule(PhpdocAlignFixer::class, ['align' => 'left']) + // @TODO: Re-enable if https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8052 is fixed + //->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. diff --git a/tests/Integration/Fixtures/PhpDoc.wrong.php.inc b/tests/Integration/Fixtures/PhpDoc.wrong.php.inc index 73f803c..3f5887b 100644 --- a/tests/Integration/Fixtures/PhpDoc.wrong.php.inc +++ b/tests/Integration/Fixtures/PhpDoc.wrong.php.inc @@ -20,13 +20,13 @@ class PhpDoc * * * - * @param string $first - * @throws \Exception - * @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 and multilne comment. Lorem + * @param string $first + * @throws \Exception + * @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 and multilne comment. Lorem * ipsum dolor sit amet, consectetur adipiscing elit. Nullam nec purus nec nunc ultricies ultricies. * Nullam nec purus nec nunc ultricies ultricies. Nullam nec purus nec nunc ultricies ultricies. - * @return mixed There is also information about return type. + * @return mixed There is also information about return type. */ public function veryWellDocumented(string $first, int|float $second, ?string $third = '3rd'): mixed {