From 96f5be2ac7bf2583750b5928f4ec66af4164bf07 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Thu, 25 Jun 2026 11:18:14 +0200 Subject: [PATCH 1/5] Add FixTagTypoFixer for plural doc block tag typos (@returns, @params) --- src/Fixer/Commenting/FixTagTypoFixer.php | 39 +++++++++++++++++++ .../FixTagTypoFixer/FixTagTypoFixerTest.php | 28 +++++++++++++ .../Fixture/plural_tags.php.inc | 25 ++++++++++++ .../FixTagTypoFixer/Fixture/var_tag.php.inc | 23 +++++++++++ .../config/configured_rule.php | 10 +++++ 5 files changed, 125 insertions(+) create mode 100644 src/Fixer/Commenting/FixTagTypoFixer.php create mode 100644 tests/Fixer/Commenting/FixTagTypoFixer/FixTagTypoFixerTest.php create mode 100644 tests/Fixer/Commenting/FixTagTypoFixer/Fixture/plural_tags.php.inc create mode 100644 tests/Fixer/Commenting/FixTagTypoFixer/Fixture/var_tag.php.inc create mode 100644 tests/Fixer/Commenting/FixTagTypoFixer/config/configured_rule.php diff --git a/src/Fixer/Commenting/FixTagTypoFixer.php b/src/Fixer/Commenting/FixTagTypoFixer.php new file mode 100644 index 00000000..9b00ed72 --- /dev/null +++ b/src/Fixer/Commenting/FixTagTypoFixer.php @@ -0,0 +1,39 @@ + $tokens + */ + protected function processDocContent(string $docContent, Tokens $tokens, int $position): string + { + return Regex::replace($docContent, self::PLURAL_TAG_REGEX, '@$1'); + } +} diff --git a/tests/Fixer/Commenting/FixTagTypoFixer/FixTagTypoFixerTest.php b/tests/Fixer/Commenting/FixTagTypoFixer/FixTagTypoFixerTest.php new file mode 100644 index 00000000..c7729266 --- /dev/null +++ b/tests/Fixer/Commenting/FixTagTypoFixer/FixTagTypoFixerTest.php @@ -0,0 +1,28 @@ +doTestFile($filePath); + } + + public static function provideData(): Iterator + { + return self::yieldFiles(__DIR__ . '/Fixture'); + } + + public function provideConfig(): string + { + return __DIR__ . '/config/configured_rule.php'; + } +} diff --git a/tests/Fixer/Commenting/FixTagTypoFixer/Fixture/plural_tags.php.inc b/tests/Fixer/Commenting/FixTagTypoFixer/Fixture/plural_tags.php.inc new file mode 100644 index 00000000..e056b305 --- /dev/null +++ b/tests/Fixer/Commenting/FixTagTypoFixer/Fixture/plural_tags.php.inc @@ -0,0 +1,25 @@ + +----- + diff --git a/tests/Fixer/Commenting/FixTagTypoFixer/Fixture/var_tag.php.inc b/tests/Fixer/Commenting/FixTagTypoFixer/Fixture/var_tag.php.inc new file mode 100644 index 00000000..7c65eaaf --- /dev/null +++ b/tests/Fixer/Commenting/FixTagTypoFixer/Fixture/var_tag.php.inc @@ -0,0 +1,23 @@ + +----- + diff --git a/tests/Fixer/Commenting/FixTagTypoFixer/config/configured_rule.php b/tests/Fixer/Commenting/FixTagTypoFixer/config/configured_rule.php new file mode 100644 index 00000000..5f07c1ff --- /dev/null +++ b/tests/Fixer/Commenting/FixTagTypoFixer/config/configured_rule.php @@ -0,0 +1,10 @@ +rule(FixTagTypoFixer::class); +}; From 06ea23f0add3cbfae2a8517c352b4751b4e5f5e3 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Thu, 25 Jun 2026 11:30:16 +0200 Subject: [PATCH 2/5] CI: guard ECS coding-standard override against missing nested vendor --- .github/workflows/code_analysis.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/code_analysis.yaml b/.github/workflows/code_analysis.yaml index e536767d..756b04e6 100644 --- a/.github/workflows/code_analysis.yaml +++ b/.github/workflows/code_analysis.yaml @@ -55,9 +55,11 @@ jobs: # composer install cache - https://github.com/ramsey/composer-install - uses: "ramsey/composer-install@v3" - # Override code from symplify/coding-standard shipped with ECS + # Override code from symplify/coding-standard shipped with ECS (only when ECS still nests it) - run: | - rm -rf vendor/symplify/easy-coding-standard/vendor/symplify/coding-standard/src - ln -s $PWD/src vendor/symplify/easy-coding-standard/vendor/symplify/coding-standard/ + if [ -d vendor/symplify/easy-coding-standard/vendor/symplify/coding-standard ]; then + rm -rf vendor/symplify/easy-coding-standard/vendor/symplify/coding-standard/src + ln -s $PWD/src vendor/symplify/easy-coding-standard/vendor/symplify/coding-standard/ + fi - run: ${{ matrix.actions.run }} From 8240f4eb9a7a42b14ea1a617284b5d85f5c8b771 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Thu, 25 Jun 2026 11:31:42 +0200 Subject: [PATCH 3/5] CI: drop obsolete ECS coding-standard override step --- .github/workflows/code_analysis.yaml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/code_analysis.yaml b/.github/workflows/code_analysis.yaml index 756b04e6..c8b1b08a 100644 --- a/.github/workflows/code_analysis.yaml +++ b/.github/workflows/code_analysis.yaml @@ -55,11 +55,4 @@ jobs: # composer install cache - https://github.com/ramsey/composer-install - uses: "ramsey/composer-install@v3" - # Override code from symplify/coding-standard shipped with ECS (only when ECS still nests it) - - run: | - if [ -d vendor/symplify/easy-coding-standard/vendor/symplify/coding-standard ]; then - rm -rf vendor/symplify/easy-coding-standard/vendor/symplify/coding-standard/src - ln -s $PWD/src vendor/symplify/easy-coding-standard/vendor/symplify/coding-standard/ - fi - - run: ${{ matrix.actions.run }} From 661d7857e92f75dbae8258d65595b8c9d95a0f64 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Thu, 25 Jun 2026 11:35:38 +0200 Subject: [PATCH 4/5] Add skip fixtures for FixTagTypoFixer --- .../FixTagTypoFixer/Fixture/skip_correct_tags.php.inc | 10 ++++++++++ .../FixTagTypoFixer/Fixture/skip_other_tags.php.inc | 10 ++++++++++ .../FixTagTypoFixer/Fixture/skip_word_in_text.php.inc | 10 ++++++++++ 3 files changed, 30 insertions(+) create mode 100644 tests/Fixer/Commenting/FixTagTypoFixer/Fixture/skip_correct_tags.php.inc create mode 100644 tests/Fixer/Commenting/FixTagTypoFixer/Fixture/skip_other_tags.php.inc create mode 100644 tests/Fixer/Commenting/FixTagTypoFixer/Fixture/skip_word_in_text.php.inc diff --git a/tests/Fixer/Commenting/FixTagTypoFixer/Fixture/skip_correct_tags.php.inc b/tests/Fixer/Commenting/FixTagTypoFixer/Fixture/skip_correct_tags.php.inc new file mode 100644 index 00000000..fb7e4000 --- /dev/null +++ b/tests/Fixer/Commenting/FixTagTypoFixer/Fixture/skip_correct_tags.php.inc @@ -0,0 +1,10 @@ + Date: Thu, 25 Jun 2026 11:38:10 +0200 Subject: [PATCH 5/5] Inline fixer definition message, drop ERROR_MESSAGE constant --- src/Fixer/Commenting/FixTagTypoFixer.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Fixer/Commenting/FixTagTypoFixer.php b/src/Fixer/Commenting/FixTagTypoFixer.php index 9b00ed72..e1c04cb8 100644 --- a/src/Fixer/Commenting/FixTagTypoFixer.php +++ b/src/Fixer/Commenting/FixTagTypoFixer.php @@ -22,11 +22,9 @@ final class FixTagTypoFixer extends AbstractDocBlockFixer */ private const string PLURAL_TAG_REGEX = '#@((?:psalm-|phpstan-)?(?:param|return|var))s\b#'; - private const string ERROR_MESSAGE = 'Fix a plural typo in a doc block tag, e.g. "@returns" to "@return"'; - public function getDefinition(): FixerDefinitionInterface { - return new FixerDefinition(self::ERROR_MESSAGE, []); + return new FixerDefinition('Fix a plural typo in a doc block tag, e.g. "@returns" to "@return"', []); } /**