Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is_token_namespaced() doesn't take into account __NAMESPACE__ concatenation #1

Open
rebeccahum opened this issue Aug 28, 2019 · 1 comment

Comments

@rebeccahum
Copy link

👋 When using the helper function is_token_namespaced(), it doesn't appear to pick up when the magic constant of __NAMESPACE__ is being concatenated:

https://github.com/WordPress/WordPress-Coding-Standards/blob/06966b26d8deb06a91a5c0f99a04802a6ff5e5bf/WordPress/Sniff.php#L1648-L1671

e.g. The below would return false:

__NAMESPACE__ . '\FOO_BAR';

I think we can just add a check if the token is T_NS_C.

Please let me know if I can provide any additional information!

@jrfnl
Copy link
Member

jrfnl commented Nov 13, 2019

The thing with this is that the actual token is not namespaced as constant encapsed text strings are not subject to the concept of namespaces.

__NAMESPACE__ returns a text string after all.

This method is not in this library for now anyway, but I'll have a think about this if/when I decide to add it.

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

No branches or pull requests

2 participants