Skip to content

Conversation

rodrigoprimo
Copy link
Collaborator

ConstantsHelper::is_use_of_global_constant() was incorrectly identifying a constant alias as a global constant. This change aligns this method with how the sibling method in PHPCompatibility behaves (https://github.com/PHPCompatibility/PHPCompatibility/blob/6e10469b0f3827862b37df2ac2b7ec4580ce888f/PHPCompatibility/Helpers/MiscHelper.php#L45).

…` alias as global constant usage

This method was incorrectly identifying a constant alias as a global constant. This change aligns this method with how the sibling method in PHPCompatibility behaves (https://github.com/PHPCompatibility/PHPCompatibility/blob/6e10469b0f3827862b37df2ac2b7ec4580ce888f/PHPCompatibility/Helpers/MiscHelper.php#L45).
Copy link
Member

@jrfnl jrfnl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably a good idea to double-check why that test what added (did it come from the Theme Review sniff and if so, was it added there for a specific reason ?)

I can imagine the reasoning was something along the lines of "we don't track import use statements, so having an alias to one of the discouraged constants will be confusing for humans (they see the constant in the code, think it's the WP constant, turns out it's a different constant) as well as for the sniff itself, as if the sniff would not flag the alias, but it would flag usages of the alias, it would flag something which isn't discouraged"

If this does get merged, I would like to see a comment in the test case file on line 64 documenting that the test would now be a "no false positives" test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants