-
-
Notifications
You must be signed in to change notification settings - Fork 191
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
Issue #333: add cross-version support for anonymous classes to the RemovedGlobalVariable sniff #393
Merged
Conversation
This file contains 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
19df8c8
to
3dfcfc7
Compare
70a6d8e
to
6e5ef09
Compare
6e5ef09
to
1a380f3
Compare
5 similar comments
1a380f3
to
e21e3c1
Compare
…lasses to the RemovedGlobalVariable sniff. Prevent false positives for Class properties named after removed PHP superglobals in PHPCS 2.4.0-2.7.1. Pre-PHPCS 2.4.0, the `T_ANON_CLASS` token was recognized as T_CLASS and supported as such which works perfectly for our purposes. PHPCS 2.4.0 - 2.7.1 supported the T_ANON_CLASS *token*, but did not consistently take it into account in all the relevant methods, like `getMemberProperties()`. This was finally fixed in PHPCS 2.8.0. As there is another upcoming sniff which will run into the same issue, I've abstracted the code to determine whether a variable is a class property to a method in the `PHPCompatibility_Sniff`. Includes unit tests both for anonymous class support in the RemovedGlobalVariable sniff, as well as for the new utility method.
This was referenced May 4, 2017
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.
Prevent false positives for class properties named after removed PHP superglobals in PHPCS 2.4.0-2.7.1.
T_ANON_CLASS
token was recognized as T_CLASS and supported as such which works perfectly for our purposes.getMemberProperties()
.As there is another upcoming sniff which will run into the same issue, I've abstracted the code to determine whether a variable is a class property to a method in the
PHPCompatibility_Sniff
.Includes unit tests both for anonymous class support in the RemovedGlobalVariable sniff, as well as for the new utility method.
Fixes #333
One of several PRs to fix #351