Skip to content

Remove method-name duplicate description with trailing punctuation#36

Merged
TomasVotruba merged 1 commit into
mainfrom
remove-method-name-dupe-trailing-period
Jul 2, 2026
Merged

Remove method-name duplicate description with trailing punctuation#36
TomasVotruba merged 1 commit into
mainfrom
remove-method-name-dupe-trailing-period

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

RemoveMethodNameDuplicateDescriptionFixer already strips docblock descriptions that just repeat the method name (* Set name above setName()), but a trailing period or exclamation kept the line:

/**
 * Set name.
 */
public function setName()

Set name. → spaceless *Setname. which no longer equals *setName, so it survived.

Fix: rtrim(..., '.!') on the spaceless line before comparison, so trailing sentence punctuation is ignored.

Added fixture trailing_period.php.inc. phpstan/rector/ecs/phpunit green.

Note: this extends the existing rule rather than adding a new one — the plain Set name case was already covered.

@TomasVotruba TomasVotruba merged commit 7a9b5f1 into main Jul 2, 2026
7 checks passed
@TomasVotruba TomasVotruba deleted the remove-method-name-dupe-trailing-period branch July 2, 2026 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant