-
-
Notifications
You must be signed in to change notification settings - Fork 480
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
New Abstract for restricting arguments in functions #745
Comments
May I suggest having an abstract class and then three concrete class - one for deprecated arguments, one for required arguments, one for checking correct usage of an argument ? Keeps the different logic isolated in different sniffs. |
Thank you @jrfnl Would such a structure make sense:
The array for 'get_bloginfo' => array(
2 => array(
'home' => array(
'alt' => 'home_url()',
),
'siteurl' => array(
'alt' => 'home_url()',
'version' => '2.2'
),
),
), The array for 'get_bloginfo' => array(
2 => array(
'display' => true,
),
), The array for 'apply_filters' => array(
1 => 'widget_title',
2 => true,
3 => true,
4 => true,
), |
I started working on something for theme sniffs but realized this would fit better ustream. WPTT/WPThemeReview#80
As we have an abstract to restrict function it would make sense to have one to restrict arguments.
A few examples for this would be
get_bloginfo( 'home' )
wherehome
is deprecateddate_i18n( get_option( 'date_format' ) )
Sniff to discourage use of number_format() and date() in output #739get_bloginfo( 'name', 'display' )
add_filter( 'mime_types', '' );
as it is plugin territoryfunction_exist( 'add_action' )
Related issues WPTT/WPThemeReview#93 WPTT/WPThemeReview#42 WPTT/WPThemeReview#27 WPTT/WPThemeReview#1 WPTT/WPThemeReview#96
#611
The current array is as below.
First we have the function name, the position of the argument, the argument it should match. Alt is the alternative function for the deprecated parameter and version is when it was deprecated.
What I unsure about is how I can differentiate when a argument should not be used and when a argument is required.
The text was updated successfully, but these errors were encountered: