-
Notifications
You must be signed in to change notification settings - Fork 73
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
PHPCS fixes: strict comparison, rawurlencode(), sanitization #16
base: master
Are you sure you want to change the base?
Conversation
Oddly, tests fail because WordPress's functions aren't loaded:
|
That's because the test suite uses WP_Mock to "mock" the WordPress API. Since you've added a call to That being said, you shouldn't be using |
I added mocks (using
Why can't it find the Regarding the sanitization: sure, this will work fine without it. However, if we didn't include it, we'd need a |
Because there isn't one. Instead, the test that's failing is trying to mock the internal Let me step back a bit. My recommendation here is that you remove the addition of both of these functions (
If that's what we need for the CS tests to pass, then add it. Code Sniffer is a great tool, but sometimes (like in this instance) it presents false positives because it's just pattern matching and reporting where patterns are suspect. The changes it's recommending here are unnecessary. If you don't want to skip CS on this chunk of code, then you've got a lot of work left to do to polish things up:
So ... it's faster and cleaner to just note that we know CS will return a false hit on this code than to try to mangle code such that is passes CS's internal pattern filters. |
I've removed the |
Posting this so I can learn how this works (I've removed that change):
Calling |
|
Fixes most warnings and errors found by PHPCS with the WordPress-VIP ruleset.