Skip to content

Commit

Permalink
PHPCS 3.x compat: remove work-arounds for compatibility with PHP 5.2
Browse files Browse the repository at this point in the history
This should also allow the unit tests to pass against on PHP nightly.
  • Loading branch information
jrfnl committed Jul 25, 2017
1 parent ea76a40 commit 15307be
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion WordPress/Sniffs/VIP/ValidatedSanitizedInputSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ public function process_token( $stackPtr ) {
|| T_HEREDOC === $this->tokens[ $stackPtr ]['code']
) {
$interpolated_variables = array_map(
create_function( '$symbol', 'return "$" . $symbol;' ), // Replace with closure when 5.3 is minimum requirement for PHPCS.
function ( $symbol ) {
return '$' . $symbol;
},
$this->get_interpolated_variables( $this->tokens[ $stackPtr ]['content'] )
);
foreach ( array_intersect( $interpolated_variables, $superglobals ) as $bad_variable ) {
Expand Down
4 changes: 3 additions & 1 deletion WordPress/Sniffs/WP/PreparedSQLSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ public function process_token( $stackPtr ) {

$bad_variables = array_filter(
$this->get_interpolated_variables( $this->tokens[ $this->i ]['content'] ),
create_function( '$symbol', 'return ( $symbol !== "wpdb" );' ) // Replace this with closure once 5.3 is minimum requirement.
function ( $symbol ) {
return ( 'wpdb' !== $symbol );
}
);

foreach ( $bad_variables as $bad_variable ) {
Expand Down

0 comments on commit 15307be

Please sign in to comment.