You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The parent is_targetted_token() method has diverged quite a bit from what is in the method in this class.
Rather than address this now, I propose to address this once the improved/namespace and use context aware abstracts in PHPCSUtils are available as this sniff would benefit from switching over to such abstract.
Other than that for the custom code in the is_targetted_token() method, some additional checks could be put in place to guard against both false positives as well as false negatives.
Currently the custom code checks for a particular variable name for an object. However:
It doesn't check that variable is the WP global variable.
It doesn't attempt to check that variable is an instance of the target class by looking at parameter type declarations, docblock type declarations or looking for the variable being set in the current scope.
It doesn't attempt to check if a variable with a different name is used whether that variable is an instance of the target class by looking at parameter type declarations, docblock type declarations or looking for the variable being set in the current scope.
Planning / timing
For the switch over to the different parent class, I think it would be opportune to do this relatively quickly after the abstract becomes available as the sniff is looking for a large list of functions and these check would all benefit from the namespace awareness.
For adding additional checks for the object variable, IMO, this can be low priority as effectively the custom code is currently only used for one function check $wp_rewrite->flush_rules().
Review the
WordPressVIPMinimum.Functions.RestrictedFunctions
sniff for the following in as far as relevant to that sniff:Typical things to add tests for and verify correct handling of:
list
statementsTypical things to add tests for and verify correct handling of (where applicable):
::class
use function/const
Other:
Sniff basics, but changes need to be lined up for next major release:
public
properties (Audit Public Sniff Properties #234)Once PHPCS/PHPCSUtils supports this:
match
expressionsThe text was updated successfully, but these errors were encountered: