diff --git a/WordPress/AbstractFunctionRestrictionsSniff.php b/WordPress/AbstractFunctionRestrictionsSniff.php index 6a56d623ea..513d35a6e7 100644 --- a/WordPress/AbstractFunctionRestrictionsSniff.php +++ b/WordPress/AbstractFunctionRestrictionsSniff.php @@ -68,51 +68,6 @@ abstract class WordPress_AbstractFunctionRestrictionsSniff extends WordPress_Sni */ protected $excluded_groups = array(); - /** - * List of known PHP and WP functions which take a callback as an argument. - * - * Sorted alphabetically. Last updated on 8th March 2017. - * - * @since 0.11.0 - * - * @var array => - */ - protected $callback_functions = array( - 'add_filter' => array( 2 ), - 'add_action' => array( 2 ), - 'array_diff_uassoc' => array( -1 ), // = last argument passed. - 'array_diff_ukey' => array( -1 ), // = last argument passed. - 'array_filter' => array( 2 ), - 'array_intersect_uassoc' => array( -1 ), // = last argument passed. - 'array_intersect_ukey' => array( -1 ), // = last argument passed. - 'array_map' => array( 1 ), - 'array_reduce' => array( 2 ), - 'array_udiff_assoc' => array( -1 ), // = last argument passed. - 'array_udiff_uassoc' => array( -1, -2 ), // = last argument passed. - 'array_udiff' => array( -1 ), // = last argument passed. - 'array_uintersect_assoc' => array( -1 ), // = last argument passed. - 'array_uintersect_uassoc' => array( -1, -2 ), // = last argument passed. - 'array_uintersect' => array( -1 ), // = last argument passed. - 'array_walk' => array( 2 ), - 'array_walk_recursive' => array( 2 ), - 'call_user_func' => array( 1 ), - 'call_user_func_array' => array( 1 ), - 'forward_static_call' => array( 1 ), - 'forward_static_call_array' => array( 1 ), - 'header_register_callback' => array( 1 ), - 'iterator_apply' => array( 2 ), - 'mb_ereg_replace_callback' => array( 2 ), - 'ob_start' => array( 1 ), - 'preg_replace_callback' => array( 2 ), - 'register_shutdown_function' => array( 1 ), - 'register_tick_function' => array( 1 ), - 'set_error_handler' => array( 1 ), - 'set_exception_handler' => array( 1 ), - 'uasort' => array( 2 ), - 'uksort' => array( 2 ), - 'usort' => array( 2 ), - ); - /** * Groups of functions to restrict. * @@ -281,7 +236,7 @@ public function is_targetted_token( $stackPtr ) { * normal file processing. */ public function check_for_matches( $stackPtr ) { - $token_content = strtolower( $this->strip_quotes( $this->tokens[ $stackPtr ]['content'] ) ); + $token_content = strtolower( $this->tokens[ $stackPtr ]['content'] ); $skip_to = array(); foreach ( $this->groups as $groupName => $group ) { @@ -314,7 +269,7 @@ public function check_for_matches( $stackPtr ) { * * @param int $stackPtr The position of the current token in the stack. * - * @return int|void If a callback was found return stackPtr for where to skip to, false if the function call is not a callback. + * @return int|void If a callback was found return stackPtr for where to skip to. */ public function check_for_callback_matches( $stackPtr ) { @@ -354,7 +309,7 @@ public function check_for_callback_matches( $stackPtr ) { return; } - $skip_to[] = $this->check_for_matches( $callback ); + $skip_to[] = $this->check_for_matches( $this->strip_quotes( $callback ) ); } if ( empty( $skip_to ) || min( $skip_to ) === 0 ) {