Completed
Pull Request — develop (#1492)
by Zack
19:47 queued 51s
created
wpcs/WordPress/Sniffs/WP/DeprecatedClassesSniff.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -86,18 +86,18 @@
 block discarded – undo
86 86
 		$message = 'The %s class has been deprecated since WordPress version %s.';
87 87
 		$data    = array(
88 88
 			ltrim( $matched_content, '\\' ),
89
-			$this->deprecated_classes[ $class_name ]['version'],
89
+			$this->deprecated_classes[ $class_name ][ 'version' ],
90 90
 		);
91 91
 
92
-		if ( ! empty( $this->deprecated_classes[ $class_name ]['alt'] ) ) {
92
+		if ( ! empty( $this->deprecated_classes[ $class_name ][ 'alt' ] ) ) {
93 93
 			$message .= ' Use %s instead.';
94
-			$data[]   = $this->deprecated_classes[ $class_name ]['alt'];
94
+			$data[ ]   = $this->deprecated_classes[ $class_name ][ 'alt' ];
95 95
 		}
96 96
 
97 97
 		$this->addMessage(
98 98
 			$message,
99 99
 			$stackPtr,
100
-			( version_compare( $this->deprecated_classes[ $class_name ]['version'], $this->minimum_supported_version, '<' ) ),
100
+			( version_compare( $this->deprecated_classes[ $class_name ][ 'version' ], $this->minimum_supported_version, '<' ) ),
101 101
 			$this->string_to_errorcode( $class_name . 'Found' ),
102 102
 			$data
103 103
 		);
Please login to merge, or discard this patch.
wpcs/WordPress/Sniffs/WP/AlternativeFunctionsSniff.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -216,34 +216,34 @@  discard block
 block discarded – undo
216 216
 				 */
217 217
 				$params = $this->get_function_call_parameters( $stackPtr );
218 218
 
219
-				if ( isset( $params[2] ) && 'true' === $params[2]['raw'] ) {
219
+				if ( isset( $params[ 2 ] ) && 'true' === $params[ 2 ][ 'raw' ] ) {
220 220
 					// Setting `$use_include_path` to `true` is only relevant for local files.
221 221
 					return;
222 222
 				}
223 223
 
224
-				if ( isset( $params[1] ) === false ) {
224
+				if ( isset( $params[ 1 ] ) === false ) {
225 225
 					// If the file to get is not set, this is a non-issue anyway.
226 226
 					return;
227 227
 				}
228 228
 
229
-				if ( strpos( $params[1]['raw'], 'http:' ) !== false
230
-					|| strpos( $params[1]['raw'], 'https:' ) !== false
229
+				if ( strpos( $params[ 1 ][ 'raw' ], 'http:' ) !== false
230
+					|| strpos( $params[ 1 ][ 'raw' ], 'https:' ) !== false
231 231
 				) {
232 232
 					// Definitely a URL, throw notice.
233 233
 					break;
234 234
 				}
235 235
 
236
-				if ( preg_match( '`\b(?:ABSPATH|WP_(?:CONTENT|PLUGIN)_DIR|WPMU_PLUGIN_DIR|TEMPLATEPATH|STYLESHEETPATH|(?:MU)?PLUGINDIR)\b`', $params[1]['raw'] ) === 1 ) {
236
+				if ( preg_match( '`\b(?:ABSPATH|WP_(?:CONTENT|PLUGIN)_DIR|WPMU_PLUGIN_DIR|TEMPLATEPATH|STYLESHEETPATH|(?:MU)?PLUGINDIR)\b`', $params[ 1 ][ 'raw' ] ) === 1 ) {
237 237
 					// Using any of the constants matched in this regex is an indicator of a local file.
238 238
 					return;
239 239
 				}
240 240
 
241
-				if ( preg_match( '`(?:get_home_path|plugin_dir_path|get_(?:stylesheet|template)_directory|wp_upload_dir)\s*\(`i', $params[1]['raw'] ) === 1 ) {
241
+				if ( preg_match( '`(?:get_home_path|plugin_dir_path|get_(?:stylesheet|template)_directory|wp_upload_dir)\s*\(`i', $params[ 1 ][ 'raw' ] ) === 1 ) {
242 242
 					// Using any of the functions matched in the regex is an indicator of a local file.
243 243
 					return;
244 244
 				}
245 245
 
246
-				if ( $this->is_local_data_stream( $params[1]['raw'] ) === true ) {
246
+				if ( $this->is_local_data_stream( $params[ 1 ][ 'raw' ] ) === true ) {
247 247
 					// Local data stream.
248 248
 					return;
249 249
 				}
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 					break;
266 266
 				}
267 267
 
268
-				if ( $this->is_local_data_stream( $first_param['raw'] ) === true ) {
268
+				if ( $this->is_local_data_stream( $first_param[ 'raw' ] ) === true ) {
269 269
 					// Local data stream.
270 270
 					return;
271 271
 				}
@@ -279,12 +279,12 @@  discard block
 block discarded – undo
279 279
 				return;
280 280
 		}
281 281
 
282
-		if ( ! isset( $this->groups[ $group_name ]['since'] ) ) {
282
+		if ( ! isset( $this->groups[ $group_name ][ 'since' ] ) ) {
283 283
 			return parent::process_matched_token( $stackPtr, $group_name, $matched_content );
284 284
 		}
285 285
 
286 286
 		// Verify if the alternative is available in the minimum supported WP version.
287
-		if ( version_compare( $this->groups[ $group_name ]['since'], $this->minimum_supported_version, '<=' ) ) {
287
+		if ( version_compare( $this->groups[ $group_name ][ 'since' ], $this->minimum_supported_version, '<=' ) ) {
288 288
 			return parent::process_matched_token( $stackPtr, $group_name, $matched_content );
289 289
 		}
290 290
 	}
Please login to merge, or discard this patch.
wpcs/WordPress/Sniffs/WP/DiscouragedConstantsSniff.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 *                  normal file processing.
86 86
 	 */
87 87
 	public function process_token( $stackPtr ) {
88
-		if ( isset( $this->target_functions[ strtolower( $this->tokens[ $stackPtr ]['content'] ) ] ) ) {
88
+		if ( isset( $this->target_functions[ strtolower( $this->tokens[ $stackPtr ][ 'content' ] ) ] ) ) {
89 89
 			// Disallow excluding function groups for this sniff.
90 90
 			$this->exclude = array();
91 91
 
@@ -106,20 +106,20 @@  discard block
 block discarded – undo
106 106
 	 * @return void
107 107
 	 */
108 108
 	public function process_arbitrary_tstring( $stackPtr ) {
109
-		$content = $this->tokens[ $stackPtr ]['content'];
109
+		$content = $this->tokens[ $stackPtr ][ 'content' ];
110 110
 
111 111
 		if ( ! isset( $this->discouraged_constants[ $content ] ) ) {
112 112
 			return;
113 113
 		}
114 114
 
115 115
 		$next = $this->phpcsFile->findNext( Tokens::$emptyTokens, ( $stackPtr + 1 ), null, true );
116
-		if ( false !== $next && \T_OPEN_PARENTHESIS === $this->tokens[ $next ]['code'] ) {
116
+		if ( false !== $next && \T_OPEN_PARENTHESIS === $this->tokens[ $next ][ 'code' ] ) {
117 117
 			// Function call or declaration.
118 118
 			return;
119 119
 		}
120 120
 
121 121
 		$prev = $this->phpcsFile->findPrevious( Tokens::$emptyTokens, ( $stackPtr - 1 ), null, true );
122
-		if ( false !== $prev && isset( $this->preceding_tokens_to_ignore[ $this->tokens[ $prev ]['code'] ] ) ) {
122
+		if ( false !== $prev && isset( $this->preceding_tokens_to_ignore[ $this->tokens[ $prev ][ 'code' ] ] ) ) {
123 123
 			// Not the use of a constant.
124 124
 			return;
125 125
 		}
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 		}
131 131
 
132 132
 		if ( false !== $prev
133
-			&& \T_CONST === $this->tokens[ $prev ]['code']
133
+			&& \T_CONST === $this->tokens[ $prev ][ 'code' ]
134 134
 			&& true === $this->is_class_constant( $prev )
135 135
 		) {
136 136
 			// Class constant of the same name.
@@ -141,18 +141,18 @@  discard block
 block discarded – undo
141 141
 		 * Deal with a number of variations of use statements.
142 142
 		 */
143 143
 		for ( $i = $stackPtr; $i > 0; $i-- ) {
144
-			if ( $this->tokens[ $i ]['line'] !== $this->tokens[ $stackPtr ]['line'] ) {
144
+			if ( $this->tokens[ $i ][ 'line' ] !== $this->tokens[ $stackPtr ][ 'line' ] ) {
145 145
 				break;
146 146
 			}
147 147
 		}
148 148
 
149 149
 		$first_on_line = $this->phpcsFile->findNext( Tokens::$emptyTokens, ( $i + 1 ), null, true );
150
-		if ( false !== $first_on_line && \T_USE === $this->tokens[ $first_on_line ]['code'] ) {
150
+		if ( false !== $first_on_line && \T_USE === $this->tokens[ $first_on_line ][ 'code' ] ) {
151 151
 			$next_on_line = $this->phpcsFile->findNext( Tokens::$emptyTokens, ( $first_on_line + 1 ), null, true );
152 152
 			if ( false !== $next_on_line ) {
153
-				if ( ( \T_STRING === $this->tokens[ $next_on_line ]['code']
154
-						&& 'const' === $this->tokens[ $next_on_line ]['content'] )
155
-					|| \T_CONST === $this->tokens[ $next_on_line ]['code'] // Happens in some PHPCS versions.
153
+				if ( ( \T_STRING === $this->tokens[ $next_on_line ][ 'code' ]
154
+						&& 'const' === $this->tokens[ $next_on_line ][ 'content' ] )
155
+					|| \T_CONST === $this->tokens[ $next_on_line ][ 'code' ] // Happens in some PHPCS versions.
156 156
 				) {
157 157
 					$has_ns_sep = $this->phpcsFile->findNext( \T_NS_SEPARATOR, ( $next_on_line + 1 ), $stackPtr );
158 158
 					if ( false !== $has_ns_sep ) {
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 			return;
200 200
 		}
201 201
 
202
-		$raw_content = $this->strip_quotes( $parameters[ $target_param ]['raw'] );
202
+		$raw_content = $this->strip_quotes( $parameters[ $target_param ][ 'raw' ] );
203 203
 
204 204
 		if ( isset( $this->discouraged_constants[ $raw_content ] ) ) {
205 205
 			$this->phpcsFile->addWarning(
Please login to merge, or discard this patch.
wpcs/WordPress/Sniffs/WP/GlobalVariablesOverrideSniff.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -97,14 +97,14 @@  discard block
 block discarded – undo
97 97
 		$token = $this->tokens[ $stackPtr ];
98 98
 
99 99
 		// Ignore variable overrides in test classes.
100
-		if ( isset( Tokens::$ooScopeTokens[ $token['code'] ] ) ) {
100
+		if ( isset( Tokens::$ooScopeTokens[ $token[ 'code' ] ] ) ) {
101 101
 
102 102
 			if ( true === $this->is_test_class( $stackPtr )
103
-				&& $token['scope_condition'] === $stackPtr
104
-				&& isset( $token['scope_closer'] )
103
+				&& $token[ 'scope_condition' ] === $stackPtr
104
+				&& isset( $token[ 'scope_closer' ] )
105 105
 			) {
106 106
 				// Skip forward to end of test class.
107
-				return $token['scope_closer'];
107
+				return $token[ 'scope_closer' ];
108 108
 			}
109 109
 
110 110
 			// Otherwise ignore the tokens as they were only registered to enable skipping over test classes.
@@ -119,12 +119,12 @@  discard block
 block discarded – undo
119 119
 		 */
120 120
 		$in_function_scope = $this->phpcsFile->hasCondition( $stackPtr, array( \T_FUNCTION, \T_CLOSURE ) );
121 121
 
122
-		if ( \T_VARIABLE === $token['code']
123
-			&& ( '$GLOBALS' === $token['content']
122
+		if ( \T_VARIABLE === $token[ 'code' ]
123
+			&& ( '$GLOBALS' === $token[ 'content' ]
124 124
 				|| ( false === $in_function_scope && false === $this->treat_files_as_scoped ) )
125 125
 		) {
126 126
 			return $this->process_variable_assignment( $stackPtr );
127
-		} elseif ( \T_GLOBAL === $token['code']
127
+		} elseif ( \T_GLOBAL === $token[ 'code' ]
128 128
 			&& ( true === $in_function_scope || true === $this->treat_files_as_scoped )
129 129
 		) {
130 130
 			return $this->process_global_statement( $stackPtr, $in_function_scope );
@@ -147,34 +147,34 @@  discard block
 block discarded – undo
147 147
 		}
148 148
 
149 149
 		$token    = $this->tokens[ $stackPtr ];
150
-		$var_name = substr( $token['content'], 1 ); // Strip the dollar sign.
150
+		$var_name = substr( $token[ 'content' ], 1 ); // Strip the dollar sign.
151 151
 		$data     = array();
152 152
 
153 153
 		// Determine the variable name for `$GLOBALS['array_key']`.
154 154
 		if ( 'GLOBALS' === $var_name ) {
155 155
 			$bracketPtr = $this->phpcsFile->findNext( Tokens::$emptyTokens, ( $stackPtr + 1 ), null, true );
156 156
 
157
-			if ( false === $bracketPtr || \T_OPEN_SQUARE_BRACKET !== $this->tokens[ $bracketPtr ]['code'] || ! isset( $this->tokens[ $bracketPtr ]['bracket_closer'] ) ) {
157
+			if ( false === $bracketPtr || \T_OPEN_SQUARE_BRACKET !== $this->tokens[ $bracketPtr ][ 'code' ] || ! isset( $this->tokens[ $bracketPtr ][ 'bracket_closer' ] ) ) {
158 158
 				return;
159 159
 			}
160 160
 
161 161
 			// Retrieve the array key and avoid getting tripped up by some simple obfuscation.
162 162
 			$var_name = '';
163 163
 			$start    = ( $bracketPtr + 1 );
164
-			for ( $ptr = $start; $ptr < $this->tokens[ $bracketPtr ]['bracket_closer']; $ptr++ ) {
164
+			for ( $ptr = $start; $ptr < $this->tokens[ $bracketPtr ][ 'bracket_closer' ]; $ptr++ ) {
165 165
 				/*
166 166
 				 * If the globals array key contains a variable, constant, function call
167 167
 				 * or interpolated variable, bow out.
168 168
 				 */
169
-				if ( \T_VARIABLE === $this->tokens[ $ptr ]['code']
170
-					|| \T_STRING === $this->tokens[ $ptr ]['code']
171
-					|| \T_DOUBLE_QUOTED_STRING === $this->tokens[ $ptr ]['code']
169
+				if ( \T_VARIABLE === $this->tokens[ $ptr ][ 'code' ]
170
+					|| \T_STRING === $this->tokens[ $ptr ][ 'code' ]
171
+					|| \T_DOUBLE_QUOTED_STRING === $this->tokens[ $ptr ][ 'code' ]
172 172
 				) {
173 173
 					return;
174 174
 				}
175 175
 
176
-				if ( \T_CONSTANT_ENCAPSED_STRING === $this->tokens[ $ptr ]['code'] ) {
177
-					$var_name .= $this->strip_quotes( $this->tokens[ $ptr ]['content'] );
176
+				if ( \T_CONSTANT_ENCAPSED_STRING === $this->tokens[ $ptr ][ 'code' ] ) {
177
+					$var_name .= $this->strip_quotes( $this->tokens[ $ptr ][ 'content' ] );
178 178
 				}
179 179
 			}
180 180
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 			}
185 185
 
186 186
 			// Set up the data for the error message.
187
-			$data[] = '$GLOBALS[\'' . $var_name . '\']';
187
+			$data[ ] = '$GLOBALS[\'' . $var_name . '\']';
188 188
 		}
189 189
 
190 190
 		/*
@@ -207,11 +207,11 @@  discard block
 block discarded – undo
207 207
 		 * Function parameters with the same name as a WP global variable are fine,
208 208
 		 * including when they are being assigned a default value.
209 209
 		 */
210
-		if ( isset( $this->tokens[ $stackPtr ]['nested_parenthesis'] ) ) {
211
-			foreach ( $this->tokens[ $stackPtr ]['nested_parenthesis'] as $opener => $closer ) {
212
-				if ( isset( $this->tokens[ $opener ]['parenthesis_owner'] )
213
-					&& ( \T_FUNCTION === $this->tokens[ $this->tokens[ $opener ]['parenthesis_owner'] ]['code']
214
-						|| \T_CLOSURE === $this->tokens[ $this->tokens[ $opener ]['parenthesis_owner'] ]['code'] )
210
+		if ( isset( $this->tokens[ $stackPtr ][ 'nested_parenthesis' ] ) ) {
211
+			foreach ( $this->tokens[ $stackPtr ][ 'nested_parenthesis' ] as $opener => $closer ) {
212
+				if ( isset( $this->tokens[ $opener ][ 'parenthesis_owner' ] )
213
+					&& ( \T_FUNCTION === $this->tokens[ $this->tokens[ $opener ][ 'parenthesis_owner' ] ][ 'code' ]
214
+						|| \T_CLOSURE === $this->tokens[ $this->tokens[ $opener ][ 'parenthesis_owner' ] ][ 'code' ] )
215 215
 				) {
216 216
 					return;
217 217
 				}
@@ -251,13 +251,13 @@  discard block
 block discarded – undo
251 251
 			$var = $this->tokens[ $ptr ];
252 252
 
253 253
 			// Halt the loop at end of statement.
254
-			if ( \T_SEMICOLON === $var['code'] ) {
254
+			if ( \T_SEMICOLON === $var[ 'code' ] ) {
255 255
 				break;
256 256
 			}
257 257
 
258
-			if ( \T_VARIABLE === $var['code'] ) {
259
-				if ( isset( $this->wp_globals[ substr( $var['content'], 1 ) ] ) ) {
260
-					$search[] = $var['content'];
258
+			if ( \T_VARIABLE === $var[ 'code' ] ) {
259
+				if ( isset( $this->wp_globals[ substr( $var[ 'content' ], 1 ) ] ) ) {
260
+					$search[ ] = $var[ 'content' ];
261 261
 				}
262 262
 			}
263 263
 
@@ -277,11 +277,11 @@  discard block
 block discarded – undo
277 277
 			$function_cond = $this->phpcsFile->getCondition( $stackPtr, \T_FUNCTION );
278 278
 			$closure_cond  = $this->phpcsFile->getCondition( $stackPtr, \T_CLOSURE );
279 279
 			$scope_cond    = max( $function_cond, $closure_cond ); // If false, it will evaluate as zero, so this is fine.
280
-			if ( isset( $this->tokens[ $scope_cond ]['scope_closer'] ) === false ) {
280
+			if ( isset( $this->tokens[ $scope_cond ][ 'scope_closer' ] ) === false ) {
281 281
 				// Live coding or parse error.
282 282
 				return;
283 283
 			}
284
-			$end = $this->tokens[ $scope_cond ]['scope_closer'];
284
+			$end = $this->tokens[ $scope_cond ][ 'scope_closer' ];
285 285
 		} else {
286 286
 			// Global statement in the global namespace with file is being treated as scoped.
287 287
 			$end = ( $this->phpcsFile->numTokens + 1 );
@@ -290,21 +290,21 @@  discard block
 block discarded – undo
290 290
 		for ( $ptr = $start; $ptr < $end; $ptr++ ) {
291 291
 
292 292
 			// Skip over nested functions, classes and the likes.
293
-			if ( isset( $this->skip_over[ $this->tokens[ $ptr ]['code'] ] ) ) {
294
-				if ( ! isset( $this->tokens[ $ptr ]['scope_closer'] ) ) {
293
+			if ( isset( $this->skip_over[ $this->tokens[ $ptr ][ 'code' ] ] ) ) {
294
+				if ( ! isset( $this->tokens[ $ptr ][ 'scope_closer' ] ) ) {
295 295
 					// Live coding or parse error.
296 296
 					break;
297 297
 				}
298 298
 
299
-				$ptr = $this->tokens[ $ptr ]['scope_closer'];
299
+				$ptr = $this->tokens[ $ptr ][ 'scope_closer' ];
300 300
 				continue;
301 301
 			}
302 302
 
303
-			if ( \T_VARIABLE !== $this->tokens[ $ptr ]['code'] ) {
303
+			if ( \T_VARIABLE !== $this->tokens[ $ptr ][ 'code' ] ) {
304 304
 				continue;
305 305
 			}
306 306
 
307
-			if ( \in_array( $this->tokens[ $ptr ]['content'], $search, true ) === false ) {
307
+			if ( \in_array( $this->tokens[ $ptr ][ 'content' ], $search, true ) === false ) {
308 308
 				// Not one of the variables we're interested in.
309 309
 				continue;
310 310
 			}
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 	 */
358 358
 	protected function add_error( $stackPtr, $data = array() ) {
359 359
 		if ( empty( $data ) ) {
360
-			$data[] = $this->tokens[ $stackPtr ]['content'];
360
+			$data[ ] = $this->tokens[ $stackPtr ][ 'content' ];
361 361
 		}
362 362
 
363 363
 		$this->phpcsFile->addError(
Please login to merge, or discard this patch.
wpcs/WordPress/Sniffs/WP/DeprecatedParametersSniff.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 			}
291 291
 
292 292
 			// The list will need to updated if the default value is not supported.
293
-			switch ( $parameters[ $position ]['raw'] ) {
293
+			switch ( $parameters[ $position ][ 'raw' ] ) {
294 294
 				case 'true':
295 295
 					$matched_parameter = true;
296 296
 					break;
@@ -305,28 +305,28 @@  discard block
 block discarded – undo
305 305
 					$matched_parameter = array();
306 306
 					break;
307 307
 				default:
308
-					$matched_parameter = $this->strip_quotes( $parameters[ $position ]['raw'] );
308
+					$matched_parameter = $this->strip_quotes( $parameters[ $position ][ 'raw' ] );
309 309
 					break;
310 310
 			}
311 311
 
312
-			if ( $parameter_args['value'] === $matched_parameter ) {
312
+			if ( $parameter_args[ 'value' ] === $matched_parameter ) {
313 313
 				continue;
314 314
 			}
315 315
 
316 316
 			$message  = 'The parameter "%s" at position #%s of %s() has been deprecated since WordPress version %s.';
317
-			$is_error = version_compare( $parameter_args['version'], $this->minimum_supported_version, '<' );
317
+			$is_error = version_compare( $parameter_args[ 'version' ], $this->minimum_supported_version, '<' );
318 318
 			$code     = $this->string_to_errorcode( ucfirst( $matched_content ) . 'Param' . $position . 'Found' );
319 319
 
320 320
 			$data = array(
321
-				$parameters[ $position ]['raw'],
321
+				$parameters[ $position ][ 'raw' ],
322 322
 				$position,
323 323
 				$matched_content,
324
-				$parameter_args['version'],
324
+				$parameter_args[ 'version' ],
325 325
 			);
326 326
 
327
-			if ( isset( $parameter_args['value'] ) && $position < $paramCount ) {
327
+			if ( isset( $parameter_args[ 'value' ] ) && $position < $paramCount ) {
328 328
 				$message .= ' Use "%s" instead.';
329
-				$data[]   = (string) $parameter_args['value'];
329
+				$data[ ]   = (string)$parameter_args[ 'value' ];
330 330
 			} else {
331 331
 				$message .= ' Instead do not pass the parameter.';
332 332
 			}
Please login to merge, or discard this patch.
wpcs/WordPress/Sniffs/WP/I18nSniff.php 1 patch
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -229,8 +229,8 @@  discard block
 block discarded – undo
229 229
 
230 230
 		$func_open_paren_token = $this->phpcsFile->findNext( Tokens::$emptyTokens, ( $stack_ptr + 1 ), null, true );
231 231
 		if ( false === $func_open_paren_token
232
-			|| \T_OPEN_PARENTHESIS !== $this->tokens[ $func_open_paren_token ]['code']
233
-			|| ! isset( $this->tokens[ $func_open_paren_token ]['parenthesis_closer'] )
232
+			|| \T_OPEN_PARENTHESIS !== $this->tokens[ $func_open_paren_token ][ 'code' ]
233
+			|| ! isset( $this->tokens[ $func_open_paren_token ][ 'parenthesis_closer' ] )
234 234
 		) {
235 235
 			// Live coding, parse error or not a function call.
236 236
 			return;
@@ -250,128 +250,128 @@  discard block
 block discarded – undo
250 250
 		$tokens           = $this->tokens;
251 251
 
252 252
 		// Look at arguments.
253
-		for ( $i = ( $func_open_paren_token + 1 ); $i < $this->tokens[ $func_open_paren_token ]['parenthesis_closer']; $i++ ) {
253
+		for ( $i = ( $func_open_paren_token + 1 ); $i < $this->tokens[ $func_open_paren_token ][ 'parenthesis_closer' ]; $i++ ) {
254 254
 			$this_token                = $this->tokens[ $i ];
255
-			$this_token['token_index'] = $i;
256
-			if ( isset( Tokens::$emptyTokens[ $this_token['code'] ] ) ) {
255
+			$this_token[ 'token_index' ] = $i;
256
+			if ( isset( Tokens::$emptyTokens[ $this_token[ 'code' ] ] ) ) {
257 257
 				continue;
258 258
 			}
259
-			if ( \T_COMMA === $this_token['code'] ) {
260
-				$arguments_tokens[] = $argument_tokens;
259
+			if ( \T_COMMA === $this_token[ 'code' ] ) {
260
+				$arguments_tokens[ ] = $argument_tokens;
261 261
 				$argument_tokens    = array();
262 262
 				continue;
263 263
 			}
264 264
 
265 265
 			// Merge consecutive single or double quoted strings (when they span multiple lines).
266
-			if ( isset( Tokens::$textStringTokens[ $this_token['code'] ] ) ) {
267
-				for ( $j = ( $i + 1 ); $j < $this->tokens[ $func_open_paren_token ]['parenthesis_closer']; $j++ ) {
268
-					if ( $this_token['code'] === $this->tokens[ $j ]['code'] ) {
269
-						$this_token['content'] .= $this->tokens[ $j ]['content'];
266
+			if ( isset( Tokens::$textStringTokens[ $this_token[ 'code' ] ] ) ) {
267
+				for ( $j = ( $i + 1 ); $j < $this->tokens[ $func_open_paren_token ][ 'parenthesis_closer' ]; $j++ ) {
268
+					if ( $this_token[ 'code' ] === $this->tokens[ $j ][ 'code' ] ) {
269
+						$this_token[ 'content' ] .= $this->tokens[ $j ][ 'content' ];
270 270
 						$i                      = $j;
271 271
 					} else {
272 272
 						break;
273 273
 					}
274 274
 				}
275 275
 			}
276
-			$argument_tokens[] = $this_token;
276
+			$argument_tokens[ ] = $this_token;
277 277
 
278 278
 			// Include everything up to and including the parenthesis_closer if this token has one.
279
-			if ( ! empty( $this_token['parenthesis_closer'] ) ) {
280
-				for ( $j = ( $i + 1 ); $j <= $this_token['parenthesis_closer']; $j++ ) {
281
-					$tokens[ $j ]['token_index'] = $j;
282
-					$argument_tokens[]           = $tokens[ $j ];
279
+			if ( ! empty( $this_token[ 'parenthesis_closer' ] ) ) {
280
+				for ( $j = ( $i + 1 ); $j <= $this_token[ 'parenthesis_closer' ]; $j++ ) {
281
+					$tokens[ $j ][ 'token_index' ] = $j;
282
+					$argument_tokens[ ]           = $tokens[ $j ];
283 283
 				}
284
-				$i = $this_token['parenthesis_closer'];
284
+				$i = $this_token[ 'parenthesis_closer' ];
285 285
 			}
286 286
 		}
287 287
 
288 288
 		if ( ! empty( $argument_tokens ) ) {
289
-			$arguments_tokens[] = $argument_tokens;
289
+			$arguments_tokens[ ] = $argument_tokens;
290 290
 		}
291 291
 		unset( $argument_tokens );
292 292
 
293 293
 		$argument_assertions = array();
294 294
 		if ( 'simple' === $this->i18n_functions[ $matched_content ] ) {
295
-			$argument_assertions[] = array(
295
+			$argument_assertions[ ] = array(
296 296
 				'arg_name' => 'text',
297 297
 				'tokens'   => array_shift( $arguments_tokens ),
298 298
 			);
299
-			$argument_assertions[] = array(
299
+			$argument_assertions[ ] = array(
300 300
 				'arg_name' => 'domain',
301 301
 				'tokens'   => array_shift( $arguments_tokens ),
302 302
 			);
303 303
 		} elseif ( 'context' === $this->i18n_functions[ $matched_content ] ) {
304
-			$argument_assertions[] = array(
304
+			$argument_assertions[ ] = array(
305 305
 				'arg_name' => 'text',
306 306
 				'tokens'   => array_shift( $arguments_tokens ),
307 307
 			);
308
-			$argument_assertions[] = array(
308
+			$argument_assertions[ ] = array(
309 309
 				'arg_name' => 'context',
310 310
 				'tokens'   => array_shift( $arguments_tokens ),
311 311
 			);
312
-			$argument_assertions[] = array(
312
+			$argument_assertions[ ] = array(
313 313
 				'arg_name' => 'domain',
314 314
 				'tokens'   => array_shift( $arguments_tokens ),
315 315
 			);
316 316
 		} elseif ( 'number' === $this->i18n_functions[ $matched_content ] ) {
317
-			$argument_assertions[] = array(
317
+			$argument_assertions[ ] = array(
318 318
 				'arg_name' => 'single',
319 319
 				'tokens'   => array_shift( $arguments_tokens ),
320 320
 			);
321
-			$argument_assertions[] = array(
321
+			$argument_assertions[ ] = array(
322 322
 				'arg_name' => 'plural',
323 323
 				'tokens'   => array_shift( $arguments_tokens ),
324 324
 			);
325 325
 			array_shift( $arguments_tokens );
326
-			$argument_assertions[] = array(
326
+			$argument_assertions[ ] = array(
327 327
 				'arg_name' => 'domain',
328 328
 				'tokens'   => array_shift( $arguments_tokens ),
329 329
 			);
330 330
 		} elseif ( 'number_context' === $this->i18n_functions[ $matched_content ] ) {
331
-			$argument_assertions[] = array(
331
+			$argument_assertions[ ] = array(
332 332
 				'arg_name' => 'single',
333 333
 				'tokens'   => array_shift( $arguments_tokens ),
334 334
 			);
335
-			$argument_assertions[] = array(
335
+			$argument_assertions[ ] = array(
336 336
 				'arg_name' => 'plural',
337 337
 				'tokens'   => array_shift( $arguments_tokens ),
338 338
 			);
339 339
 			array_shift( $arguments_tokens );
340
-			$argument_assertions[] = array(
340
+			$argument_assertions[ ] = array(
341 341
 				'arg_name' => 'context',
342 342
 				'tokens'   => array_shift( $arguments_tokens ),
343 343
 			);
344
-			$argument_assertions[] = array(
344
+			$argument_assertions[ ] = array(
345 345
 				'arg_name' => 'domain',
346 346
 				'tokens'   => array_shift( $arguments_tokens ),
347 347
 			);
348 348
 		} elseif ( 'noopnumber' === $this->i18n_functions[ $matched_content ] ) {
349
-			$argument_assertions[] = array(
349
+			$argument_assertions[ ] = array(
350 350
 				'arg_name' => 'single',
351 351
 				'tokens'   => array_shift( $arguments_tokens ),
352 352
 			);
353
-			$argument_assertions[] = array(
353
+			$argument_assertions[ ] = array(
354 354
 				'arg_name' => 'plural',
355 355
 				'tokens'   => array_shift( $arguments_tokens ),
356 356
 			);
357
-			$argument_assertions[] = array(
357
+			$argument_assertions[ ] = array(
358 358
 				'arg_name' => 'domain',
359 359
 				'tokens'   => array_shift( $arguments_tokens ),
360 360
 			);
361 361
 		} elseif ( 'noopnumber_context' === $this->i18n_functions[ $matched_content ] ) {
362
-			$argument_assertions[] = array(
362
+			$argument_assertions[ ] = array(
363 363
 				'arg_name' => 'single',
364 364
 				'tokens'   => array_shift( $arguments_tokens ),
365 365
 			);
366
-			$argument_assertions[] = array(
366
+			$argument_assertions[ ] = array(
367 367
 				'arg_name' => 'plural',
368 368
 				'tokens'   => array_shift( $arguments_tokens ),
369 369
 			);
370
-			$argument_assertions[] = array(
370
+			$argument_assertions[ ] = array(
371 371
 				'arg_name' => 'context',
372 372
 				'tokens'   => array_shift( $arguments_tokens ),
373 373
 			);
374
-			$argument_assertions[] = array(
374
+			$argument_assertions[ ] = array(
375 375
 				'arg_name' => 'domain',
376 376
 				'tokens'   => array_shift( $arguments_tokens ),
377 377
 			);
@@ -382,18 +382,18 @@  discard block
 block discarded – undo
382 382
 		}
383 383
 
384 384
 		foreach ( $argument_assertions as $argument_assertion_context ) {
385
-			if ( empty( $argument_assertion_context['tokens'][0] ) ) {
386
-				$argument_assertion_context['stack_ptr'] = $func_open_paren_token;
385
+			if ( empty( $argument_assertion_context[ 'tokens' ][ 0 ] ) ) {
386
+				$argument_assertion_context[ 'stack_ptr' ] = $func_open_paren_token;
387 387
 			} else {
388
-				$argument_assertion_context['stack_ptr'] = $argument_assertion_context['tokens'][0]['token_index'];
388
+				$argument_assertion_context[ 'stack_ptr' ] = $argument_assertion_context[ 'tokens' ][ 0 ][ 'token_index' ];
389 389
 			}
390 390
 			$this->check_argument_tokens( $argument_assertion_context );
391 391
 		}
392 392
 
393 393
 		// For _n*() calls, compare the singular and plural strings.
394 394
 		if ( false !== strpos( $this->i18n_functions[ $matched_content ], 'number' ) ) {
395
-			$single_context = $argument_assertions[0];
396
-			$plural_context = $argument_assertions[1];
395
+			$single_context = $argument_assertions[ 0 ];
396
+			$plural_context = $argument_assertions[ 1 ];
397 397
 
398 398
 			$this->compare_single_and_plural_arguments( $stack_ptr, $single_context, $plural_context );
399 399
 		}
@@ -410,11 +410,11 @@  discard block
 block discarded – undo
410 410
 	 * @return bool
411 411
 	 */
412 412
 	protected function check_argument_tokens( $context ) {
413
-		$stack_ptr = $context['stack_ptr'];
414
-		$tokens    = $context['tokens'];
415
-		$arg_name  = $context['arg_name'];
416
-		$is_error  = empty( $context['warning'] );
417
-		$content   = isset( $tokens[0] ) ? $tokens[0]['content'] : '';
413
+		$stack_ptr = $context[ 'stack_ptr' ];
414
+		$tokens    = $context[ 'tokens' ];
415
+		$arg_name  = $context[ 'arg_name' ];
416
+		$is_error  = empty( $context[ 'warning' ] );
417
+		$content   = isset( $tokens[ 0 ] ) ? $tokens[ 0 ][ 'content' ] : '';
418 418
 
419 419
 		if ( empty( $tokens ) || 0 === \count( $tokens ) ) {
420 420
 			$code = $this->string_to_errorcode( 'MissingArg' . ucfirst( $arg_name ) );
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 		if ( \count( $tokens ) > 1 ) {
446 446
 			$contents = '';
447 447
 			foreach ( $tokens as $token ) {
448
-				$contents .= $token['content'];
448
+				$contents .= $token[ 'content' ];
449 449
 			}
450 450
 			$code = $this->string_to_errorcode( 'NonSingularStringLiteral' . ucfirst( $arg_name ) );
451 451
 			$this->addMessage( 'The $%s arg must be a single string literal, not "%s".', $stack_ptr, $is_error, $code, array( $arg_name, $contents ) );
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
 			$this->check_text( $context );
457 457
 		}
458 458
 
459
-		if ( \T_DOUBLE_QUOTED_STRING === $tokens[0]['code'] || \T_HEREDOC === $tokens[0]['code'] ) {
459
+		if ( \T_DOUBLE_QUOTED_STRING === $tokens[ 0 ][ 'code' ] || \T_HEREDOC === $tokens[ 0 ][ 'code' ] ) {
460 460
 			$interpolated_variables = $this->get_interpolated_variables( $content );
461 461
 			foreach ( $interpolated_variables as $interpolated_variable ) {
462 462
 				$code = $this->string_to_errorcode( 'InterpolatedVariable' . ucfirst( $arg_name ) );
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
 			}
468 468
 		}
469 469
 
470
-		if ( isset( Tokens::$textStringTokens[ $tokens[0]['code'] ] ) ) {
470
+		if ( isset( Tokens::$textStringTokens[ $tokens[ 0 ][ 'code' ] ] ) ) {
471 471
 			if ( 'domain' === $arg_name && ! empty( $this->text_domain ) ) {
472 472
 				$stripped_content = $this->strip_quotes( $content );
473 473
 
@@ -487,9 +487,9 @@  discard block
 block discarded – undo
487 487
 					$error      = 'No need to supply the text domain when the only accepted text domain is "default".';
488 488
 					$error_code = 'SuperfluousDefaultTextDomain';
489 489
 
490
-					if ( $tokens[0]['token_index'] === $stack_ptr ) {
490
+					if ( $tokens[ 0 ][ 'token_index' ] === $stack_ptr ) {
491 491
 						$prev = $this->phpcsFile->findPrevious( \T_WHITESPACE, ( $stack_ptr - 1 ), null, true );
492
-						if ( false !== $prev && \T_COMMA === $this->tokens[ $prev ]['code'] ) {
492
+						if ( false !== $prev && \T_COMMA === $this->tokens[ $prev ][ 'code' ] ) {
493 493
 							$fixable = true;
494 494
 						}
495 495
 					}
@@ -530,20 +530,20 @@  discard block
 block discarded – undo
530 530
 	 * @return void
531 531
 	 */
532 532
 	protected function compare_single_and_plural_arguments( $stack_ptr, $single_context, $plural_context ) {
533
-		$single_content = $single_context['tokens'][0]['content'];
534
-		$plural_content = $plural_context['tokens'][0]['content'];
533
+		$single_content = $single_context[ 'tokens' ][ 0 ][ 'content' ];
534
+		$plural_content = $plural_context[ 'tokens' ][ 0 ][ 'content' ];
535 535
 
536 536
 		preg_match_all( self::SPRINTF_PLACEHOLDER_REGEX, $single_content, $single_placeholders );
537
-		$single_placeholders = $single_placeholders[0];
537
+		$single_placeholders = $single_placeholders[ 0 ];
538 538
 
539 539
 		preg_match_all( self::SPRINTF_PLACEHOLDER_REGEX, $plural_content, $plural_placeholders );
540
-		$plural_placeholders = $plural_placeholders[0];
540
+		$plural_placeholders = $plural_placeholders[ 0 ];
541 541
 
542 542
 		// English conflates "singular" with "only one", described in the codex:
543 543
 		// https://codex.wordpress.org/I18n_for_WordPress_Developers#Plurals .
544 544
 		if ( \count( $single_placeholders ) < \count( $plural_placeholders ) ) {
545 545
 			$error_string = 'Missing singular placeholder, needed for some languages. See https://codex.wordpress.org/I18n_for_WordPress_Developers#Plurals';
546
-			$single_index = $single_context['tokens'][0]['token_index'];
546
+			$single_index = $single_context[ 'tokens' ][ 0 ][ 'token_index' ];
547 547
 
548 548
 			$this->phpcsFile->addError( $error_string, $single_index, 'MissingSingularPlaceholder' );
549 549
 		}
@@ -564,14 +564,14 @@  discard block
 block discarded – undo
564 564
 	 * @return void
565 565
 	 */
566 566
 	protected function check_text( $context ) {
567
-		$stack_ptr = $context['stack_ptr'];
568
-		$arg_name  = $context['arg_name'];
569
-		$content   = $context['tokens'][0]['content'];
570
-		$is_error  = empty( $context['warning'] );
567
+		$stack_ptr = $context[ 'stack_ptr' ];
568
+		$arg_name  = $context[ 'arg_name' ];
569
+		$content   = $context[ 'tokens' ][ 0 ][ 'content' ];
570
+		$is_error  = empty( $context[ 'warning' ] );
571 571
 
572 572
 		// UnorderedPlaceholders: Check for multiple unordered placeholders.
573 573
 		$unordered_matches_count = preg_match_all( self::UNORDERED_SPRINTF_PLACEHOLDER_REGEX, $content, $unordered_matches );
574
-		$unordered_matches       = $unordered_matches[0];
574
+		$unordered_matches       = $unordered_matches[ 0 ];
575 575
 		$all_matches_count       = preg_match_all( self::SPRINTF_PLACEHOLDER_REGEX, $content, $all_matches );
576 576
 
577 577
 		if ( $unordered_matches_count > 0 && $unordered_matches_count !== $all_matches_count && $all_matches_count > 1 ) {
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
 				'Multiple placeholders should be ordered. Mix of ordered and non-ordered placeholders found. Found: %s.',
581 581
 				$stack_ptr,
582 582
 				$code,
583
-				array( implode( ', ', $all_matches[0] ) )
583
+				array( implode( ', ', $all_matches[ 0 ] ) )
584 584
 			);
585 585
 
586 586
 		} elseif ( $unordered_matches_count >= 2 ) {
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
 			$replacements    = array();
592 592
 			for ( $i = 0; $i < $unordered_matches_count; $i++ ) {
593 593
 				$to_insert         = ( $i + 1 );
594
-				$to_insert        .= ( '"' !== $content[0] ) ? '$' : '\$';
594
+				$to_insert        .= ( '"' !== $content[ 0 ] ) ? '$' : '\$';
595 595
 				$suggestions[ $i ] = substr_replace( $unordered_matches[ $i ], $to_insert, 1, 0 );
596 596
 
597 597
 				// Prepare the strings for use a regex.
@@ -639,20 +639,20 @@  discard block
 block discarded – undo
639 639
 	 */
640 640
 	protected function check_for_translator_comment( $stack_ptr, $args ) {
641 641
 		foreach ( $args as $arg ) {
642
-			if ( false === \in_array( $arg['arg_name'], array( 'text', 'single', 'plural' ), true ) ) {
642
+			if ( false === \in_array( $arg[ 'arg_name' ], array( 'text', 'single', 'plural' ), true ) ) {
643 643
 				continue;
644 644
 			}
645 645
 
646
-			if ( empty( $arg['tokens'] ) ) {
646
+			if ( empty( $arg[ 'tokens' ] ) ) {
647 647
 				continue;
648 648
 			}
649 649
 
650
-			foreach ( $arg['tokens'] as $token ) {
651
-				if ( empty( $token['content'] ) ) {
650
+			foreach ( $arg[ 'tokens' ] as $token ) {
651
+				if ( empty( $token[ 'content' ] ) ) {
652 652
 					continue;
653 653
 				}
654 654
 
655
-				if ( preg_match( self::SPRINTF_PLACEHOLDER_REGEX, $token['content'], $placeholders ) < 1 ) {
655
+				if ( preg_match( self::SPRINTF_PLACEHOLDER_REGEX, $token[ 'content' ], $placeholders ) < 1 ) {
656 656
 					// No placeholders found.
657 657
 					continue;
658 658
 				}
@@ -666,11 +666,11 @@  discard block
 block discarded – undo
666 666
 					 */
667 667
 					$correctly_placed = false;
668 668
 
669
-					if ( ( $this->tokens[ $previous_comment ]['line'] + 1 ) === $this->tokens[ $stack_ptr ]['line'] ) {
669
+					if ( ( $this->tokens[ $previous_comment ][ 'line' ] + 1 ) === $this->tokens[ $stack_ptr ][ 'line' ] ) {
670 670
 						$correctly_placed = true;
671 671
 					} else {
672 672
 						$next_non_whitespace = $this->phpcsFile->findNext( \T_WHITESPACE, ( $previous_comment + 1 ), $stack_ptr, true );
673
-						if ( false === $next_non_whitespace || $this->tokens[ $next_non_whitespace ]['line'] === $this->tokens[ $stack_ptr ]['line'] ) {
673
+						if ( false === $next_non_whitespace || $this->tokens[ $next_non_whitespace ][ 'line' ] === $this->tokens[ $stack_ptr ][ 'line' ] ) {
674 674
 							// No non-whitespace found or next non-whitespace is on same line as gettext call.
675 675
 							$correctly_placed = true;
676 676
 						}
@@ -682,17 +682,17 @@  discard block
 block discarded – undo
682 682
 					 */
683 683
 					if ( true === $correctly_placed ) {
684 684
 
685
-						if ( \T_COMMENT === $this->tokens[ $previous_comment ]['code'] ) {
686
-							$comment_text = trim( $this->tokens[ $previous_comment ]['content'] );
685
+						if ( \T_COMMENT === $this->tokens[ $previous_comment ][ 'code' ] ) {
686
+							$comment_text = trim( $this->tokens[ $previous_comment ][ 'content' ] );
687 687
 
688 688
 							// If it's multi-line /* */ comment, collect all the parts.
689 689
 							if ( '*/' === substr( $comment_text, -2 ) && '/*' !== substr( $comment_text, 0, 2 ) ) {
690 690
 								for ( $i = ( $previous_comment - 1 ); 0 <= $i; $i-- ) {
691
-									if ( \T_COMMENT !== $this->tokens[ $i ]['code'] ) {
691
+									if ( \T_COMMENT !== $this->tokens[ $i ][ 'code' ] ) {
692 692
 										break;
693 693
 									}
694 694
 
695
-									$comment_text = trim( $this->tokens[ $i ]['content'] ) . $comment_text;
695
+									$comment_text = trim( $this->tokens[ $i ][ 'content' ] ) . $comment_text;
696 696
 								}
697 697
 							}
698 698
 
@@ -700,12 +700,12 @@  discard block
 block discarded – undo
700 700
 								// Comment is ok.
701 701
 								return;
702 702
 							}
703
-						} elseif ( \T_DOC_COMMENT_CLOSE_TAG === $this->tokens[ $previous_comment ]['code'] ) {
703
+						} elseif ( \T_DOC_COMMENT_CLOSE_TAG === $this->tokens[ $previous_comment ][ 'code' ] ) {
704 704
 							// If it's docblock comment (wrong style) make sure that it's a translators comment.
705 705
 							$db_start      = $this->phpcsFile->findPrevious( \T_DOC_COMMENT_OPEN_TAG, ( $previous_comment - 1 ) );
706 706
 							$db_first_text = $this->phpcsFile->findNext( \T_DOC_COMMENT_STRING, ( $db_start + 1 ), $previous_comment );
707 707
 
708
-							if ( true === $this->is_translators_comment( $this->tokens[ $db_first_text ]['content'] ) ) {
708
+							if ( true === $this->is_translators_comment( $this->tokens[ $db_first_text ][ 'content' ] ) ) {
709 709
 								$this->phpcsFile->addWarning(
710 710
 									'A "translators:" comment must be a "/* */" style comment. Docblock comments will not be picked up by the tools to generate a ".pot" file.',
711 711
 									$stack_ptr,
Please login to merge, or discard this patch.
wpcs/WordPress/Sniffs/WP/DeprecatedParameterValuesSniff.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -178,8 +178,8 @@  discard block
 block discarded – undo
178 178
 
179 179
 		$parameter_position = $this->phpcsFile->findNext(
180 180
 			Tokens::$emptyTokens,
181
-			$parameter['start'],
182
-			$parameter['end'] + 1,
181
+			$parameter[ 'start' ],
182
+			$parameter[ 'end' ] + 1,
183 183
 			true
184 184
 		);
185 185
 
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 			return;
188 188
 		}
189 189
 
190
-		$matched_parameter = $this->strip_quotes( $this->tokens[ $parameter_position ]['content'] );
190
+		$matched_parameter = $this->strip_quotes( $this->tokens[ $parameter_position ][ 'content' ] );
191 191
 		if ( ! isset( $parameter_args[ $matched_parameter ] ) ) {
192 192
 			return;
193 193
 		}
@@ -195,15 +195,15 @@  discard block
 block discarded – undo
195 195
 		$message = 'The parameter value "%s" has been deprecated since WordPress version %s.';
196 196
 		$data    = array(
197 197
 			$matched_parameter,
198
-			$parameter_args[ $matched_parameter ]['version'],
198
+			$parameter_args[ $matched_parameter ][ 'version' ],
199 199
 		);
200 200
 
201
-		if ( ! empty( $parameter_args[ $matched_parameter ]['alt'] ) ) {
201
+		if ( ! empty( $parameter_args[ $matched_parameter ][ 'alt' ] ) ) {
202 202
 			$message .= ' Use %s instead.';
203
-			$data[]   = $parameter_args[ $matched_parameter ]['alt'];
203
+			$data[ ]   = $parameter_args[ $matched_parameter ][ 'alt' ];
204 204
 		}
205 205
 
206
-		$is_error = version_compare( $parameter_args[ $matched_parameter ]['version'], $this->minimum_supported_version, '<' );
206
+		$is_error = version_compare( $parameter_args[ $matched_parameter ][ 'version' ], $this->minimum_supported_version, '<' );
207 207
 		$this->addMessage(
208 208
 			$message,
209 209
 			$parameter_position,
Please login to merge, or discard this patch.
wpcs/WordPress/Sniffs/WP/CronIntervalSniff.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	public function process_token( $stackPtr ) {
87 87
 		$token = $this->tokens[ $stackPtr ];
88 88
 
89
-		if ( 'cron_schedules' !== $this->strip_quotes( $token['content'] ) ) {
89
+		if ( 'cron_schedules' !== $this->strip_quotes( $token[ 'content' ] ) ) {
90 90
 			return;
91 91
 		}
92 92
 
@@ -101,18 +101,18 @@  discard block
 block discarded – undo
101 101
 			return;
102 102
 		}
103 103
 
104
-		if ( $stackPtr >= $callback['start'] ) {
104
+		if ( $stackPtr >= $callback[ 'start' ] ) {
105 105
 			// "cron_schedules" found in the second parameter, not the first.
106 106
 			return;
107 107
 		}
108 108
 
109 109
 		// Detect callback function name.
110
-		$callbackArrayPtr = $this->phpcsFile->findNext( Tokens::$emptyTokens, $callback['start'], ( $callback['end'] + 1 ), true );
110
+		$callbackArrayPtr = $this->phpcsFile->findNext( Tokens::$emptyTokens, $callback[ 'start' ], ( $callback[ 'end' ] + 1 ), true );
111 111
 
112 112
 		// If callback is array, get second element.
113 113
 		if ( false !== $callbackArrayPtr
114
-			&& ( \T_ARRAY === $this->tokens[ $callbackArrayPtr ]['code']
115
-				|| \T_OPEN_SHORT_ARRAY === $this->tokens[ $callbackArrayPtr ]['code'] )
114
+			&& ( \T_ARRAY === $this->tokens[ $callbackArrayPtr ][ 'code' ]
115
+				|| \T_OPEN_SHORT_ARRAY === $this->tokens[ $callbackArrayPtr ][ 'code' ] )
116 116
 		) {
117 117
 			$callback = $this->get_function_call_parameter( $callbackArrayPtr, 2 );
118 118
 
@@ -125,27 +125,27 @@  discard block
 block discarded – undo
125 125
 		unset( $functionPtr );
126 126
 
127 127
 		// Search for the function in tokens.
128
-		$callbackFunctionPtr = $this->phpcsFile->findNext( array( \T_CONSTANT_ENCAPSED_STRING, \T_DOUBLE_QUOTED_STRING, \T_CLOSURE ), $callback['start'], ( $callback['end'] + 1 ) );
128
+		$callbackFunctionPtr = $this->phpcsFile->findNext( array( \T_CONSTANT_ENCAPSED_STRING, \T_DOUBLE_QUOTED_STRING, \T_CLOSURE ), $callback[ 'start' ], ( $callback[ 'end' ] + 1 ) );
129 129
 
130 130
 		if ( false === $callbackFunctionPtr ) {
131 131
 			$this->confused( $stackPtr );
132 132
 			return;
133 133
 		}
134 134
 
135
-		if ( \T_CLOSURE === $this->tokens[ $callbackFunctionPtr ]['code'] ) {
135
+		if ( \T_CLOSURE === $this->tokens[ $callbackFunctionPtr ][ 'code' ] ) {
136 136
 			$functionPtr = $callbackFunctionPtr;
137 137
 		} else {
138
-			$functionName = $this->strip_quotes( $this->tokens[ $callbackFunctionPtr ]['content'] );
138
+			$functionName = $this->strip_quotes( $this->tokens[ $callbackFunctionPtr ][ 'content' ] );
139 139
 
140 140
 			for ( $ptr = 0; $ptr < $this->phpcsFile->numTokens; $ptr++ ) {
141
-				if ( \T_FUNCTION === $this->tokens[ $ptr ]['code'] ) {
141
+				if ( \T_FUNCTION === $this->tokens[ $ptr ][ 'code' ] ) {
142 142
 					$foundName = $this->phpcsFile->getDeclarationName( $ptr );
143 143
 					if ( $foundName === $functionName ) {
144 144
 						$functionPtr = $ptr;
145 145
 						break;
146
-					} elseif ( isset( $this->tokens[ $ptr ]['scope_closer'] ) ) {
146
+					} elseif ( isset( $this->tokens[ $ptr ][ 'scope_closer' ] ) ) {
147 147
 						// Skip to the end of the function definition.
148
-						$ptr = $this->tokens[ $ptr ]['scope_closer'];
148
+						$ptr = $this->tokens[ $ptr ][ 'scope_closer' ];
149 149
 					}
150 150
 				}
151 151
 			}
@@ -156,16 +156,16 @@  discard block
 block discarded – undo
156 156
 			return;
157 157
 		}
158 158
 
159
-		if ( ! isset( $this->tokens[ $functionPtr ]['scope_opener'], $this->tokens[ $functionPtr ]['scope_closer'] ) ) {
159
+		if ( ! isset( $this->tokens[ $functionPtr ][ 'scope_opener' ], $this->tokens[ $functionPtr ][ 'scope_closer' ] ) ) {
160 160
 			return;
161 161
 		}
162 162
 
163
-		$opening = $this->tokens[ $functionPtr ]['scope_opener'];
164
-		$closing = $this->tokens[ $functionPtr ]['scope_closer'];
163
+		$opening = $this->tokens[ $functionPtr ][ 'scope_opener' ];
164
+		$closing = $this->tokens[ $functionPtr ][ 'scope_closer' ];
165 165
 		for ( $i = $opening; $i <= $closing; $i++ ) {
166 166
 
167
-			if ( \in_array( $this->tokens[ $i ]['code'], array( \T_CONSTANT_ENCAPSED_STRING, \T_DOUBLE_QUOTED_STRING ), true ) ) {
168
-				if ( 'interval' === $this->strip_quotes( $this->tokens[ $i ]['content'] ) ) {
167
+			if ( \in_array( $this->tokens[ $i ][ 'code' ], array( \T_CONSTANT_ENCAPSED_STRING, \T_DOUBLE_QUOTED_STRING ), true ) ) {
168
+				if ( 'interval' === $this->strip_quotes( $this->tokens[ $i ][ 'content' ] ) ) {
169 169
 					$operator = $this->phpcsFile->findNext( \T_DOUBLE_ARROW, $i, null, false, null, true );
170 170
 					if ( false === $operator ) {
171 171
 						$this->confused( $stackPtr );
@@ -176,10 +176,10 @@  discard block
 block discarded – undo
176 176
 					$valueEnd   = $this->phpcsFile->findNext( array( \T_COMMA, \T_CLOSE_PARENTHESIS ), ( $valueStart + 1 ) );
177 177
 					$value      = '';
178 178
 					for ( $j = $valueStart; $j < $valueEnd; $j++ ) {
179
-						if ( isset( Tokens::$emptyTokens[ $this->tokens[ $j ]['code'] ] ) ) {
179
+						if ( isset( Tokens::$emptyTokens[ $this->tokens[ $j ][ 'code' ] ] ) ) {
180 180
 							continue;
181 181
 						}
182
-						$value .= $this->tokens[ $j ]['content'];
182
+						$value .= $this->tokens[ $j ][ 'content' ];
183 183
 					}
184 184
 
185 185
 					if ( is_numeric( $value ) ) {
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 			}
203 203
 		}
204 204
 
205
-		$this->min_interval = (int) $this->min_interval;
205
+		$this->min_interval = (int)$this->min_interval;
206 206
 
207 207
 		if ( isset( $interval ) && $interval < $this->min_interval ) {
208 208
 			$minutes = round( ( $this->min_interval / 60 ), 1 );
Please login to merge, or discard this patch.
wpcs/WordPress/Sniffs/WP/EnqueuedResourcesSniff.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	public function process_token( $stackPtr ) {
45 45
 		$token = $this->tokens[ $stackPtr ];
46 46
 
47
-		if ( preg_match( '# rel=\\\\?[\'"]?stylesheet\\\\?[\'"]?#', $token['content'] ) > 0 ) {
47
+		if ( preg_match( '# rel=\\\\?[\'"]?stylesheet\\\\?[\'"]?#', $token[ 'content' ] ) > 0 ) {
48 48
 			$this->phpcsFile->addError(
49 49
 				'Stylesheets must be registered/enqueued via wp_enqueue_style',
50 50
 				$stackPtr,
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 			);
53 53
 		}
54 54
 
55
-		if ( preg_match( '#<script[^>]*(?<=src=)#', $token['content'] ) > 0 ) {
55
+		if ( preg_match( '#<script[^>]*(?<=src=)#', $token[ 'content' ] ) > 0 ) {
56 56
 			$this->phpcsFile->addError(
57 57
 				'Scripts must be registered/enqueued via wp_enqueue_script',
58 58
 				$stackPtr,
Please login to merge, or discard this patch.