Skip to content
This repository was archived by the owner on Jul 12, 2026. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .github/workflows/code_analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +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
- 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/

- run: ${{ matrix.actions.run }}
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

[![Downloads](https://img.shields.io/packagist/dt/symplify/coding-standard.svg?style=flat-square)](https://packagist.org/packages/symplify/coding-standard/stats)

> [!WARNING]
> **This package is deprecated.** Use [Easy Coding Standard (ECS)](https://github.com/easy-coding-standard/easy-coding-standard) instead, where these rules and coding standard work out of the box—no extra setup needed.

Coding standard rules for clean, consistent, and readable PHP code. No configuration needed—just install and let it handle the rest.

They run best with [ECS](https://github.com/symplify/easy-coding-standard).
Expand Down
19 changes: 17 additions & 2 deletions src/Fixer/Annotation/RemoveMethodNameDuplicateDescriptionFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ public function fix(SplFileInfo $fileInfo, Tokens $tokens): void

$docblockLines = explode("\n", $originalDocContent);
foreach ($docblockLines as $key => $docblockLine) {
$spacelessDocblockLine = Regex::replace($docblockLine, '#[\s\n]+#', '');
if (strtolower($spacelessDocblockLine) !== strtolower('*' . $methodName)) {
if (! $this->isMethodNameDescriptionLine($docblockLine, $methodName)) {
continue;
}

Expand All @@ -86,4 +85,20 @@ public function fix(SplFileInfo $fileInfo, Tokens $tokens): void
$tokens[$index] = new Token([T_DOC_COMMENT, implode("\n", $docblockLines)]);
}
}

private function isMethodNameDescriptionLine(string $docblockLine, string $methodName): bool
{
$normalizedLine = strtolower(ltrim(trim($docblockLine), '*'));

// drop articles, so "Get the API helper" still matches getApiHelper()
$words = array_filter(
explode(' ', $normalizedLine),
static fn (string $word): bool => ! in_array(trim($word, '.,!:;'), ['a', 'an', 'the'], true)
);

// strip whitespace and trailing punctuation
$spacelessLine = Regex::replace(implode(' ', $words), '#[^a-z0-9]+#', '');

return $spacelessLine === strtolower($methodName);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

namespace Symplify\CodingStandard\Tests\Fixer\Annotation\RemoveMethodNameDuplicateDescriptionFixer\Fixture;

final class WithArticles
{
/**
* Get the API helper.
*
* @return object
*/
public function getApiHelper()
{
}
}

?>
-----
<?php

namespace Symplify\CodingStandard\Tests\Fixer\Annotation\RemoveMethodNameDuplicateDescriptionFixer\Fixture;

final class WithArticles
{
/**
*
* @return object
*/
public function getApiHelper()
{
}
}

?>
Loading