Completed
Pull Request — develop (#1492)
by
unknown
16:55 queued 12s
created
wpcs/WordPress/Sniffs/Security/PluginMenuSlugSniff.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@
 block discarded – undo
77 77
 	public function process_parameters( $stackPtr, $group_name, $matched_content, $parameters ) {
78 78
 		foreach ( $this->target_functions[ $matched_content ] as $position ) {
79 79
 			if ( isset( $parameters[ $position ] ) ) {
80
-				$file_constant = $this->phpcsFile->findNext( \T_FILE, $parameters[ $position ]['start'], ( $parameters[ $position ]['end'] + 1 ) );
80
+				$file_constant = $this->phpcsFile->findNext( \T_FILE, $parameters[ $position ][ 'start' ], ( $parameters[ $position ][ 'end' ] + 1 ) );
81 81
 
82 82
 				if ( false !== $file_constant ) {
83 83
 					$this->phpcsFile->addWarning( 'Using __FILE__ for menu slugs risks exposing filesystem structure.', $stackPtr, 'Using__FILE__' );
Please login to merge, or discard this patch.
wpcs/WordPress/Sniffs/NamingConventions/ValidVariableNameSniff.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	protected function processVariable( File $phpcs_file, $stack_ptr ) {
108 108
 
109 109
 		$tokens   = $phpcs_file->getTokens();
110
-		$var_name = ltrim( $tokens[ $stack_ptr ]['content'], '$' );
110
+		$var_name = ltrim( $tokens[ $stack_ptr ][ 'content' ], '$' );
111 111
 
112 112
 		// If it's a php reserved var, then its ok.
113 113
 		if ( isset( $this->phpReservedVars[ $var_name ] ) ) {
@@ -123,13 +123,13 @@  discard block
 block discarded – undo
123 123
 		}
124 124
 
125 125
 		$obj_operator = $phpcs_file->findNext( Tokens::$emptyTokens, ( $stack_ptr + 1 ), null, true );
126
-		if ( \T_OBJECT_OPERATOR === $tokens[ $obj_operator ]['code'] ) {
126
+		if ( \T_OBJECT_OPERATOR === $tokens[ $obj_operator ][ 'code' ] ) {
127 127
 			// Check to see if we are using a variable from an object.
128 128
 			$var = $phpcs_file->findNext( Tokens::$emptyTokens, ( $obj_operator + 1 ), null, true );
129
-			if ( \T_STRING === $tokens[ $var ]['code'] ) {
129
+			if ( \T_STRING === $tokens[ $var ][ 'code' ] ) {
130 130
 				$bracket = $phpcs_file->findNext( Tokens::$emptyTokens, ( $var + 1 ), null, true );
131
-				if ( \T_OPEN_PARENTHESIS !== $tokens[ $bracket ]['code'] ) {
132
-					$obj_var_name = $tokens[ $var ]['content'];
131
+				if ( \T_OPEN_PARENTHESIS !== $tokens[ $bracket ][ 'code' ] ) {
132
+					$obj_var_name = $tokens[ $var ][ 'content' ];
133 133
 
134 134
 					// There is no way for us to know if the var is public or
135 135
 					// private, so we have to ignore a leading underscore if there is
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 
154 154
 		$in_class     = false;
155 155
 		$obj_operator = $phpcs_file->findPrevious( Tokens::$emptyTokens, ( $stack_ptr - 1 ), null, true );
156
-		if ( \T_DOUBLE_COLON === $tokens[ $obj_operator ]['code'] || \T_OBJECT_OPERATOR === $tokens[ $obj_operator ]['code'] ) {
156
+		if ( \T_DOUBLE_COLON === $tokens[ $obj_operator ][ 'code' ] || \T_OBJECT_OPERATOR === $tokens[ $obj_operator ][ 'code' ] ) {
157 157
 			// The variable lives within a class, and is referenced like
158 158
 			// this: MyClass::$_variable or $class->variable.
159 159
 			$in_class = true;
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 
200 200
 		$tokens = $phpcs_file->getTokens();
201 201
 
202
-		$var_name     = ltrim( $tokens[ $stack_ptr ]['content'], '$' );
202
+		$var_name     = ltrim( $tokens[ $stack_ptr ][ 'content' ], '$' );
203 203
 		$member_props = $phpcs_file->getMemberProperties( $stack_ptr );
204 204
 		if ( empty( $member_props ) ) {
205 205
 			// Couldn't get any info about this variable, which
@@ -235,12 +235,12 @@  discard block
 block discarded – undo
235 235
 
236 236
 		$tokens = $phpcs_file->getTokens();
237 237
 
238
-		if ( preg_match_all( '|[^\\\]\${?([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)|', $tokens[ $stack_ptr ]['content'], $matches ) > 0 ) {
238
+		if ( preg_match_all( '|[^\\\]\${?([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)|', $tokens[ $stack_ptr ][ 'content' ], $matches ) > 0 ) {
239 239
 
240 240
 			// Merge any custom variables with the defaults.
241 241
 			$this->mergeWhiteList();
242 242
 
243
-			foreach ( $matches[1] as $var_name ) {
243
+			foreach ( $matches[ 1 ] as $var_name ) {
244 244
 				// If it's a php reserved var, then its ok.
245 245
 				if ( isset( $this->phpReservedVars[ $var_name ] ) ) {
246 246
 					continue;
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 	 * @return bool
271 271
 	 */
272 272
 	public static function isSnakeCase( $var_name ) {
273
-		return (bool) preg_match( '/^[a-z0-9_]+$/', $var_name );
273
+		return (bool)preg_match( '/^[a-z0-9_]+$/', $var_name );
274 274
 	}
275 275
 
276 276
 	/**
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 	 * @return void
284 284
 	 */
285 285
 	protected function mergeWhiteList() {
286
-		if ( $this->customPropertiesWhitelist !== $this->addedCustomProperties['properties'] ) {
286
+		if ( $this->customPropertiesWhitelist !== $this->addedCustomProperties[ 'properties' ] ) {
287 287
 			// Fix property potentially passed as comma-delimited string.
288 288
 			$customProperties = Sniff::merge_custom_array( $this->customPropertiesWhitelist, array(), false );
289 289
 
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 				$this->whitelisted_mixed_case_member_var_names
293 293
 			);
294 294
 
295
-			$this->addedCustomProperties['properties'] = $this->customPropertiesWhitelist;
295
+			$this->addedCustomProperties[ 'properties' ] = $this->customPropertiesWhitelist;
296 296
 		}
297 297
 	}
298 298
 
Please login to merge, or discard this patch.
wpcs/WordPress/Sniffs/NamingConventions/ValidHookNameSniff.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 			return;
94 94
 		}
95 95
 
96
-		if ( ! isset( $parameters[1] ) ) {
96
+		if ( ! isset( $parameters[ 1 ] ) ) {
97 97
 			return;
98 98
 		}
99 99
 
@@ -104,18 +104,18 @@  discard block
 block discarded – undo
104 104
 		$content     = array();
105 105
 		$expected    = array();
106 106
 
107
-		for ( $i = $parameters[1]['start']; $i <= $parameters[1]['end']; $i++ ) {
108
-			$content[ $i ]  = $this->tokens[ $i ]['content'];
109
-			$expected[ $i ] = $this->tokens[ $i ]['content'];
107
+		for ( $i = $parameters[ 1 ][ 'start' ]; $i <= $parameters[ 1 ][ 'end' ]; $i++ ) {
108
+			$content[ $i ]  = $this->tokens[ $i ][ 'content' ];
109
+			$expected[ $i ] = $this->tokens[ $i ][ 'content' ];
110 110
 
111
-			if ( \in_array( $this->tokens[ $i ]['code'], array( \T_CONSTANT_ENCAPSED_STRING, \T_DOUBLE_QUOTED_STRING ), true ) ) {
112
-				$string = $this->strip_quotes( $this->tokens[ $i ]['content'] );
111
+			if ( \in_array( $this->tokens[ $i ][ 'code' ], array( \T_CONSTANT_ENCAPSED_STRING, \T_DOUBLE_QUOTED_STRING ), true ) ) {
112
+				$string = $this->strip_quotes( $this->tokens[ $i ][ 'content' ] );
113 113
 
114 114
 				/*
115 115
 				 * Here be dragons - a double quoted string can contain extrapolated variables
116 116
 				 * which don't have to comply with these rules.
117 117
 				 */
118
-				if ( \T_DOUBLE_QUOTED_STRING === $this->tokens[ $i ]['code'] ) {
118
+				if ( \T_DOUBLE_QUOTED_STRING === $this->tokens[ $i ][ 'code' ] ) {
119 119
 					$transform       = $this->transform_complex_string( $string, $regex );
120 120
 					$case_transform  = $this->transform_complex_string( $string, $regex, 'case' );
121 121
 					$punct_transform = $this->transform_complex_string( $string, $regex, 'punctuation' );
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 					continue;
130 130
 				}
131 131
 
132
-				if ( \T_DOUBLE_QUOTED_STRING === $this->tokens[ $i ]['code'] ) {
132
+				if ( \T_DOUBLE_QUOTED_STRING === $this->tokens[ $i ][ 'code' ] ) {
133 133
 					$expected[ $i ] = '"' . $transform . '"';
134 134
 				} else {
135 135
 					$expected[ $i ] = '\'' . $transform . '\'';
Please login to merge, or discard this patch.
wpcs/WordPress/Sniffs/NamingConventions/ValidFunctionNameSniff.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@
 block discarded – undo
95 95
 		$tokens = $phpcsFile->getTokens();
96 96
 
97 97
 		// Determine if this is a function which needs to be examined.
98
-		$conditions = $tokens[ $stackPtr ]['conditions'];
98
+		$conditions = $tokens[ $stackPtr ][ 'conditions' ];
99 99
 		end( $conditions );
100 100
 		$deepestScope = key( $conditions );
101 101
 		if ( $deepestScope !== $currScope ) {
Please login to merge, or discard this patch.
wpcs/WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php 1 patch
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -195,10 +195,10 @@  discard block
 block discarded – undo
195 195
 	public function register() {
196 196
 		// Get a list of all PHP native functions.
197 197
 		$all_functions            = get_defined_functions();
198
-		$this->built_in_functions = array_flip( $all_functions['internal'] );
198
+		$this->built_in_functions = array_flip( $all_functions[ 'internal' ] );
199 199
 
200 200
 		// Set the sniff targets.
201
-		$targets  = array(
201
+		$targets = array(
202 202
 			\T_NAMESPACE => \T_NAMESPACE,
203 203
 			\T_FUNCTION  => \T_FUNCTION,
204 204
 			\T_CONST     => \T_CONST,
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 		// Add function call target for hook names and constants defined using define().
211 211
 		$parent = parent::register();
212 212
 		if ( ! empty( $parent ) ) {
213
-			$targets[] = \T_STRING;
213
+			$targets[ ] = \T_STRING;
214 214
 		}
215 215
 
216 216
 		return $targets;
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 	 */
226 226
 	public function getGroups() {
227 227
 		$this->target_functions           = $this->hookInvokeFunctions;
228
-		$this->target_functions['define'] = true;
228
+		$this->target_functions[ 'define' ] = true;
229 229
 
230 230
 		return parent::getGroups();
231 231
 	}
@@ -273,36 +273,36 @@  discard block
 block discarded – undo
273 273
 		}
274 274
 
275 275
 		// Ignore test classes.
276
-		if ( isset( Tokens::$ooScopeTokens[ $this->tokens[ $stackPtr ]['code'] ] )
276
+		if ( isset( Tokens::$ooScopeTokens[ $this->tokens[ $stackPtr ][ 'code' ] ] )
277 277
 			&& true === $this->is_test_class( $stackPtr )
278 278
 		) {
279
-			if ( $this->tokens[ $stackPtr ]['scope_condition'] === $stackPtr && isset( $this->tokens[ $stackPtr ]['scope_closer'] ) ) {
279
+			if ( $this->tokens[ $stackPtr ][ 'scope_condition' ] === $stackPtr && isset( $this->tokens[ $stackPtr ][ 'scope_closer' ] ) ) {
280 280
 				// Skip forward to end of test class.
281
-				return $this->tokens[ $stackPtr ]['scope_closer'];
281
+				return $this->tokens[ $stackPtr ][ 'scope_closer' ];
282 282
 			}
283 283
 			return;
284 284
 		}
285 285
 
286
-		if ( \T_ANON_CLASS === $this->tokens[ $stackPtr ]['code'] ) {
286
+		if ( \T_ANON_CLASS === $this->tokens[ $stackPtr ][ 'code' ] ) {
287 287
 			// Token was only registered to allow skipping over test classes.
288 288
 			return;
289 289
 		}
290 290
 
291
-		if ( \T_STRING === $this->tokens[ $stackPtr ]['code'] ) {
291
+		if ( \T_STRING === $this->tokens[ $stackPtr ][ 'code' ] ) {
292 292
 			// Disallow excluding function groups for this sniff.
293 293
 			$this->exclude = array();
294 294
 
295 295
 			return parent::process_token( $stackPtr );
296 296
 
297
-		} elseif ( \T_DOLLAR === $this->tokens[ $stackPtr ]['code'] ) {
297
+		} elseif ( \T_DOLLAR === $this->tokens[ $stackPtr ][ 'code' ] ) {
298 298
 
299 299
 			return $this->process_variable_variable( $stackPtr );
300 300
 
301
-		} elseif ( \T_VARIABLE === $this->tokens[ $stackPtr ]['code'] ) {
301
+		} elseif ( \T_VARIABLE === $this->tokens[ $stackPtr ][ 'code' ] ) {
302 302
 
303 303
 			return $this->process_variable_assignment( $stackPtr );
304 304
 
305
-		} elseif ( \T_NAMESPACE === $this->tokens[ $stackPtr ]['code'] ) {
305
+		} elseif ( \T_NAMESPACE === $this->tokens[ $stackPtr ][ 'code' ] ) {
306 306
 			$namespace_name = $this->get_declared_namespace_name( $stackPtr );
307 307
 
308 308
 			if ( false === $namespace_name || '' === $namespace_name || '\\' === $namespace_name ) {
@@ -310,14 +310,14 @@  discard block
 block discarded – undo
310 310
 			}
311 311
 
312 312
 			foreach ( $this->validated_namespace_prefixes as $key => $prefix_info ) {
313
-				if ( false === $prefix_info['is_regex'] ) {
314
-					if ( stripos( $namespace_name, $prefix_info['prefix'] ) === 0 ) {
313
+				if ( false === $prefix_info[ 'is_regex' ] ) {
314
+					if ( stripos( $namespace_name, $prefix_info[ 'prefix' ] ) === 0 ) {
315 315
 						$this->phpcsFile->recordMetric( $stackPtr, 'Prefix all globals: allowed prefixes', $key );
316 316
 						return;
317 317
 					}
318 318
 				} else {
319 319
 					// Ok, so this prefix should be used as a regex.
320
-					$regex = '`^' . $prefix_info['prefix'] . '`i';
320
+					$regex = '`^' . $prefix_info[ 'prefix' ] . '`i';
321 321
 					if ( preg_match( $regex, $namespace_name ) > 0 ) {
322 322
 						$this->phpcsFile->recordMetric( $stackPtr, 'Prefix all globals: allowed prefixes', $key );
323 323
 						return;
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 			$error_text = 'Unknown syntax used';
355 355
 			$error_code = 'NonPrefixedSyntaxFound';
356 356
 
357
-			switch ( $this->tokens[ $stackPtr ]['type'] ) {
357
+			switch ( $this->tokens[ $stackPtr ][ 'type' ] ) {
358 358
 				case 'T_FUNCTION':
359 359
 					// Methods in a class do not need to be prefixed.
360 360
 					if ( $this->phpcsFile->hasCondition( $stackPtr, Tokens::$ooScopeTokens ) === true ) {
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
 					$error_text = 'Classes declared';
379 379
 					$error_code = 'NonPrefixedClassFound';
380 380
 
381
-					switch ( $this->tokens[ $stackPtr ]['type'] ) {
381
+					switch ( $this->tokens[ $stackPtr ][ 'type' ] ) {
382 382
 						case 'T_CLASS':
383 383
 							if ( class_exists( '\\' . $item_name, false ) ) {
384 384
 								// Backfill for PHP native class.
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 						return;
427 427
 					}
428 428
 
429
-					$item_name = $this->tokens[ $constant_name_ptr ]['content'];
429
+					$item_name = $this->tokens[ $constant_name_ptr ][ 'content' ];
430 430
 					if ( \defined( '\\' . $item_name ) ) {
431 431
 						// Backfill for PHP native constant.
432 432
 						return;
@@ -486,26 +486,26 @@  discard block
 block discarded – undo
486 486
 		// Is this a variable variable ?
487 487
 		// Not concerned with nested ones as those will be recognized on their own token.
488 488
 		$next_non_empty = $this->phpcsFile->findNext( Tokens::$emptyTokens, ( $stackPtr + 1 ), null, true, null, true );
489
-		if ( false === $next_non_empty || ! isset( $indicators[ $this->tokens[ $next_non_empty ]['code'] ] ) ) {
489
+		if ( false === $next_non_empty || ! isset( $indicators[ $this->tokens[ $next_non_empty ][ 'code' ] ] ) ) {
490 490
 			return;
491 491
 		}
492 492
 
493
-		if ( \T_OPEN_CURLY_BRACKET === $this->tokens[ $next_non_empty ]['code']
494
-			&& isset( $this->tokens[ $next_non_empty ]['bracket_closer'] )
493
+		if ( \T_OPEN_CURLY_BRACKET === $this->tokens[ $next_non_empty ][ 'code' ]
494
+			&& isset( $this->tokens[ $next_non_empty ][ 'bracket_closer' ] )
495 495
 		) {
496 496
 			// Skip over the variable part.
497
-			$next_non_empty = $this->tokens[ $next_non_empty ]['bracket_closer'];
497
+			$next_non_empty = $this->tokens[ $next_non_empty ][ 'bracket_closer' ];
498 498
 		}
499 499
 
500 500
 		$maybe_assignment = $this->phpcsFile->findNext( Tokens::$emptyTokens, ( $next_non_empty + 1 ), null, true, null, true );
501 501
 
502 502
 		while ( false !== $maybe_assignment
503
-			&& \T_OPEN_SQUARE_BRACKET === $this->tokens[ $maybe_assignment ]['code']
504
-			&& isset( $this->tokens[ $maybe_assignment ]['bracket_closer'] )
503
+			&& \T_OPEN_SQUARE_BRACKET === $this->tokens[ $maybe_assignment ][ 'code' ]
504
+			&& isset( $this->tokens[ $maybe_assignment ][ 'bracket_closer' ] )
505 505
 		) {
506 506
 			$maybe_assignment = $this->phpcsFile->findNext(
507 507
 				Tokens::$emptyTokens,
508
-				( $this->tokens[ $maybe_assignment ]['bracket_closer'] + 1 ),
508
+				( $this->tokens[ $maybe_assignment ][ 'bracket_closer' ] + 1 ),
509 509
 				null,
510 510
 				true,
511 511
 				null,
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
 			return;
518 518
 		}
519 519
 
520
-		if ( ! isset( Tokens::$assignmentTokens[ $this->tokens[ $maybe_assignment ]['code'] ] ) ) {
520
+		if ( ! isset( Tokens::$assignmentTokens[ $this->tokens[ $maybe_assignment ][ 'code' ] ] ) ) {
521 521
 			// Not an assignment.
522 522
 			return;
523 523
 		}
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 				$condition = $this->phpcsFile->getCondition( $stackPtr, \T_CLOSURE );
539 539
 			}
540 540
 
541
-			$has_global = $this->phpcsFile->findPrevious( \T_GLOBAL, ( $stackPtr - 1 ), $this->tokens[ $condition ]['scope_opener'] );
541
+			$has_global = $this->phpcsFile->findPrevious( \T_GLOBAL, ( $stackPtr - 1 ), $this->tokens[ $condition ][ 'scope_opener' ] );
542 542
 			if ( false === $has_global ) {
543 543
 				// No variable import happening.
544 544
 				return;
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
 		}
593 593
 
594 594
 		$is_error      = true;
595
-		$variable_name = substr( $this->tokens[ $stackPtr ]['content'], 1 ); // Strip the dollar sign.
595
+		$variable_name = substr( $this->tokens[ $stackPtr ][ 'content' ], 1 ); // Strip the dollar sign.
596 596
 
597 597
 		// Bow out early if we know for certain no prefix is needed.
598 598
 		if ( $this->variable_prefixed_or_whitelisted( $stackPtr, $variable_name ) === true ) {
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
 
602 602
 		if ( 'GLOBALS' === $variable_name ) {
603 603
 			$array_open = $this->phpcsFile->findNext( Tokens::$emptyTokens, ( $stackPtr + 1 ), null, true, null, true );
604
-			if ( false === $array_open || \T_OPEN_SQUARE_BRACKET !== $this->tokens[ $array_open ]['code'] ) {
604
+			if ( false === $array_open || \T_OPEN_SQUARE_BRACKET !== $this->tokens[ $array_open ][ 'code' ] ) {
605 605
 				// Live coding or something very silly.
606 606
 				return;
607 607
 			}
@@ -613,20 +613,20 @@  discard block
 block discarded – undo
613 613
 			}
614 614
 
615 615
 			$stackPtr      = $array_key;
616
-			$variable_name = $this->strip_quotes( $this->tokens[ $array_key ]['content'] );
616
+			$variable_name = $this->strip_quotes( $this->tokens[ $array_key ][ 'content' ] );
617 617
 
618 618
 			// Check whether a prefix is needed.
619
-			if ( isset( Tokens::$stringTokens[ $this->tokens[ $array_key ]['code'] ] )
619
+			if ( isset( Tokens::$stringTokens[ $this->tokens[ $array_key ][ 'code' ] ] )
620 620
 				&& $this->variable_prefixed_or_whitelisted( $stackPtr, $variable_name ) === true
621 621
 			) {
622 622
 				return;
623 623
 			}
624 624
 
625
-			if ( \T_DOUBLE_QUOTED_STRING === $this->tokens[ $array_key ]['code'] ) {
625
+			if ( \T_DOUBLE_QUOTED_STRING === $this->tokens[ $array_key ][ 'code' ] ) {
626 626
 				// If the array key is a double quoted string, try again with only
627 627
 				// the part before the first variable (if any).
628 628
 				$exploded = explode( '$', $variable_name );
629
-				$first    = rtrim( $exploded[0], '{' );
629
+				$first    = rtrim( $exploded[ 0 ], '{' );
630 630
 				if ( '' !== $first ) {
631 631
 					if ( $this->variable_prefixed_or_whitelisted( $array_key, $first ) === true ) {
632 632
 						return;
@@ -635,17 +635,17 @@  discard block
 block discarded – undo
635 635
 					// If the first part was dynamic, throw a warning.
636 636
 					$is_error = false;
637 637
 				}
638
-			} elseif ( ! isset( Tokens::$stringTokens[ $this->tokens[ $array_key ]['code'] ] ) ) {
638
+			} elseif ( ! isset( Tokens::$stringTokens[ $this->tokens[ $array_key ][ 'code' ] ] ) ) {
639 639
 				// Dynamic array key, throw a warning.
640 640
 				$is_error = false;
641 641
 			}
642 642
 		} else {
643 643
 			// Function parameters do not need to be prefixed.
644
-			if ( isset( $this->tokens[ $stackPtr ]['nested_parenthesis'] ) ) {
645
-				foreach ( $this->tokens[ $stackPtr ]['nested_parenthesis'] as $opener => $closer ) {
646
-					if ( isset( $this->tokens[ $opener ]['parenthesis_owner'] )
647
-						&& ( \T_FUNCTION === $this->tokens[ $this->tokens[ $opener ]['parenthesis_owner'] ]['code']
648
-							|| \T_CLOSURE === $this->tokens[ $this->tokens[ $opener ]['parenthesis_owner'] ]['code'] )
644
+			if ( isset( $this->tokens[ $stackPtr ][ 'nested_parenthesis' ] ) ) {
645
+				foreach ( $this->tokens[ $stackPtr ][ 'nested_parenthesis' ] as $opener => $closer ) {
646
+					if ( isset( $this->tokens[ $opener ][ 'parenthesis_owner' ] )
647
+						&& ( \T_FUNCTION === $this->tokens[ $this->tokens[ $opener ][ 'parenthesis_owner' ] ][ 'code' ]
648
+							|| \T_CLOSURE === $this->tokens[ $this->tokens[ $opener ][ 'parenthesis_owner' ] ][ 'code' ] )
649 649
 					) {
650 650
 						return;
651 651
 					}
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
 					$condition = $this->phpcsFile->getCondition( $stackPtr, \T_CLOSURE );
666 666
 				}
667 667
 
668
-				$has_global = $this->phpcsFile->findPrevious( \T_GLOBAL, ( $stackPtr - 1 ), $this->tokens[ $condition ]['scope_opener'] );
668
+				$has_global = $this->phpcsFile->findPrevious( \T_GLOBAL, ( $stackPtr - 1 ), $this->tokens[ $condition ][ 'scope_opener' ] );
669 669
 				if ( false === $has_global ) {
670 670
 					// No variable import happening.
671 671
 					return;
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 						return;
689 689
 					}
690 690
 
691
-					if ( substr( $this->tokens[ $ptr ]['content'], 1 ) === $variable_name ) {
691
+					if ( substr( $this->tokens[ $ptr ][ 'content' ], 1 ) === $variable_name ) {
692 692
 						break;
693 693
 					}
694 694
 				}
@@ -735,12 +735,12 @@  discard block
 block discarded – undo
735 735
 		}
736 736
 
737 737
 		// No matter whether it is a constant definition or a hook call, both use the first parameter.
738
-		if ( ! isset( $parameters[1] ) ) {
738
+		if ( ! isset( $parameters[ 1 ] ) ) {
739 739
 			return;
740 740
 		}
741 741
 
742 742
 		$is_error    = true;
743
-		$raw_content = $this->strip_quotes( $parameters[1]['raw'] );
743
+		$raw_content = $this->strip_quotes( $parameters[ 1 ][ 'raw' ] );
744 744
 
745 745
 		if ( ( 'define' !== $matched_content
746 746
 			&& isset( $this->whitelisted_core_hooks[ $raw_content ] ) )
@@ -750,14 +750,14 @@  discard block
 block discarded – undo
750 750
 			return;
751 751
 		}
752 752
 
753
-		if ( $this->is_prefixed( $parameters[1]['start'], $raw_content ) === true ) {
753
+		if ( $this->is_prefixed( $parameters[ 1 ][ 'start' ], $raw_content ) === true ) {
754 754
 			return;
755 755
 		} else {
756 756
 			// This may be a dynamic hook/constant name.
757 757
 			$first_non_empty = $this->phpcsFile->findNext(
758 758
 				Tokens::$emptyTokens,
759
-				$parameters[1]['start'],
760
-				( $parameters[1]['end'] + 1 ),
759
+				$parameters[ 1 ][ 'start' ],
760
+				( $parameters[ 1 ][ 'end' ] + 1 ),
761 761
 				true
762 762
 			);
763 763
 
@@ -765,29 +765,29 @@  discard block
 block discarded – undo
765 765
 				return;
766 766
 			}
767 767
 
768
-			$first_non_empty_content = $this->strip_quotes( $this->tokens[ $first_non_empty ]['content'] );
768
+			$first_non_empty_content = $this->strip_quotes( $this->tokens[ $first_non_empty ][ 'content' ] );
769 769
 
770 770
 			// Try again with just the first token if it's a text string.
771
-			if ( isset( Tokens::$stringTokens[ $this->tokens[ $first_non_empty ]['code'] ] )
772
-				&& $this->is_prefixed( $parameters[1]['start'], $first_non_empty_content ) === true
771
+			if ( isset( Tokens::$stringTokens[ $this->tokens[ $first_non_empty ][ 'code' ] ] )
772
+				&& $this->is_prefixed( $parameters[ 1 ][ 'start' ], $first_non_empty_content ) === true
773 773
 			) {
774 774
 				return;
775 775
 			}
776 776
 
777
-			if ( \T_DOUBLE_QUOTED_STRING === $this->tokens[ $first_non_empty ]['code'] ) {
777
+			if ( \T_DOUBLE_QUOTED_STRING === $this->tokens[ $first_non_empty ][ 'code' ] ) {
778 778
 				// If the first part of the parameter is a double quoted string, try again with only
779 779
 				// the part before the first variable (if any).
780 780
 				$exploded = explode( '$', $first_non_empty_content );
781
-				$first    = rtrim( $exploded[0], '{' );
781
+				$first    = rtrim( $exploded[ 0 ], '{' );
782 782
 				if ( '' !== $first ) {
783
-					if ( $this->is_prefixed( $parameters[1]['start'], $first ) === true ) {
783
+					if ( $this->is_prefixed( $parameters[ 1 ][ 'start' ], $first ) === true ) {
784 784
 						return;
785 785
 					}
786 786
 				} else {
787 787
 					// Start of hook/constant name is dynamic, throw a warning.
788 788
 					$is_error = false;
789 789
 				}
790
-			} elseif ( ! isset( Tokens::$stringTokens[ $this->tokens[ $first_non_empty ]['code'] ] ) ) {
790
+			} elseif ( ! isset( Tokens::$stringTokens[ $this->tokens[ $first_non_empty ][ 'code' ] ] ) ) {
791 791
 				// Dynamic hook/constant name, throw a warning.
792 792
 				$is_error = false;
793 793
 			}
@@ -817,7 +817,7 @@  discard block
 block discarded – undo
817 817
 			}
818 818
 		}
819 819
 
820
-		$data[] = $raw_content;
820
+		$data[ ] = $raw_content;
821 821
 
822 822
 		$recorded = $this->addMessage( self::ERROR_MSG, $first_non_empty, $is_error, $error_code, $data );
823 823
 
@@ -959,9 +959,9 @@  discard block
 block discarded – undo
959 959
 	 */
960 960
 	private function record_potential_prefix_metric( $stackPtr, $construct_name ) {
961 961
 		if ( preg_match( '`^([A-Z]*[a-z0-9]*+)`', ltrim( $construct_name, '\$_' ), $matches ) > 0
962
-			&& isset( $matches[1] ) && '' !== $matches[1]
962
+			&& isset( $matches[ 1 ] ) && '' !== $matches[ 1 ]
963 963
 		) {
964
-			$this->phpcsFile->recordMetric( $stackPtr, 'Prefix all globals: potential prefixes - start of non-prefixed construct', strtolower( $matches[1] ) );
964
+			$this->phpcsFile->recordMetric( $stackPtr, 'Prefix all globals: potential prefixes - start of non-prefixed construct', strtolower( $matches[ 1 ] ) );
965 965
 		}
966 966
 	}
967 967
 }
Please login to merge, or discard this patch.
wpcs/WordPress/Sniffs/WhiteSpace/ControlStructureSpacingSniff.php 1 patch
Spacing   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -111,11 +111,11 @@  discard block
 block discarded – undo
111 111
 	 * @return void
112 112
 	 */
113 113
 	public function process_token( $stackPtr ) {
114
-		$this->spaces_before_closure_open_paren = (int) $this->spaces_before_closure_open_paren;
114
+		$this->spaces_before_closure_open_paren = (int)$this->spaces_before_closure_open_paren;
115 115
 
116
-		if ( isset( $this->tokens[ ( $stackPtr + 1 ) ] ) && \T_WHITESPACE !== $this->tokens[ ( $stackPtr + 1 ) ]['code']
117
-			&& ! ( \T_ELSE === $this->tokens[ $stackPtr ]['code'] && \T_COLON === $this->tokens[ ( $stackPtr + 1 ) ]['code'] )
118
-			&& ! ( \T_CLOSURE === $this->tokens[ $stackPtr ]['code']
116
+		if ( isset( $this->tokens[ ( $stackPtr + 1 ) ] ) && \T_WHITESPACE !== $this->tokens[ ( $stackPtr + 1 ) ][ 'code' ]
117
+			&& ! ( \T_ELSE === $this->tokens[ $stackPtr ][ 'code' ] && \T_COLON === $this->tokens[ ( $stackPtr + 1 ) ][ 'code' ] )
118
+			&& ! ( \T_CLOSURE === $this->tokens[ $stackPtr ][ 'code' ]
119 119
 				&& 0 >= $this->spaces_before_closure_open_paren )
120 120
 		) {
121 121
 			$error = 'Space after opening control structure is required';
@@ -126,25 +126,25 @@  discard block
 block discarded – undo
126 126
 			}
127 127
 		}
128 128
 
129
-		if ( ! isset( $this->tokens[ $stackPtr ]['scope_closer'] ) ) {
129
+		if ( ! isset( $this->tokens[ $stackPtr ][ 'scope_closer' ] ) ) {
130 130
 
131
-			if ( \T_USE === $this->tokens[ $stackPtr ]['code'] && 'closure' === $this->get_use_type( $stackPtr ) ) {
131
+			if ( \T_USE === $this->tokens[ $stackPtr ][ 'code' ] && 'closure' === $this->get_use_type( $stackPtr ) ) {
132 132
 				$scopeOpener = $this->phpcsFile->findNext( \T_OPEN_CURLY_BRACKET, ( $stackPtr + 1 ) );
133
-				$scopeCloser = $this->tokens[ $scopeOpener ]['scope_closer'];
134
-			} elseif ( \T_WHILE !== $this->tokens[ $stackPtr ]['code'] ) {
133
+				$scopeCloser = $this->tokens[ $scopeOpener ][ 'scope_closer' ];
134
+			} elseif ( \T_WHILE !== $this->tokens[ $stackPtr ][ 'code' ] ) {
135 135
 				return;
136 136
 			}
137 137
 		} else {
138
-			$scopeOpener = $this->tokens[ $stackPtr ]['scope_opener'];
139
-			$scopeCloser = $this->tokens[ $stackPtr ]['scope_closer'];
138
+			$scopeOpener = $this->tokens[ $stackPtr ][ 'scope_opener' ];
139
+			$scopeCloser = $this->tokens[ $stackPtr ][ 'scope_closer' ];
140 140
 		}
141 141
 
142 142
 		// Alternative syntax.
143
-		if ( isset( $scopeOpener ) && \T_COLON === $this->tokens[ $scopeOpener ]['code'] ) {
143
+		if ( isset( $scopeOpener ) && \T_COLON === $this->tokens[ $scopeOpener ][ 'code' ] ) {
144 144
 
145 145
 			if ( 'required' === $this->space_before_colon ) {
146 146
 
147
-				if ( \T_WHITESPACE !== $this->tokens[ ( $scopeOpener - 1 ) ]['code'] ) {
147
+				if ( \T_WHITESPACE !== $this->tokens[ ( $scopeOpener - 1 ) ][ 'code' ] ) {
148 148
 					$error = 'Space between opening control structure and T_COLON is required';
149 149
 					$fix   = $this->phpcsFile->addFixableError( $error, $scopeOpener, 'NoSpaceBetweenStructureColon' );
150 150
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 				}
155 155
 			} elseif ( 'forbidden' === $this->space_before_colon ) {
156 156
 
157
-				if ( \T_WHITESPACE === $this->tokens[ ( $scopeOpener - 1 ) ]['code'] ) {
157
+				if ( \T_WHITESPACE === $this->tokens[ ( $scopeOpener - 1 ) ][ 'code' ] ) {
158 158
 					$error = 'Extra space between opening control structure and T_COLON found';
159 159
 					$fix   = $this->phpcsFile->addFixableError( $error, ( $scopeOpener - 1 ), 'SpaceBetweenStructureColon' );
160 160
 
@@ -168,13 +168,13 @@  discard block
 block discarded – undo
168 168
 		$parenthesisOpener = $this->phpcsFile->findNext( Tokens::$emptyTokens, ( $stackPtr + 1 ), null, true );
169 169
 
170 170
 		// If this is a function declaration.
171
-		if ( \T_FUNCTION === $this->tokens[ $stackPtr ]['code'] ) {
171
+		if ( \T_FUNCTION === $this->tokens[ $stackPtr ][ 'code' ] ) {
172 172
 
173
-			if ( \T_STRING === $this->tokens[ $parenthesisOpener ]['code'] ) {
173
+			if ( \T_STRING === $this->tokens[ $parenthesisOpener ][ 'code' ] ) {
174 174
 
175 175
 				$function_name_ptr = $parenthesisOpener;
176 176
 
177
-			} elseif ( \T_BITWISE_AND === $this->tokens[ $parenthesisOpener ]['code'] ) {
177
+			} elseif ( \T_BITWISE_AND === $this->tokens[ $parenthesisOpener ][ 'code' ] ) {
178 178
 
179 179
 				// This function returns by reference (function &function_name() {}).
180 180
 				$parenthesisOpener = $this->phpcsFile->findNext(
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 						$error,
203 203
 						$stackPtr,
204 204
 						'SpaceBeforeFunctionOpenParenthesis',
205
-						$this->tokens[ ( $function_name_ptr + 1 ) ]['content']
205
+						$this->tokens[ ( $function_name_ptr + 1 ) ][ 'content' ]
206 206
 					);
207 207
 
208 208
 					if ( true === $fix ) {
@@ -210,14 +210,14 @@  discard block
 block discarded – undo
210 210
 					}
211 211
 				}
212 212
 			}
213
-		} elseif ( \T_CLOSURE === $this->tokens[ $stackPtr ]['code'] ) {
213
+		} elseif ( \T_CLOSURE === $this->tokens[ $stackPtr ][ 'code' ] ) {
214 214
 
215 215
 			// Check if there is a use () statement.
216
-			if ( isset( $this->tokens[ $parenthesisOpener ]['parenthesis_closer'] ) ) {
216
+			if ( isset( $this->tokens[ $parenthesisOpener ][ 'parenthesis_closer' ] ) ) {
217 217
 
218 218
 				$usePtr = $this->phpcsFile->findNext(
219 219
 					Tokens::$emptyTokens,
220
-					( $this->tokens[ $parenthesisOpener ]['parenthesis_closer'] + 1 ),
220
+					( $this->tokens[ $parenthesisOpener ][ 'parenthesis_closer' ] + 1 ),
221 221
 					null,
222 222
 					true,
223 223
 					null,
@@ -225,17 +225,17 @@  discard block
 block discarded – undo
225 225
 				);
226 226
 
227 227
 				// If it is, we set that as the "scope opener".
228
-				if ( \T_USE === $this->tokens[ $usePtr ]['code'] ) {
228
+				if ( \T_USE === $this->tokens[ $usePtr ][ 'code' ] ) {
229 229
 					$scopeOpener = $usePtr;
230 230
 				}
231 231
 			}
232 232
 		}
233 233
 
234
-		if ( \T_COLON !== $this->tokens[ $parenthesisOpener ]['code']
235
-			&& \T_FUNCTION !== $this->tokens[ $stackPtr ]['code']
234
+		if ( \T_COLON !== $this->tokens[ $parenthesisOpener ][ 'code' ]
235
+			&& \T_FUNCTION !== $this->tokens[ $stackPtr ][ 'code' ]
236 236
 		) {
237 237
 
238
-			if ( \T_CLOSURE === $this->tokens[ $stackPtr ]['code']
238
+			if ( \T_CLOSURE === $this->tokens[ $stackPtr ][ 'code' ]
239 239
 				&& 0 === $this->spaces_before_closure_open_paren
240 240
 			) {
241 241
 
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 				}
251 251
 			} elseif (
252 252
 				(
253
-					\T_CLOSURE !== $this->tokens[ $stackPtr ]['code']
253
+					\T_CLOSURE !== $this->tokens[ $stackPtr ][ 'code' ]
254 254
 					|| 1 === $this->spaces_before_closure_open_paren
255 255
 				)
256 256
 				&& ( $stackPtr + 1 ) === $parenthesisOpener
@@ -266,8 +266,8 @@  discard block
 block discarded – undo
266 266
 			}
267 267
 		}
268 268
 
269
-		if ( \T_WHITESPACE === $this->tokens[ ( $stackPtr + 1 ) ]['code']
270
-			&& ' ' !== $this->tokens[ ( $stackPtr + 1 ) ]['content']
269
+		if ( \T_WHITESPACE === $this->tokens[ ( $stackPtr + 1 ) ][ 'code' ]
270
+			&& ' ' !== $this->tokens[ ( $stackPtr + 1 ) ][ 'content' ]
271 271
 		) {
272 272
 			// Checking this: if [*](...) {}.
273 273
 			$error = 'Expected exactly one space before opening parenthesis; "%s" found.';
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 				$error,
276 276
 				$stackPtr,
277 277
 				'ExtraSpaceBeforeOpenParenthesis',
278
-				$this->tokens[ ( $stackPtr + 1 ) ]['content']
278
+				$this->tokens[ ( $stackPtr + 1 ) ][ 'content' ]
279 279
 			);
280 280
 
281 281
 			if ( true === $fix ) {
@@ -283,8 +283,8 @@  discard block
 block discarded – undo
283 283
 			}
284 284
 		}
285 285
 
286
-		if ( \T_CLOSE_PARENTHESIS !== $this->tokens[ ( $parenthesisOpener + 1 ) ]['code'] ) {
287
-			if ( \T_WHITESPACE !== $this->tokens[ ( $parenthesisOpener + 1 ) ]['code'] ) {
286
+		if ( \T_CLOSE_PARENTHESIS !== $this->tokens[ ( $parenthesisOpener + 1 ) ][ 'code' ] ) {
287
+			if ( \T_WHITESPACE !== $this->tokens[ ( $parenthesisOpener + 1 ) ][ 'code' ] ) {
288 288
 				// Checking this: $value = my_function([*]...).
289 289
 				$error = 'No space after opening parenthesis is prohibited';
290 290
 				$fix   = $this->phpcsFile->addFixableError( $error, $stackPtr, 'NoSpaceAfterOpenParenthesis' );
@@ -292,10 +292,10 @@  discard block
 block discarded – undo
292 292
 				if ( true === $fix ) {
293 293
 					$this->phpcsFile->fixer->addContent( $parenthesisOpener, ' ' );
294 294
 				}
295
-			} elseif ( ( ' ' !== $this->tokens[ ( $parenthesisOpener + 1 ) ]['content']
296
-				&& "\n" !== $this->tokens[ ( $parenthesisOpener + 1 ) ]['content']
297
-				&& "\r\n" !== $this->tokens[ ( $parenthesisOpener + 1 ) ]['content'] )
298
-				&& ! isset( $this->ignore_extra_space_after_open_paren[ $this->tokens[ $stackPtr ]['code'] ] )
295
+			} elseif ( ( ' ' !== $this->tokens[ ( $parenthesisOpener + 1 ) ][ 'content' ]
296
+				&& "\n" !== $this->tokens[ ( $parenthesisOpener + 1 ) ][ 'content' ]
297
+				&& "\r\n" !== $this->tokens[ ( $parenthesisOpener + 1 ) ][ 'content' ] )
298
+				&& ! isset( $this->ignore_extra_space_after_open_paren[ $this->tokens[ $stackPtr ][ 'code' ] ] )
299 299
 			) {
300 300
 				// Checking this: if ([*]...) {}.
301 301
 				$error = 'Expected exactly one space after opening parenthesis; "%s" found.';
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 					$error,
304 304
 					$stackPtr,
305 305
 					'ExtraSpaceAfterOpenParenthesis',
306
-					$this->tokens[ ( $parenthesisOpener + 1 ) ]['content']
306
+					$this->tokens[ ( $parenthesisOpener + 1 ) ][ 'content' ]
307 307
 				);
308 308
 
309 309
 				if ( true === $fix ) {
@@ -312,29 +312,29 @@  discard block
 block discarded – undo
312 312
 			}
313 313
 		}
314 314
 
315
-		if ( isset( $this->tokens[ $parenthesisOpener ]['parenthesis_closer'] ) ) {
315
+		if ( isset( $this->tokens[ $parenthesisOpener ][ 'parenthesis_closer' ] ) ) {
316 316
 
317
-			$parenthesisCloser = $this->tokens[ $parenthesisOpener ]['parenthesis_closer'];
317
+			$parenthesisCloser = $this->tokens[ $parenthesisOpener ][ 'parenthesis_closer' ];
318 318
 
319
-			if ( \T_CLOSE_PARENTHESIS !== $this->tokens[ ( $parenthesisOpener + 1 ) ]['code'] ) {
319
+			if ( \T_CLOSE_PARENTHESIS !== $this->tokens[ ( $parenthesisOpener + 1 ) ][ 'code' ] ) {
320 320
 
321 321
 				// Checking this: if (...[*]) {}.
322
-				if ( \T_WHITESPACE !== $this->tokens[ ( $parenthesisCloser - 1 ) ]['code'] ) {
322
+				if ( \T_WHITESPACE !== $this->tokens[ ( $parenthesisCloser - 1 ) ][ 'code' ] ) {
323 323
 					$error = 'No space before closing parenthesis is prohibited';
324 324
 					$fix   = $this->phpcsFile->addFixableError( $error, $parenthesisCloser, 'NoSpaceBeforeCloseParenthesis' );
325 325
 
326 326
 					if ( true === $fix ) {
327 327
 						$this->phpcsFile->fixer->addContentBefore( $parenthesisCloser, ' ' );
328 328
 					}
329
-				} elseif ( ' ' !== $this->tokens[ ( $parenthesisCloser - 1 ) ]['content'] ) {
329
+				} elseif ( ' ' !== $this->tokens[ ( $parenthesisCloser - 1 ) ][ 'content' ] ) {
330 330
 					$prevNonEmpty = $this->phpcsFile->findPrevious( Tokens::$emptyTokens, ( $parenthesisCloser - 1 ), null, true );
331
-					if ( $this->tokens[ ( $parenthesisCloser ) ]['line'] === $this->tokens[ ( $prevNonEmpty + 1 ) ]['line'] ) {
331
+					if ( $this->tokens[ ( $parenthesisCloser ) ][ 'line' ] === $this->tokens[ ( $prevNonEmpty + 1 ) ][ 'line' ] ) {
332 332
 						$error = 'Expected exactly one space before closing parenthesis; "%s" found.';
333 333
 						$fix   = $this->phpcsFile->addFixableError(
334 334
 							$error,
335 335
 							$stackPtr,
336 336
 							'ExtraSpaceBeforeCloseParenthesis',
337
-							$this->tokens[ ( $parenthesisCloser - 1 ) ]['content']
337
+							$this->tokens[ ( $parenthesisCloser - 1 ) ][ 'content' ]
338 338
 						);
339 339
 
340 340
 						if ( true === $fix ) {
@@ -343,12 +343,12 @@  discard block
 block discarded – undo
343 343
 					}
344 344
 				}
345 345
 
346
-				if ( \T_WHITESPACE !== $this->tokens[ ( $parenthesisCloser + 1 ) ]['code']
346
+				if ( \T_WHITESPACE !== $this->tokens[ ( $parenthesisCloser + 1 ) ][ 'code' ]
347 347
 					&& ! ( // Do NOT flag : immediately following ) for return types declarations.
348
-						\T_COLON === $this->tokens[ ( $parenthesisCloser + 1 ) ]['code']
349
-						&& in_array( $this->tokens[ $this->tokens[ $parenthesisCloser ]['parenthesis_owner'] ]['code'], array( \T_FUNCTION, \T_CLOSURE ), true )
348
+						\T_COLON === $this->tokens[ ( $parenthesisCloser + 1 ) ][ 'code' ]
349
+						&& in_array( $this->tokens[ $this->tokens[ $parenthesisCloser ][ 'parenthesis_owner' ] ][ 'code' ], array( \T_FUNCTION, \T_CLOSURE ), true )
350 350
 					)
351
-					&& ( isset( $scopeOpener ) && \T_COLON !== $this->tokens[ $scopeOpener ]['code'] )
351
+					&& ( isset( $scopeOpener ) && \T_COLON !== $this->tokens[ $scopeOpener ][ 'code' ] )
352 352
 				) {
353 353
 					$error = 'Space between opening control structure and closing parenthesis is required';
354 354
 					$fix   = $this->phpcsFile->addFixableError( $error, $scopeOpener, 'NoSpaceAfterCloseParenthesis' );
@@ -360,11 +360,11 @@  discard block
 block discarded – undo
360 360
 			}
361 361
 
362 362
 			// Ignore this for function declarations. Handled by the OpeningFunctionBraceKernighanRitchie sniff.
363
-			if ( \T_FUNCTION !== $this->tokens[ $stackPtr ]['code']
364
-				&& \T_CLOSURE !== $this->tokens[ $stackPtr ]['code']
365
-				&& isset( $this->tokens[ $parenthesisOpener ]['parenthesis_owner'] )
363
+			if ( \T_FUNCTION !== $this->tokens[ $stackPtr ][ 'code' ]
364
+				&& \T_CLOSURE !== $this->tokens[ $stackPtr ][ 'code' ]
365
+				&& isset( $this->tokens[ $parenthesisOpener ][ 'parenthesis_owner' ] )
366 366
 				&& ( isset( $scopeOpener )
367
-				&& $this->tokens[ $parenthesisCloser ]['line'] !== $this->tokens[ $scopeOpener ]['line'] )
367
+				&& $this->tokens[ $parenthesisCloser ][ 'line' ] !== $this->tokens[ $scopeOpener ][ 'line' ] )
368 368
 			) {
369 369
 				$error = 'Opening brace should be on the same line as the declaration';
370 370
 				$fix   = $this->phpcsFile->addFixableError( $error, $parenthesisOpener, 'OpenBraceNotSameLine' );
@@ -381,8 +381,8 @@  discard block
 block discarded – undo
381 381
 				}
382 382
 				return;
383 383
 
384
-			} elseif ( \T_WHITESPACE === $this->tokens[ ( $parenthesisCloser + 1 ) ]['code']
385
-				&& ' ' !== $this->tokens[ ( $parenthesisCloser + 1 ) ]['content']
384
+			} elseif ( \T_WHITESPACE === $this->tokens[ ( $parenthesisCloser + 1 ) ][ 'code' ]
385
+				&& ' ' !== $this->tokens[ ( $parenthesisCloser + 1 ) ][ 'content' ]
386 386
 			) {
387 387
 
388 388
 				// Checking this: if (...) [*]{}.
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 					$error,
392 392
 					$stackPtr,
393 393
 					'ExtraSpaceAfterCloseParenthesis',
394
-					$this->tokens[ ( $parenthesisCloser + 1 ) ]['content']
394
+					$this->tokens[ ( $parenthesisCloser + 1 ) ][ 'content' ]
395 395
 				);
396 396
 
397 397
 				if ( true === $fix ) {
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
 			$firstContent = $this->phpcsFile->findNext( \T_WHITESPACE, ( $scopeOpener + 1 ), null, true );
405 405
 
406 406
 			// We ignore spacing for some structures that tend to have their own rules.
407
-			$ignore  = array(
407
+			$ignore = array(
408 408
 				\T_FUNCTION             => true,
409 409
 				\T_CLOSURE              => true,
410 410
 				\T_DOC_COMMENT_OPEN_TAG => true,
@@ -413,8 +413,8 @@  discard block
 block discarded – undo
413 413
 			);
414 414
 			$ignore += Tokens::$ooScopeTokens;
415 415
 
416
-			if ( ! isset( $ignore[ $this->tokens[ $firstContent ]['code'] ] )
417
-				&& $this->tokens[ $firstContent ]['line'] > ( $this->tokens[ $scopeOpener ]['line'] + 1 )
416
+			if ( ! isset( $ignore[ $this->tokens[ $firstContent ][ 'code' ] ] )
417
+				&& $this->tokens[ $firstContent ][ 'line' ] > ( $this->tokens[ $scopeOpener ][ 'line' ] + 1 )
418 418
 			) {
419 419
 				$error = 'Blank line found at start of control structure';
420 420
 				$fix   = $this->phpcsFile->addFixableError( $error, $scopeOpener, 'BlankLineAfterStart' );
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
 					$this->phpcsFile->fixer->beginChangeset();
424 424
 
425 425
 					for ( $i = ( $scopeOpener + 1 ); $i < $firstContent; $i++ ) {
426
-						if ( $this->tokens[ $i ]['line'] === $this->tokens[ $firstContent ]['line'] ) {
426
+						if ( $this->tokens[ $i ][ 'line' ] === $this->tokens[ $firstContent ][ 'line' ] ) {
427 427
 							break;
428 428
 						}
429 429
 						$this->phpcsFile->fixer->replaceToken( $i, '' );
@@ -440,16 +440,16 @@  discard block
 block discarded – undo
440 440
 				$lastNonEmptyContent = $this->phpcsFile->findPrevious( Tokens::$emptyTokens, ( $scopeCloser - 1 ), null, true );
441 441
 
442 442
 				$checkToken = $lastContent;
443
-				if ( isset( $this->tokens[ $lastNonEmptyContent ]['scope_condition'] ) ) {
444
-					$checkToken = $this->tokens[ $lastNonEmptyContent ]['scope_condition'];
443
+				if ( isset( $this->tokens[ $lastNonEmptyContent ][ 'scope_condition' ] ) ) {
444
+					$checkToken = $this->tokens[ $lastNonEmptyContent ][ 'scope_condition' ];
445 445
 				}
446 446
 
447
-				if ( ! isset( $ignore[ $this->tokens[ $checkToken ]['code'] ] )
448
-					&& $this->tokens[ $lastContent ]['line'] <= ( $this->tokens[ $scopeCloser ]['line'] - 2 )
447
+				if ( ! isset( $ignore[ $this->tokens[ $checkToken ][ 'code' ] ] )
448
+					&& $this->tokens[ $lastContent ][ 'line' ] <= ( $this->tokens[ $scopeCloser ][ 'line' ] - 2 )
449 449
 				) {
450 450
 					for ( $i = ( $scopeCloser - 1 ); $i > $lastContent; $i-- ) {
451
-						if ( $this->tokens[ $i ]['line'] < $this->tokens[ $scopeCloser ]['line']
452
-							&& \T_OPEN_TAG !== $this->tokens[ $firstContent ]['code']
451
+						if ( $this->tokens[ $i ][ 'line' ] < $this->tokens[ $scopeCloser ][ 'line' ]
452
+							&& \T_OPEN_TAG !== $this->tokens[ $firstContent ][ 'code' ]
453 453
 						) {
454 454
 							// TODO: Reporting error at empty line won't highlight it in IDE.
455 455
 							$error = 'Blank line found at end of control structure';
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 								$this->phpcsFile->fixer->beginChangeset();
460 460
 
461 461
 								for ( $j = ( $lastContent + 1 ); $j < $scopeCloser; $j++ ) {
462
-									if ( $this->tokens[ $j ]['line'] === $this->tokens[ $scopeCloser ]['line'] ) {
462
+									if ( $this->tokens[ $j ][ 'line' ] === $this->tokens[ $scopeCloser ][ 'line' ] ) {
463 463
 										break;
464 464
 									}
465 465
 									$this->phpcsFile->fixer->replaceToken( $j, '' );
@@ -470,8 +470,8 @@  discard block
 block discarded – undo
470 470
 								 * the new line at the end, so don't add any extra as it would cause a fixer
471 471
 								 * conflict.
472 472
 								 */
473
-								if ( \T_COMMENT !== $this->tokens[ $lastContent ]['code']
474
-									&& ! isset( Tokens::$phpcsCommentTokens[ $this->tokens[ $lastContent ]['code'] ] ) ) {
473
+								if ( \T_COMMENT !== $this->tokens[ $lastContent ][ 'code' ]
474
+									&& ! isset( Tokens::$phpcsCommentTokens[ $this->tokens[ $lastContent ][ 'code' ] ] ) ) {
475 475
 									$this->phpcsFile->fixer->addNewlineBefore( $j );
476 476
 								}
477 477
 
@@ -496,53 +496,53 @@  discard block
 block discarded – undo
496 496
 			return;
497 497
 		}
498 498
 
499
-		if ( \T_COMMENT === $this->tokens[ $trailingContent ]['code']
500
-			|| isset( Tokens::$phpcsCommentTokens[ $this->tokens[ $trailingContent ]['code'] ] )
499
+		if ( \T_COMMENT === $this->tokens[ $trailingContent ][ 'code' ]
500
+			|| isset( Tokens::$phpcsCommentTokens[ $this->tokens[ $trailingContent ][ 'code' ] ] )
501 501
 		) {
502 502
 			// Special exception for code where the comment about
503 503
 			// an ELSE or ELSEIF is written between the control structures.
504 504
 			$nextCode = $this->phpcsFile->findNext( Tokens::$emptyTokens, ( $scopeCloser + 1 ), null, true );
505 505
 
506
-			if ( \T_ELSE === $this->tokens[ $nextCode ]['code'] || \T_ELSEIF === $this->tokens[ $nextCode ]['code'] ) {
506
+			if ( \T_ELSE === $this->tokens[ $nextCode ][ 'code' ] || \T_ELSEIF === $this->tokens[ $nextCode ][ 'code' ] ) {
507 507
 				$trailingContent = $nextCode;
508 508
 			}
509 509
 
510 510
 			// Move past end comments.
511
-			if ( $this->tokens[ $trailingContent ]['line'] === $this->tokens[ $scopeCloser ]['line'] ) {
512
-				if ( preg_match( '`^//[ ]?end`i', $this->tokens[ $trailingContent ]['content'], $matches ) > 0 ) {
511
+			if ( $this->tokens[ $trailingContent ][ 'line' ] === $this->tokens[ $scopeCloser ][ 'line' ] ) {
512
+				if ( preg_match( '`^//[ ]?end`i', $this->tokens[ $trailingContent ][ 'content' ], $matches ) > 0 ) {
513 513
 					$scopeCloser     = $trailingContent;
514 514
 					$trailingContent = $this->phpcsFile->findNext( \T_WHITESPACE, ( $trailingContent + 1 ), null, true );
515 515
 				}
516 516
 			}
517 517
 		}
518 518
 
519
-		if ( \T_ELSE === $this->tokens[ $trailingContent ]['code'] && \T_IF === $this->tokens[ $stackPtr ]['code'] ) {
519
+		if ( \T_ELSE === $this->tokens[ $trailingContent ][ 'code' ] && \T_IF === $this->tokens[ $stackPtr ][ 'code' ] ) {
520 520
 			// IF with ELSE.
521 521
 			return;
522 522
 		}
523 523
 
524
-		if ( \T_WHILE === $this->tokens[ $trailingContent ]['code'] && \T_DO === $this->tokens[ $stackPtr ]['code'] ) {
524
+		if ( \T_WHILE === $this->tokens[ $trailingContent ][ 'code' ] && \T_DO === $this->tokens[ $stackPtr ][ 'code' ] ) {
525 525
 			// DO with WHILE.
526 526
 			return;
527 527
 		}
528 528
 
529
-		if ( \T_CLOSE_TAG === $this->tokens[ $trailingContent ]['code'] ) {
529
+		if ( \T_CLOSE_TAG === $this->tokens[ $trailingContent ][ 'code' ] ) {
530 530
 			// At the end of the script or embedded code.
531 531
 			return;
532 532
 		}
533 533
 
534
-		if ( isset( $this->tokens[ $trailingContent ]['scope_condition'] )
535
-			&& \T_CLOSE_CURLY_BRACKET === $this->tokens[ $trailingContent ]['code']
534
+		if ( isset( $this->tokens[ $trailingContent ][ 'scope_condition' ] )
535
+			&& \T_CLOSE_CURLY_BRACKET === $this->tokens[ $trailingContent ][ 'code' ]
536 536
 		) {
537 537
 			// Another control structure's closing brace.
538
-			$owner = $this->tokens[ $trailingContent ]['scope_condition'];
539
-			if ( \in_array( $this->tokens[ $owner ]['code'], array( \T_FUNCTION, \T_CLOSURE, \T_CLASS, \T_ANON_CLASS, \T_INTERFACE, \T_TRAIT ), true ) ) {
538
+			$owner = $this->tokens[ $trailingContent ][ 'scope_condition' ];
539
+			if ( \in_array( $this->tokens[ $owner ][ 'code' ], array( \T_FUNCTION, \T_CLOSURE, \T_CLASS, \T_ANON_CLASS, \T_INTERFACE, \T_TRAIT ), true ) ) {
540 540
 				// The next content is the closing brace of a function, class, interface or trait
541 541
 				// so normal function/class rules apply and we can ignore it.
542 542
 				return;
543 543
 			}
544 544
 
545
-			if ( ( $this->tokens[ $scopeCloser ]['line'] + 1 ) !== $this->tokens[ $trailingContent ]['line'] ) {
545
+			if ( ( $this->tokens[ $scopeCloser ][ 'line' ] + 1 ) !== $this->tokens[ $trailingContent ][ 'line' ] ) {
546 546
 				// TODO: Won't cover following case: "} echo 'OK';".
547 547
 				$error = 'Blank line found after control structure';
548 548
 				$fix   = $this->phpcsFile->addFixableError( $error, $scopeCloser, 'BlankLineAfterEnd' );
@@ -551,14 +551,14 @@  discard block
 block discarded – undo
551 551
 					$this->phpcsFile->fixer->beginChangeset();
552 552
 
553 553
 					$i = ( $scopeCloser + 1 );
554
-					while ( $this->tokens[ $i ]['line'] !== $this->tokens[ $trailingContent ]['line'] ) {
554
+					while ( $this->tokens[ $i ][ 'line' ] !== $this->tokens[ $trailingContent ][ 'line' ] ) {
555 555
 						$this->phpcsFile->fixer->replaceToken( $i, '' );
556 556
 						$i++;
557 557
 					}
558 558
 
559 559
 					// TODO: Instead a separate error should be triggered when content comes right after closing brace.
560
-					if ( \T_COMMENT !== $this->tokens[ $scopeCloser ]['code']
561
-						&& isset( Tokens::$phpcsCommentTokens[ $this->tokens[ $scopeCloser ]['code'] ] ) === false
560
+					if ( \T_COMMENT !== $this->tokens[ $scopeCloser ][ 'code' ]
561
+						&& isset( Tokens::$phpcsCommentTokens[ $this->tokens[ $scopeCloser ][ 'code' ] ] ) === false
562 562
 					) {
563 563
 						$this->phpcsFile->fixer->addNewlineBefore( $trailingContent );
564 564
 					}
Please login to merge, or discard this patch.
wpcs/WordPress/Sniffs/WhiteSpace/CastStructureSpacingSniff.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
 	 */
46 46
 	public function process_token( $stackPtr ) {
47 47
 
48
-		if ( \T_WHITESPACE !== $this->tokens[ ( $stackPtr - 1 ) ]['code'] ) {
48
+		if ( \T_WHITESPACE !== $this->tokens[ ( $stackPtr - 1 ) ][ 'code' ] ) {
49 49
 			$error = 'No space before opening casting parenthesis is prohibited';
50 50
 			$fix   = $this->phpcsFile->addFixableError( $error, $stackPtr, 'NoSpaceBeforeOpenParenthesis' );
51 51
 			if ( true === $fix ) {
Please login to merge, or discard this patch.
wpcs/WordPress/Sniffs/WhiteSpace/PrecisionAlignmentSniff.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 		// Handle any custom ignore tokens received from a ruleset.
97 97
 		$ignoreAlignmentTokens = $this->merge_custom_array( $this->ignoreAlignmentTokens );
98 98
 
99
-		$check_tokens  = array(
99
+		$check_tokens = array(
100 100
 			\T_WHITESPACE             => true,
101 101
 			\T_INLINE_HTML            => true,
102 102
 			\T_DOC_COMMENT_WHITESPACE => true,
@@ -106,32 +106,32 @@  discard block
 block discarded – undo
106 106
 
107 107
 		for ( $i = 0; $i < $this->phpcsFile->numTokens; $i++ ) {
108 108
 
109
-			if ( 1 !== $this->tokens[ $i ]['column'] ) {
109
+			if ( 1 !== $this->tokens[ $i ][ 'column' ] ) {
110 110
 				continue;
111
-			} elseif ( isset( $check_tokens[ $this->tokens[ $i ]['code'] ] ) === false
111
+			} elseif ( isset( $check_tokens[ $this->tokens[ $i ][ 'code' ] ] ) === false
112 112
 				|| ( isset( $this->tokens[ ( $i + 1 ) ] )
113
-					&& \T_WHITESPACE === $this->tokens[ ( $i + 1 ) ]['code'] )
114
-				|| $this->tokens[ $i ]['content'] === $this->phpcsFile->eolChar
115
-				|| isset( $ignoreAlignmentTokens[ $this->tokens[ $i ]['type'] ] )
113
+					&& \T_WHITESPACE === $this->tokens[ ( $i + 1 ) ][ 'code' ] )
114
+				|| $this->tokens[ $i ][ 'content' ] === $this->phpcsFile->eolChar
115
+				|| isset( $ignoreAlignmentTokens[ $this->tokens[ $i ][ 'type' ] ] )
116 116
 				|| ( isset( $this->tokens[ ( $i + 1 ) ] )
117
-					&& isset( $ignoreAlignmentTokens[ $this->tokens[ ( $i + 1 ) ]['type'] ] ) )
117
+					&& isset( $ignoreAlignmentTokens[ $this->tokens[ ( $i + 1 ) ][ 'type' ] ] ) )
118 118
 			) {
119 119
 				continue;
120 120
 			}
121 121
 
122 122
 			$spaces = 0;
123
-			switch ( $this->tokens[ $i ]['type'] ) {
123
+			switch ( $this->tokens[ $i ][ 'type' ] ) {
124 124
 				case 'T_WHITESPACE':
125
-					$spaces = ( $this->tokens[ $i ]['length'] % $this->tab_width );
125
+					$spaces = ( $this->tokens[ $i ][ 'length' ] % $this->tab_width );
126 126
 					break;
127 127
 
128 128
 				case 'T_DOC_COMMENT_WHITESPACE':
129
-					$length = $this->tokens[ $i ]['length'];
129
+					$length = $this->tokens[ $i ][ 'length' ];
130 130
 					$spaces = ( $length % $this->tab_width );
131 131
 
132 132
 					if ( isset( $this->tokens[ ( $i + 1 ) ] )
133
-						&& ( \T_DOC_COMMENT_STAR === $this->tokens[ ( $i + 1 ) ]['code']
134
-							|| \T_DOC_COMMENT_CLOSE_TAG === $this->tokens[ ( $i + 1 ) ]['code'] )
133
+						&& ( \T_DOC_COMMENT_STAR === $this->tokens[ ( $i + 1 ) ][ 'code' ]
134
+							|| \T_DOC_COMMENT_CLOSE_TAG === $this->tokens[ ( $i + 1 ) ][ 'code' ] )
135 135
 						&& 0 !== $spaces
136 136
 					) {
137 137
 						// One alignment space expected before the *.
@@ -149,25 +149,25 @@  discard block
 block discarded – undo
149 149
 					 * Indentation whitespace for subsequent lines of multi-line comments
150 150
 					 * are tokenized as part of the comment.
151 151
 					 */
152
-					$comment    = ltrim( $this->tokens[ $i ]['content'] );
153
-					$whitespace = str_replace( $comment, '', $this->tokens[ $i ]['content'] );
152
+					$comment    = ltrim( $this->tokens[ $i ][ 'content' ] );
153
+					$whitespace = str_replace( $comment, '', $this->tokens[ $i ][ 'content' ] );
154 154
 					$length     = \strlen( $whitespace );
155 155
 					$spaces     = ( $length % $this->tab_width );
156 156
 
157
-					if ( isset( $comment[0] ) && '*' === $comment[0] && 0 !== $spaces ) {
157
+					if ( isset( $comment[ 0 ] ) && '*' === $comment[ 0 ] && 0 !== $spaces ) {
158 158
 						--$spaces;
159 159
 					}
160 160
 					break;
161 161
 
162 162
 				case 'T_INLINE_HTML':
163
-					if ( $this->tokens[ $i ]['content'] === $this->phpcsFile->eolChar ) {
163
+					if ( $this->tokens[ $i ][ 'content' ] === $this->phpcsFile->eolChar ) {
164 164
 						$spaces = 0;
165 165
 					} else {
166 166
 						/*
167 167
 						 * Indentation whitespace for inline HTML is part of the T_INLINE_HTML token.
168 168
 						 */
169
-						$content    = ltrim( $this->tokens[ $i ]['content'] );
170
-						$whitespace = str_replace( $content, '', $this->tokens[ $i ]['content'] );
169
+						$content    = ltrim( $this->tokens[ $i ][ 'content' ] );
170
+						$whitespace = str_replace( $content, '', $this->tokens[ $i ][ 'content' ] );
171 171
 						$spaces     = ( \strlen( $whitespace ) % $this->tab_width );
172 172
 					}
173 173
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 					 * This may cause false negatives as there is no check for being in a
177 177
 					 * <script> tag, but that will be rare.
178 178
 					 */
179
-					if ( isset( $content[0] ) && '*' === $content[0] && 0 !== $spaces ) {
179
+					if ( isset( $content[ 0 ] ) && '*' === $content[ 0 ] && 0 !== $spaces ) {
180 180
 						--$spaces;
181 181
 					}
182 182
 					break;
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
 	/**
30 30
 	 * Returns an array of tokens this test wants to listen for.
31 31
 	 *
32
-	 * @return array
32
+	 * @return integer[]
33 33
 	 */
34 34
 	public function register() {
35 35
 		return array(
Please login to merge, or discard this patch.
wpcs/WordPress/Sniffs/WhiteSpace/DisallowInlineTabsSniff.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -62,16 +62,16 @@  discard block
 block discarded – undo
62 62
 
63 63
 		for ( $i = ( $stackPtr + 1 ); $i < $this->phpcsFile->numTokens; $i++ ) {
64 64
 			// Skip all non-whitespace tokens and skip whitespace at the start of a new line.
65
-			if ( ! isset( $check_tokens[ $this->tokens[ $i ]['code'] ] ) || 1 === $this->tokens[ $i ]['column'] ) {
65
+			if ( ! isset( $check_tokens[ $this->tokens[ $i ][ 'code' ] ] ) || 1 === $this->tokens[ $i ][ 'column' ] ) {
66 66
 				continue;
67 67
 			}
68 68
 
69 69
 			// If tabs are being converted to spaces by the tokenizer, the
70 70
 			// original content should be checked instead of the converted content.
71
-			if ( isset( $this->tokens[ $i ]['orig_content'] ) ) {
72
-				$content = $this->tokens[ $i ]['orig_content'];
71
+			if ( isset( $this->tokens[ $i ][ 'orig_content' ] ) ) {
72
+				$content = $this->tokens[ $i ][ 'orig_content' ];
73 73
 			} else {
74
-				$content = $this->tokens[ $i ]['content'];
74
+				$content = $this->tokens[ $i ][ 'content' ];
75 75
 			}
76 76
 
77 77
 			if ( '' === $content || strpos( $content, "\t" ) === false ) {
@@ -84,14 +84,14 @@  discard block
 block discarded – undo
84 84
 				'NonIndentTabsUsed'
85 85
 			);
86 86
 			if ( true === $fix ) {
87
-				if ( isset( $this->tokens[ $i ]['orig_content'] ) ) {
87
+				if ( isset( $this->tokens[ $i ][ 'orig_content' ] ) ) {
88 88
 					// Use the replacement that PHPCS has already done.
89
-					$this->phpcsFile->fixer->replaceToken( $i, $this->tokens[ $i ]['content'] );
89
+					$this->phpcsFile->fixer->replaceToken( $i, $this->tokens[ $i ][ 'content' ] );
90 90
 				} else {
91 91
 					// Replace tabs with spaces, using an indent of $tab_width.
92 92
 					// Other sniffs can then correct the indent if they need to.
93 93
 					$spaces     = str_repeat( ' ', $this->tab_width );
94
-					$newContent = str_replace( "\t", $spaces, $this->tokens[ $i ]['content'] );
94
+					$newContent = str_replace( "\t", $spaces, $this->tokens[ $i ][ 'content' ] );
95 95
 					$this->phpcsFile->fixer->replaceToken( $i, $newContent );
96 96
 				}
97 97
 			}
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
 	/**
30 30
 	 * Returns an array of tokens this test wants to listen for.
31 31
 	 *
32
-	 * @return array
32
+	 * @return integer[]
33 33
 	 */
34 34
 	public function register() {
35 35
 		return array(
Please login to merge, or discard this patch.