Include constant name in deprecation message when a description exists - #201
Open
mglaman wants to merge 1 commit into
Open
Include constant name in deprecation message when a description exists#201mglaman wants to merge 1 commit into
mglaman wants to merge 1 commit into
Conversation
The deprecation description was passed to sprintf() as the format string, so the %s placeholder for the constant name only existed in the fallback message. Any constant documented with @deprecated text reported just that text, with no indication of which constant was used. Format the message like the other deprecation checks do: name first, description on the following line. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FetchingDeprecatedConstRulepasses the deprecation description tosprintf()as the format string:The
%splaceholder for the constant name only exists in the fallback message, so any constant documented with@deprecatedtext reports the description alone. Analyzing Drupal code that usesREQUIREMENT_ERRORproduces:There is no way to tell which constant triggered it, which is a problem when a single line fetches several deprecated constants.
This formats the message the way the other deprecation checks do (
RestrictedDeprecatedFunctionUsageExtension,RestrictedDeprecatedClassConstantUsageExtension) — name first, description on the next line:Messages for constants without a description are unchanged. Added a test covering the described case.
🤖 Generated with Claude Code