-
-
Notifications
You must be signed in to change notification settings - Fork 488
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
Make best practice sniffs code-style independent #763
Labels
Comments
This was referenced Jul 25, 2017
This was referenced Jul 1, 2018
I believe this has been addressed by now in most sniffs in the codebase, safe for one or two. The I'll keep an eye out for these kind of things when going through the sniffs anyway to upgrade them for Utils/PHP 8.x, but suggest we close this issue as "fixed". |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There are a number of sniffs which currently walk the token tree presuming that code complies with the WP code style rules.
The net end-result of this is that the messages from these sniffs will not be thrown for code which does not comply with the WP code style rules.
As VIP plugins as well as themes generally don't have to comply with the WP code style, but do have to comply with a lot of best practices, this means that important messages might be missed.
As a secondary result, it also means that an initial run against the WP rulesets might not show all messages and new messages might start to get thrown only once code style issues have been fixed.
I would suggest we should review all (non-code style specific) sniffs for these kind of issues and improve them where necessary.
Particular attention should be paid to:
strpos()
,preg_match()
or a strict compare. These are all case-insensitive in PHP so should be compared as such.define()
function is checked, it should be checked that the third parameter$case_insensitive
is either not passed or passed afalse
, otherwise a case-insensitive name check is needed.$token + 1
) instead of usingfindNext/Previous()
in combination withTokens::$emptyTokens
The text was updated successfully, but these errors were encountered: