-
-
Notifications
You must be signed in to change notification settings - Fork 192
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
False positive: Long arrays vs Anonymous classes #333
Labels
Milestone
Comments
jrfnl
added a commit
to jrfnl/PHPCompatibility
that referenced
this issue
Apr 10, 2017
…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. Includes unit tests.
jrfnl
added a commit
to jrfnl/PHPCompatibility
that referenced
this issue
Apr 11, 2017
…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.
jrfnl
added a commit
to jrfnl/PHPCompatibility
that referenced
this issue
Apr 11, 2017
…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.
jrfnl
added a commit
to jrfnl/PHPCompatibility
that referenced
this issue
Apr 11, 2017
…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.
jrfnl
added a commit
to jrfnl/PHPCompatibility
that referenced
this issue
Apr 11, 2017
…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.
jrfnl
added a commit
to jrfnl/PHPCompatibility
that referenced
this issue
Apr 11, 2017
…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.
jrfnl
added a commit
to jrfnl/PHPCompatibility
that referenced
this issue
Apr 11, 2017
…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.
jrfnl
added a commit
to jrfnl/PHPCompatibility
that referenced
this issue
Apr 12, 2017
…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.
wimg
added a commit
that referenced
this issue
Apr 15, 2017
Issue #333: add cross-version support for anonymous classes to the RemovedGlobalVariable sniff
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The following code will trigger a false positive in PHPCS < 2.7.2.
Related: #268
Upstream this was fixed in PHPCS 2.7.2(alpha) by adding support for
T_ANON_CLASS
in thePHP_Codesniffer_File->getMemberProperties()
method.squizlabs/PHP_CodeSniffer@0011d44
The text was updated successfully, but these errors were encountered: