Skip to content

[NoMissnamedDocTagRule] Skip @return/@param inside constant prose docblock - #278

Merged
TomasVotruba merged 1 commit into
mainfrom
skip-return-in-const-prose-doctag
Aug 24, 2026
Merged

[NoMissnamedDocTagRule] Skip @return/@param inside constant prose docblock#278
TomasVotruba merged 1 commit into
mainfrom
skip-return-in-const-prose-doctag

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

NoMissnamedDocTagRule flagged constants whose docblock merely mentions @return/@param inside prose — not as a real tag. Method/property checks already require the tag to sit at the start of a docblock line (* @tag); the constant check did not. Aligned the constant regex to the same #\*\s(@param|@return)\b# shape.

Before — false positive

/**
 * Using 10-level array @return docblocks makes code very hard to read,
 * lets limit it to reasonable level
 */
private const int MAX_NESTING = 3;
// ❌ Constant doc comment tag must be @var, "@return" given

After — skipped

Same code, no error. A real misnamed tag is still reported:

/**
 * @return string
 */
private const NAME = 'value';
// ❌ Constant doc comment tag must be @var, "@return" given

@TomasVotruba
TomasVotruba merged commit 00f595d into main Aug 24, 2026
8 checks passed
@TomasVotruba
TomasVotruba deleted the skip-return-in-const-prose-doctag branch August 24, 2026 18:54
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