Skip to content

Commit

Permalink
Merge pull request #581 from grappler/patch-1
Browse files Browse the repository at this point in the history
Sort the list in a better order
  • Loading branch information
JDGrimes authored Jul 11, 2016
2 parents 15460b4 + 07bf22a commit 3889b42
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions WordPress/Sniffs/PHP/DiscouragedFunctionsSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
* @package PHP_CodeSniffer
* @author John Godley <[email protected]>
*/
class WordPress_Sniffs_PHP_DiscouragedFunctionsSniff extends Generic_Sniffs_PHP_ForbiddenFunctionsSniff
{
class WordPress_Sniffs_PHP_DiscouragedFunctionsSniff extends Generic_Sniffs_PHP_ForbiddenFunctionsSniff {

/**
* A list of forbidden functions with their alternatives.
Expand All @@ -34,17 +33,20 @@ class WordPress_Sniffs_PHP_DiscouragedFunctionsSniff extends Generic_Sniffs_PHP_
* @var array(string => string|null)
*/
public $forbiddenFunctions = array(
'print_r' => null,
'debug_print_backtrace' => null,
// Deprecated
'ereg_replace' => 'preg_replace',
'ereg' => null,
'eregi_replace' => 'preg_replace',
'json_encode' => 'wp_json_encode',
'split' => null,
'spliti' => null,
// Development
'print_r' => null,
'debug_print_backtrace' => null,
'var_dump' => null,
'var_export' => null,
// WordPress
// Discouraged
'json_encode' => 'wp_json_encode',
// WordPress deprecated
'find_base_dir' => 'WP_Filesystem::abspath',
'get_base_dir' => 'WP_Filesystem::abspath',
'dropdown_categories' => 'wp_link_category_checklist',
Expand All @@ -59,6 +61,7 @@ class WordPress_Sniffs_PHP_DiscouragedFunctionsSniff extends Generic_Sniffs_PHP_
'get_attachment_icon_src' => 'wp_get_attachment_image_src',
'get_attachment_icon' => 'wp_get_attachment_image',
'get_attachment_innerHTML' => 'wp_get_attachment_image',
// WordPress discouraged
'query_posts' => 'WP_Query',
'wp_reset_query' => 'wp_reset_postdata',
);
Expand All @@ -71,5 +74,3 @@ class WordPress_Sniffs_PHP_DiscouragedFunctionsSniff extends Generic_Sniffs_PHP_
public $error = false;

}//end class

?>

0 comments on commit 3889b42

Please sign in to comment.