Skip to content

Report excluded usages via error tip instead of message suffix#360

Draft
ruudk wants to merge 1 commit into
shipmonk-rnd:masterfrom
ruudk:excluder-to-error-tip
Draft

Report excluded usages via error tip instead of message suffix#360
ruudk wants to merge 1 commit into
shipmonk-rnd:masterfrom
ruudk:excluder-to-error-tip

Conversation

@ruudk
Copy link
Copy Markdown
Contributor

@ruudk ruudk commented May 15, 2026

The "(all usages excluded by X excluder)" text was appended to the error message itself, which mixed the diagnostic ("Unused X") with the explanation of why it survived analysis. Moving it to a PHPStan error tip keeps the message focused on the dead member and presents the excluder context the same way transitive-death reasons are already surfaced.

BlackMember::getExclusionMessage() becomes getExclusionTip(), returning null when nothing is excluded, and DeadCodeRule::buildError() emits it through RuleErrorBuilder::addTip() for both the representative and transitively dead members.

Fixes #359

The "(all usages excluded by X excluder)" text was appended to the
error message itself, which mixed the diagnostic ("Unused X") with the
explanation of why it survived analysis. Moving it to a PHPStan error
tip keeps the message focused on the dead member and presents the
excluder context the same way transitive-death reasons are already
surfaced.

`BlackMember::getExclusionMessage()` becomes `getExclusionTip()`,
returning null when nothing is excluded, and `DeadCodeRule::buildError()`
emits it through `RuleErrorBuilder::addTip()` for both the representative
and transitively dead members.

Fixes shipmonk-rnd#359
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.

Do not put name of the MemberUsageExcluder in the error message

1 participant