From 38ec33981a88f9f2a912b376d42a2bf06e4422cc Mon Sep 17 00:00:00 2001
From: Rebecca Hum <16962021+rebeccahum@users.noreply.github.com>
Date: Mon, 2 Dec 2019 15:39:08 -0700
Subject: [PATCH] Allow short array syntax and fix tests failing for
WordPress.Arrays.ArrayKeySpacingRestrictions.TooMuchSpaceAfterKey
---
.phpcs.xml.dist | 5 +++++
.../Sniffs/Functions/DynamicCallsSniff.php | 20 +++++--------------
2 files changed, 10 insertions(+), 15 deletions(-)
diff --git a/.phpcs.xml.dist b/.phpcs.xml.dist
index 5096365e..db53aea3 100644
--- a/.phpcs.xml.dist
+++ b/.phpcs.xml.dist
@@ -34,6 +34,11 @@
+
+
+
+
+
diff --git a/WordPressVIPMinimum/Sniffs/Functions/DynamicCallsSniff.php b/WordPressVIPMinimum/Sniffs/Functions/DynamicCallsSniff.php
index 05318571..e1f6a22e 100644
--- a/WordPressVIPMinimum/Sniffs/Functions/DynamicCallsSniff.php
+++ b/WordPressVIPMinimum/Sniffs/Functions/DynamicCallsSniff.php
@@ -106,9 +106,7 @@ private function collect_variables() {
return;
}
- $current_var_name = $this->tokens[
- $this->stackPtr
- ]['content'];
+ $current_var_name = $this->tokens[ $this->stackPtr ]['content'];
/*
* Find assignments ( $foo = "bar"; )
@@ -202,9 +200,7 @@ private function find_dynamic_calls() {
*/
if ( ! isset(
- $this->variables_arr[
- $this->tokens[ $this->stackPtr ]['content']
- ]
+ $this->variables_arr[ $this->tokens[ $this->stackPtr ]['content'] ]
) ) {
return;
}
@@ -220,16 +216,12 @@ private function find_dynamic_calls() {
$i++;
} while (
'T_WHITESPACE' ===
- $this->tokens[
- $this->stackPtr + $i
- ]['type']
+ $this->tokens[ $this->stackPtr + $i ]['type']
);
if (
'T_OPEN_PARENTHESIS' !==
- $this->tokens[
- $this->stackPtr + $i
- ]['type']
+ $this->tokens[ $this->stackPtr + $i ]['type']
) {
return;
}
@@ -242,9 +234,7 @@ private function find_dynamic_calls() {
*/
if ( ! in_array(
- $this->variables_arr[
- $this->tokens[ $this->stackPtr ]['content']
- ],
+ $this->variables_arr[ $this->tokens[ $this->stackPtr ]['content'] ],
$this->blacklisted_functions,
true
) ) {