Skip to content

Commit 737390a

Browse files
committed
Correct documentation and use strip_quotes only when needed
1 parent f3bf2b4 commit 737390a

File tree

1 file changed

+3
-48
lines changed

1 file changed

+3
-48
lines changed

WordPress/AbstractFunctionRestrictionsSniff.php

Lines changed: 3 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -68,51 +68,6 @@ abstract class WordPress_AbstractFunctionRestrictionsSniff extends WordPress_Sni
6868
*/
6969
protected $excluded_groups = array();
7070

71-
/**
72-
* List of known PHP and WP functions which take a callback as an argument.
73-
*
74-
* Sorted alphabetically. Last updated on 8th March 2017.
75-
*
76-
* @since 0.11.0
77-
*
78-
* @var array <string function name> => <int callback argument position>
79-
*/
80-
protected $callback_functions = array(
81-
'add_filter' => array( 2 ),
82-
'add_action' => array( 2 ),
83-
'array_diff_uassoc' => array( -1 ), // = last argument passed.
84-
'array_diff_ukey' => array( -1 ), // = last argument passed.
85-
'array_filter' => array( 2 ),
86-
'array_intersect_uassoc' => array( -1 ), // = last argument passed.
87-
'array_intersect_ukey' => array( -1 ), // = last argument passed.
88-
'array_map' => array( 1 ),
89-
'array_reduce' => array( 2 ),
90-
'array_udiff_assoc' => array( -1 ), // = last argument passed.
91-
'array_udiff_uassoc' => array( -1, -2 ), // = last argument passed.
92-
'array_udiff' => array( -1 ), // = last argument passed.
93-
'array_uintersect_assoc' => array( -1 ), // = last argument passed.
94-
'array_uintersect_uassoc' => array( -1, -2 ), // = last argument passed.
95-
'array_uintersect' => array( -1 ), // = last argument passed.
96-
'array_walk' => array( 2 ),
97-
'array_walk_recursive' => array( 2 ),
98-
'call_user_func' => array( 1 ),
99-
'call_user_func_array' => array( 1 ),
100-
'forward_static_call' => array( 1 ),
101-
'forward_static_call_array' => array( 1 ),
102-
'header_register_callback' => array( 1 ),
103-
'iterator_apply' => array( 2 ),
104-
'mb_ereg_replace_callback' => array( 2 ),
105-
'ob_start' => array( 1 ),
106-
'preg_replace_callback' => array( 2 ),
107-
'register_shutdown_function' => array( 1 ),
108-
'register_tick_function' => array( 1 ),
109-
'set_error_handler' => array( 1 ),
110-
'set_exception_handler' => array( 1 ),
111-
'uasort' => array( 2 ),
112-
'uksort' => array( 2 ),
113-
'usort' => array( 2 ),
114-
);
115-
11671
/**
11772
* Groups of functions to restrict.
11873
*
@@ -281,7 +236,7 @@ public function is_targetted_token( $stackPtr ) {
281236
* normal file processing.
282237
*/
283238
public function check_for_matches( $stackPtr ) {
284-
$token_content = strtolower( $this->strip_quotes( $this->tokens[ $stackPtr ]['content'] ) );
239+
$token_content = strtolower( $this->tokens[ $stackPtr ]['content'] );
285240
$skip_to = array();
286241

287242
foreach ( $this->groups as $groupName => $group ) {
@@ -314,7 +269,7 @@ public function check_for_matches( $stackPtr ) {
314269
*
315270
* @param int $stackPtr The position of the current token in the stack.
316271
*
317-
* @return int|void If a callback was found return stackPtr for where to skip to, false if the function call is not a callback.
272+
* @return int|void If a callback was found return stackPtr for where to skip to.
318273
*/
319274
public function check_for_callback_matches( $stackPtr ) {
320275

@@ -354,7 +309,7 @@ public function check_for_callback_matches( $stackPtr ) {
354309
return;
355310
}
356311

357-
$skip_to[] = $this->check_for_matches( $callback );
312+
$skip_to[] = $this->check_for_matches( $this->strip_quotes( $callback ) );
358313
}
359314

360315
if ( empty( $skip_to ) || min( $skip_to ) === 0 ) {

0 commit comments

Comments
 (0)