-
-
Notifications
You must be signed in to change notification settings - Fork 483
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
Move sanitization methods to SanitizationHelperTrait + minor improvements #2356
Move sanitization methods to SanitizationHelperTrait + minor improvements #2356
Commits on Aug 18, 2023
-
Rename
SanitizingFunctionsTrait
toSanitizationHelperTrait
The `Sniff:;is_*sanitized()` utility methods are about to be moved to this trait, but once they have been, the trait name is no longer correct as all other `*Functions[Helper|Trait]` classes/traits _only_ deal with function lists and checking whether something is in those lists, while this trait will now do more than that. With that in mind, I propose to rename the trait to `SanitizationHelperTrait`.
Configuration menu - View commit details
-
Copy full SHA for 21d8cae - Browse repository at this point
Copy the full SHA 21d8caeView commit details -
Move sanitization methods to
SanitizationHelperTrait
This moves the last utility functions from the `Sniff` class to a dedicated trait. I am also explicitly marking the trait as internal API to allow us to iterate on this (not so very clean) solution in future 3.x releases without being forced to wait for a 4.0 release. The methods have been made stand-alone, as in, the presumption that the WPCS `Sniff` class is being extended has been removed by adding the `$phpcsFile` parameter. Closes 1465
Configuration menu - View commit details
-
Copy full SHA for 50e1fe9 - Browse repository at this point
Copy the full SHA 50e1fe9View commit details -
SanitizationHelperTrait::is_sanitized(): add some defensive coding
As this method is now stand-alone, we'd better make sure the token being examined exists. Note: no need to do the same for the `is_only_sanitized()` method as the first thing that method calls is this method and if this method returns `false`, the `is_only_sanitized()` method will too.
Configuration menu - View commit details
-
Copy full SHA for e72ca2c - Browse repository at this point
Copy the full SHA e72ca2cView commit details -
SanitizationHelperTrait::is_sanitized(): implement PHPCSUtils
Note: The `$functionPtr` variable is overwritten a few lines later and the other variables being set are effectively unused (other than in these lines), so this code can be safely removed/replaced.
Configuration menu - View commit details
-
Copy full SHA for b217ebc - Browse repository at this point
Copy the full SHA b217ebcView commit details -
SanitizationHelperTrait::is_sanitized(): efficiency tweak - move unse…
…t check up A variable which is being unset, doesn't need to be unslashed or sanitized, so bow out early.
Configuration menu - View commit details
-
Copy full SHA for 0834f59 - Browse repository at this point
Copy the full SHA 0834f59View commit details -
SanitizationHelperTrait::is_sanitized(): efficiency fix/improve perfo…
…rmance Remove the need for a call to the performance negative `array_diff_key()` function by setting up the original arrays in a better way.
Configuration menu - View commit details
-
Copy full SHA for 1bf115b - Browse repository at this point
Copy the full SHA 1bf115bView commit details -
SanitizationHelperTrait::is_sanitized(): minor code tweaks
* Get rid of an unnecessary `else`. * Improve readability of long condition. * Get rid of unnecessary true/false condition code.
Configuration menu - View commit details
-
Copy full SHA for 6440bed - Browse repository at this point
Copy the full SHA 6440bedView commit details -
Configuration menu - View commit details
-
Copy full SHA for 2d019df - Browse repository at this point
Copy the full SHA 2d019dfView commit details