Completed
Pull Request — develop (#1492)
by Zack
28:58 queued 09:00
created
vendor/squizlabs/php_codesniffer/src/Tokenizers/JS.php 1 patch
Spacing   +404 added lines, -404 removed lines patch added patch discarded remove patch
@@ -29,77 +29,77 @@  discard block
 block discarded – undo
29 29
      */
30 30
     public $scopeOpeners = [
31 31
         T_IF       => [
32
-            'start'  => [T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET],
33
-            'end'    => [T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET],
32
+            'start'  => [ T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET ],
33
+            'end'    => [ T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET ],
34 34
             'strict' => false,
35 35
             'shared' => false,
36
-            'with'   => [],
36
+            'with'   => [ ],
37 37
         ],
38 38
         T_TRY      => [
39
-            'start'  => [T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET],
40
-            'end'    => [T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET],
39
+            'start'  => [ T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET ],
40
+            'end'    => [ T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET ],
41 41
             'strict' => true,
42 42
             'shared' => false,
43
-            'with'   => [],
43
+            'with'   => [ ],
44 44
         ],
45 45
         T_CATCH    => [
46
-            'start'  => [T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET],
47
-            'end'    => [T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET],
46
+            'start'  => [ T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET ],
47
+            'end'    => [ T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET ],
48 48
             'strict' => true,
49 49
             'shared' => false,
50
-            'with'   => [],
50
+            'with'   => [ ],
51 51
         ],
52 52
         T_ELSE     => [
53
-            'start'  => [T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET],
54
-            'end'    => [T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET],
53
+            'start'  => [ T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET ],
54
+            'end'    => [ T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET ],
55 55
             'strict' => false,
56 56
             'shared' => false,
57
-            'with'   => [],
57
+            'with'   => [ ],
58 58
         ],
59 59
         T_FOR      => [
60
-            'start'  => [T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET],
61
-            'end'    => [T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET],
60
+            'start'  => [ T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET ],
61
+            'end'    => [ T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET ],
62 62
             'strict' => false,
63 63
             'shared' => false,
64
-            'with'   => [],
64
+            'with'   => [ ],
65 65
         ],
66 66
         T_CLASS    => [
67
-            'start'  => [T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET],
68
-            'end'    => [T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET],
67
+            'start'  => [ T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET ],
68
+            'end'    => [ T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET ],
69 69
             'strict' => true,
70 70
             'shared' => false,
71
-            'with'   => [],
71
+            'with'   => [ ],
72 72
         ],
73 73
         T_FUNCTION => [
74
-            'start'  => [T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET],
75
-            'end'    => [T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET],
74
+            'start'  => [ T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET ],
75
+            'end'    => [ T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET ],
76 76
             'strict' => false,
77 77
             'shared' => false,
78
-            'with'   => [],
78
+            'with'   => [ ],
79 79
         ],
80 80
         T_WHILE    => [
81
-            'start'  => [T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET],
82
-            'end'    => [T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET],
81
+            'start'  => [ T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET ],
82
+            'end'    => [ T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET ],
83 83
             'strict' => false,
84 84
             'shared' => false,
85
-            'with'   => [],
85
+            'with'   => [ ],
86 86
         ],
87 87
         T_DO       => [
88
-            'start'  => [T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET],
89
-            'end'    => [T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET],
88
+            'start'  => [ T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET ],
89
+            'end'    => [ T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET ],
90 90
             'strict' => true,
91 91
             'shared' => false,
92
-            'with'   => [],
92
+            'with'   => [ ],
93 93
         ],
94 94
         T_SWITCH   => [
95
-            'start'  => [T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET],
96
-            'end'    => [T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET],
95
+            'start'  => [ T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET ],
96
+            'end'    => [ T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET ],
97 97
             'strict' => true,
98 98
             'shared' => false,
99
-            'with'   => [],
99
+            'with'   => [ ],
100 100
         ],
101 101
         T_CASE     => [
102
-            'start'  => [T_COLON => T_COLON],
102
+            'start'  => [ T_COLON => T_COLON ],
103 103
             'end'    => [
104 104
                 T_BREAK    => T_BREAK,
105 105
                 T_RETURN   => T_RETURN,
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
             ],
116 116
         ],
117 117
         T_DEFAULT  => [
118
-            'start'  => [T_COLON => T_COLON],
118
+            'start'  => [ T_COLON => T_COLON ],
119 119
             'end'    => [
120 120
                 T_BREAK    => T_BREAK,
121 121
                 T_RETURN   => T_RETURN,
@@ -259,13 +259,13 @@  discard block
 block discarded – undo
259 259
      * @return void
260 260
      * @throws \PHP_CodeSniffer\Exceptions\TokenizerException If the file appears to be minified.
261 261
      */
262
-    public function __construct($content, Config $config, $eolChar='\n')
262
+    public function __construct( $content, Config $config, $eolChar = '\n' )
263 263
     {
264
-        if ($this->isMinifiedContent($content, $eolChar) === true) {
265
-            throw new TokenizerException('File appears to be minified and cannot be processed');
264
+        if ( $this->isMinifiedContent( $content, $eolChar ) === true ) {
265
+            throw new TokenizerException( 'File appears to be minified and cannot be processed' );
266 266
         }
267 267
 
268
-        parent::__construct($content, $config, $eolChar);
268
+        parent::__construct( $content, $config, $eolChar );
269 269
 
270 270
     }//end __construct()
271 271
 
@@ -277,20 +277,20 @@  discard block
 block discarded – undo
277 277
      *
278 278
      * @return array
279 279
      */
280
-    public function tokenize($string)
280
+    public function tokenize( $string )
281 281
     {
282
-        if (PHP_CODESNIFFER_VERBOSITY > 1) {
283
-            echo "\t*** START JS TOKENIZING ***".PHP_EOL;
282
+        if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
283
+            echo "\t*** START JS TOKENIZING ***" . PHP_EOL;
284 284
         }
285 285
 
286 286
         $maxTokenLength = 0;
287
-        foreach ($this->tokenValues as $token => $values) {
288
-            if (strlen($token) > $maxTokenLength) {
289
-                $maxTokenLength = strlen($token);
287
+        foreach ( $this->tokenValues as $token => $values ) {
288
+            if ( strlen( $token ) > $maxTokenLength ) {
289
+                $maxTokenLength = strlen( $token );
290 290
             }
291 291
         }
292 292
 
293
-        $tokens          = [];
293
+        $tokens          = [ ];
294 294
         $inString        = '';
295 295
         $stringChar      = null;
296 296
         $inComment       = '';
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 
301 301
         $commentTokenizer = new Comment();
302 302
 
303
-        $tokens[] = [
303
+        $tokens[ ] = [
304 304
             'code'    => T_OPEN_TAG,
305 305
             'type'    => 'T_OPEN_TAG',
306 306
             'content' => '',
@@ -308,41 +308,41 @@  discard block
 block discarded – undo
308 308
 
309 309
         // Convert newlines to single characters for ease of
310 310
         // processing. We will change them back later.
311
-        $string = str_replace($this->eolChar, "\n", $string);
311
+        $string = str_replace( $this->eolChar, "\n", $string );
312 312
 
313
-        $chars    = str_split($string);
314
-        $numChars = count($chars);
315
-        for ($i = 0; $i < $numChars; $i++) {
316
-            $char = $chars[$i];
313
+        $chars    = str_split( $string );
314
+        $numChars = count( $chars );
315
+        for ( $i = 0; $i < $numChars; $i++ ) {
316
+            $char = $chars[ $i ];
317 317
 
318
-            if (PHP_CODESNIFFER_VERBOSITY > 1) {
319
-                $content       = Util\Common::prepareForOutput($char);
320
-                $bufferContent = Util\Common::prepareForOutput($buffer);
318
+            if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
319
+                $content       = Util\Common::prepareForOutput( $char );
320
+                $bufferContent = Util\Common::prepareForOutput( $buffer );
321 321
 
322
-                if ($inString !== '') {
322
+                if ( $inString !== '' ) {
323 323
                     echo "\t";
324 324
                 }
325 325
 
326
-                if ($inComment !== '') {
326
+                if ( $inComment !== '' ) {
327 327
                     echo "\t";
328 328
                 }
329 329
 
330
-                echo "\tProcess char $i => $content (buffer: $bufferContent)".PHP_EOL;
330
+                echo "\tProcess char $i => $content (buffer: $bufferContent)" . PHP_EOL;
331 331
             }//end if
332 332
 
333
-            if ($inString === '' && $inComment === '' && $buffer !== '') {
333
+            if ( $inString === '' && $inComment === '' && $buffer !== '' ) {
334 334
                 // If the buffer only has whitespace and we are about to
335 335
                 // add a character, store the whitespace first.
336
-                if (trim($char) !== '' && trim($buffer) === '') {
337
-                    $tokens[] = [
336
+                if ( trim( $char ) !== '' && trim( $buffer ) === '' ) {
337
+                    $tokens[ ] = [
338 338
                         'code'    => T_WHITESPACE,
339 339
                         'type'    => 'T_WHITESPACE',
340
-                        'content' => str_replace("\n", $this->eolChar, $buffer),
340
+                        'content' => str_replace( "\n", $this->eolChar, $buffer ),
341 341
                     ];
342 342
 
343
-                    if (PHP_CODESNIFFER_VERBOSITY > 1) {
344
-                        $content = Util\Common::prepareForOutput($buffer);
345
-                        echo "\t=> Added token T_WHITESPACE ($content)".PHP_EOL;
343
+                    if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
344
+                        $content = Util\Common::prepareForOutput( $buffer );
345
+                        echo "\t=> Added token T_WHITESPACE ($content)" . PHP_EOL;
346 346
                     }
347 347
 
348 348
                     $buffer = '';
@@ -350,20 +350,20 @@  discard block
 block discarded – undo
350 350
 
351 351
                 // If the buffer is not whitespace and we are about to
352 352
                 // add a whitespace character, store the content first.
353
-                if ($inString === ''
353
+                if ( $inString === ''
354 354
                     && $inComment === ''
355
-                    && trim($char) === ''
356
-                    && trim($buffer) !== ''
355
+                    && trim( $char ) === ''
356
+                    && trim( $buffer ) !== ''
357 357
                 ) {
358
-                    $tokens[] = [
358
+                    $tokens[ ] = [
359 359
                         'code'    => T_STRING,
360 360
                         'type'    => 'T_STRING',
361
-                        'content' => str_replace("\n", $this->eolChar, $buffer),
361
+                        'content' => str_replace( "\n", $this->eolChar, $buffer ),
362 362
                     ];
363 363
 
364
-                    if (PHP_CODESNIFFER_VERBOSITY > 1) {
365
-                        $content = Util\Common::prepareForOutput($buffer);
366
-                        echo "\t=> Added token T_STRING ($content)".PHP_EOL;
364
+                    if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
365
+                        $content = Util\Common::prepareForOutput( $buffer );
366
+                        echo "\t=> Added token T_STRING ($content)" . PHP_EOL;
367 367
                     }
368 368
 
369 369
                     $buffer = '';
@@ -371,32 +371,32 @@  discard block
 block discarded – undo
371 371
             }//end if
372 372
 
373 373
             // Process strings.
374
-            if ($inComment === '' && isset($this->stringTokens[$char]) === true) {
375
-                if ($inString === $char) {
374
+            if ( $inComment === '' && isset( $this->stringTokens[ $char ] ) === true ) {
375
+                if ( $inString === $char ) {
376 376
                     // This could be the end of the string, but make sure it
377 377
                     // is not escaped first.
378 378
                     $escapes = 0;
379
-                    for ($x = ($i - 1); $x >= 0; $x--) {
380
-                        if ($chars[$x] !== '\\') {
379
+                    for ( $x = ( $i - 1 ); $x >= 0; $x-- ) {
380
+                        if ( $chars[ $x ] !== '\\' ) {
381 381
                             break;
382 382
                         }
383 383
 
384 384
                         $escapes++;
385 385
                     }
386 386
 
387
-                    if ($escapes === 0 || ($escapes % 2) === 0) {
387
+                    if ( $escapes === 0 || ( $escapes % 2 ) === 0 ) {
388 388
                         // There is an even number escape chars,
389 389
                         // so this is not escaped, it is the end of the string.
390
-                        $tokens[] = [
390
+                        $tokens[ ] = [
391 391
                             'code'    => T_CONSTANT_ENCAPSED_STRING,
392 392
                             'type'    => 'T_CONSTANT_ENCAPSED_STRING',
393
-                            'content' => str_replace("\n", $this->eolChar, $buffer).$char,
393
+                            'content' => str_replace( "\n", $this->eolChar, $buffer ) . $char,
394 394
                         ];
395 395
 
396
-                        if (PHP_CODESNIFFER_VERBOSITY > 1) {
397
-                            echo "\t\t* found end of string *".PHP_EOL;
398
-                            $content = Util\Common::prepareForOutput($buffer.$char);
399
-                            echo "\t=> Added token T_CONSTANT_ENCAPSED_STRING ($content)".PHP_EOL;
396
+                        if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
397
+                            echo "\t\t* found end of string *" . PHP_EOL;
398
+                            $content = Util\Common::prepareForOutput( $buffer . $char );
399
+                            echo "\t=> Added token T_CONSTANT_ENCAPSED_STRING ($content)" . PHP_EOL;
400 400
                         }
401 401
 
402 402
                         $buffer          = '';
@@ -405,31 +405,31 @@  discard block
 block discarded – undo
405 405
                         $stringChar      = null;
406 406
                         continue;
407 407
                     }//end if
408
-                } else if ($inString === '') {
408
+                } else if ( $inString === '' ) {
409 409
                     $inString        = $char;
410 410
                     $stringChar      = $i;
411 411
                     $preStringBuffer = $buffer;
412 412
 
413
-                    if (PHP_CODESNIFFER_VERBOSITY > 1) {
414
-                        echo "\t\t* looking for string closer *".PHP_EOL;
413
+                    if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
414
+                        echo "\t\t* looking for string closer *" . PHP_EOL;
415 415
                     }
416 416
                 }//end if
417 417
             }//end if
418 418
 
419
-            if ($inString !== '' && $char === "\n") {
419
+            if ( $inString !== '' && $char === "\n" ) {
420 420
                 // Unless this newline character is escaped, the string did not
421 421
                 // end before the end of the line, which means it probably
422 422
                 // wasn't a string at all (maybe a regex).
423
-                if ($chars[($i - 1)] !== '\\') {
423
+                if ( $chars[ ( $i - 1 ) ] !== '\\' ) {
424 424
                     $i      = $stringChar;
425 425
                     $buffer = $preStringBuffer;
426 426
                     $preStringBuffer = '';
427 427
                     $inString        = '';
428 428
                     $stringChar      = null;
429
-                    $char            = $chars[$i];
429
+                    $char            = $chars[ $i ];
430 430
 
431
-                    if (PHP_CODESNIFFER_VERBOSITY > 1) {
432
-                        echo "\t\t* found newline before end of string, bailing *".PHP_EOL;
431
+                    if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
432
+                        echo "\t\t* found newline before end of string, bailing *" . PHP_EOL;
433 433
                     }
434 434
                 }
435 435
             }
@@ -439,27 +439,27 @@  discard block
 block discarded – undo
439 439
             // We don't look for special tokens inside strings,
440 440
             // so if we are in a string, we can continue here now
441 441
             // that the current char is in the buffer.
442
-            if ($inString !== '') {
442
+            if ( $inString !== '' ) {
443 443
                 continue;
444 444
             }
445 445
 
446 446
             // Special case for T_DIVIDE which can actually be
447 447
             // the start of a regular expression.
448
-            if ($buffer === $char && $char === '/' && $chars[($i + 1)] !== '*') {
449
-                $regex = $this->getRegexToken($i, $string, $chars, $tokens);
450
-                if ($regex !== null) {
451
-                    $tokens[] = [
448
+            if ( $buffer === $char && $char === '/' && $chars[ ( $i + 1 ) ] !== '*' ) {
449
+                $regex = $this->getRegexToken( $i, $string, $chars, $tokens );
450
+                if ( $regex !== null ) {
451
+                    $tokens[ ] = [
452 452
                         'code'    => T_REGULAR_EXPRESSION,
453 453
                         'type'    => 'T_REGULAR_EXPRESSION',
454
-                        'content' => $regex['content'],
454
+                        'content' => $regex[ 'content' ],
455 455
                     ];
456 456
 
457
-                    if (PHP_CODESNIFFER_VERBOSITY > 1) {
458
-                        $content = Util\Common::prepareForOutput($regex['content']);
459
-                        echo "\t=> Added token T_REGULAR_EXPRESSION ($content)".PHP_EOL;
457
+                    if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
458
+                        $content = Util\Common::prepareForOutput( $regex[ 'content' ] );
459
+                        echo "\t=> Added token T_REGULAR_EXPRESSION ($content)" . PHP_EOL;
460 460
                     }
461 461
 
462
-                    $i           = $regex['end'];
462
+                    $i           = $regex[ 'end' ];
463 463
                     $buffer      = '';
464 464
                     $cleanBuffer = false;
465 465
                     continue;
@@ -468,53 +468,53 @@  discard block
 block discarded – undo
468 468
 
469 469
             // Check for known tokens, but ignore tokens found that are not at
470 470
             // the end of a string, like FOR and this.FORmat.
471
-            if (isset($this->tokenValues[strtolower($buffer)]) === true
472
-                && (preg_match('|[a-zA-z0-9_]|', $char) === 0
473
-                || isset($chars[($i + 1)]) === false
474
-                || preg_match('|[a-zA-z0-9_]|', $chars[($i + 1)]) === 0)
471
+            if ( isset( $this->tokenValues[ strtolower( $buffer ) ] ) === true
472
+                && ( preg_match( '|[a-zA-z0-9_]|', $char ) === 0
473
+                || isset( $chars[ ( $i + 1 ) ] ) === false
474
+                || preg_match( '|[a-zA-z0-9_]|', $chars[ ( $i + 1 ) ] ) === 0 )
475 475
             ) {
476 476
                 $matchedToken    = false;
477
-                $lookAheadLength = ($maxTokenLength - strlen($buffer));
477
+                $lookAheadLength = ( $maxTokenLength - strlen( $buffer ) );
478 478
 
479
-                if ($lookAheadLength > 0) {
479
+                if ( $lookAheadLength > 0 ) {
480 480
                     // The buffer contains a token type, but we need
481 481
                     // to look ahead at the next chars to see if this is
482 482
                     // actually part of a larger token. For example,
483 483
                     // FOR and FOREACH.
484
-                    if (PHP_CODESNIFFER_VERBOSITY > 1) {
485
-                        echo "\t\t* buffer possibly contains token, looking ahead $lookAheadLength chars *".PHP_EOL;
484
+                    if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
485
+                        echo "\t\t* buffer possibly contains token, looking ahead $lookAheadLength chars *" . PHP_EOL;
486 486
                     }
487 487
 
488 488
                     $charBuffer = $buffer;
489
-                    for ($x = 1; $x <= $lookAheadLength; $x++) {
490
-                        if (isset($chars[($i + $x)]) === false) {
489
+                    for ( $x = 1; $x <= $lookAheadLength; $x++ ) {
490
+                        if ( isset( $chars[ ( $i + $x ) ] ) === false ) {
491 491
                             break;
492 492
                         }
493 493
 
494
-                        $charBuffer .= $chars[($i + $x)];
494
+                        $charBuffer .= $chars[ ( $i + $x ) ];
495 495
 
496
-                        if (PHP_CODESNIFFER_VERBOSITY > 1) {
497
-                            $content = Util\Common::prepareForOutput($charBuffer);
498
-                            echo "\t\t=> Looking ahead $x chars => $content".PHP_EOL;
496
+                        if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
497
+                            $content = Util\Common::prepareForOutput( $charBuffer );
498
+                            echo "\t\t=> Looking ahead $x chars => $content" . PHP_EOL;
499 499
                         }
500 500
 
501
-                        if (isset($this->tokenValues[strtolower($charBuffer)]) === true) {
501
+                        if ( isset( $this->tokenValues[ strtolower( $charBuffer ) ] ) === true ) {
502 502
                             // We've found something larger that matches
503 503
                             // so we can ignore this char. Except for 1 very specific
504 504
                             // case where a comment like /**/ needs to tokenize as
505 505
                             // T_COMMENT and not T_DOC_COMMENT.
506
-                            $oldType = $this->tokenValues[strtolower($buffer)];
507
-                            $newType = $this->tokenValues[strtolower($charBuffer)];
508
-                            if ($oldType === 'T_COMMENT'
506
+                            $oldType = $this->tokenValues[ strtolower( $buffer ) ];
507
+                            $newType = $this->tokenValues[ strtolower( $charBuffer ) ];
508
+                            if ( $oldType === 'T_COMMENT'
509 509
                                 && $newType === 'T_DOC_COMMENT'
510
-                                && $chars[($i + $x + 1)] === '/'
510
+                                && $chars[ ( $i + $x + 1 ) ] === '/'
511 511
                             ) {
512
-                                if (PHP_CODESNIFFER_VERBOSITY > 1) {
513
-                                    echo "\t\t* look ahead ignored T_DOC_COMMENT, continuing *".PHP_EOL;
512
+                                if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
513
+                                    echo "\t\t* look ahead ignored T_DOC_COMMENT, continuing *" . PHP_EOL;
514 514
                                 }
515 515
                             } else {
516
-                                if (PHP_CODESNIFFER_VERBOSITY > 1) {
517
-                                    echo "\t\t* look ahead found more specific token ($newType), ignoring $i *".PHP_EOL;
516
+                                if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
517
+                                    echo "\t\t* look ahead found more specific token ($newType), ignoring $i *" . PHP_EOL;
518 518
                                 }
519 519
 
520 520
                                 $matchedToken = true;
@@ -524,52 +524,52 @@  discard block
 block discarded – undo
524 524
                     }//end for
525 525
                 }//end if
526 526
 
527
-                if ($matchedToken === false) {
528
-                    if (PHP_CODESNIFFER_VERBOSITY > 1 && $lookAheadLength > 0) {
529
-                        echo "\t\t* look ahead found nothing *".PHP_EOL;
527
+                if ( $matchedToken === false ) {
528
+                    if ( PHP_CODESNIFFER_VERBOSITY > 1 && $lookAheadLength > 0 ) {
529
+                        echo "\t\t* look ahead found nothing *" . PHP_EOL;
530 530
                     }
531 531
 
532
-                    $value = $this->tokenValues[strtolower($buffer)];
532
+                    $value = $this->tokenValues[ strtolower( $buffer ) ];
533 533
 
534
-                    if ($value === 'T_FUNCTION' && $buffer !== 'function') {
534
+                    if ( $value === 'T_FUNCTION' && $buffer !== 'function' ) {
535 535
                         // The function keyword needs to be all lowercase or else
536 536
                         // it is just a function called "Function".
537 537
                         $value = 'T_STRING';
538 538
                     }
539 539
 
540
-                    $tokens[] = [
541
-                        'code'    => constant($value),
540
+                    $tokens[ ] = [
541
+                        'code'    => constant( $value ),
542 542
                         'type'    => $value,
543 543
                         'content' => $buffer,
544 544
                     ];
545 545
 
546
-                    if (PHP_CODESNIFFER_VERBOSITY > 1) {
547
-                        $content = Util\Common::prepareForOutput($buffer);
548
-                        echo "\t=> Added token $value ($content)".PHP_EOL;
546
+                    if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
547
+                        $content = Util\Common::prepareForOutput( $buffer );
548
+                        echo "\t=> Added token $value ($content)" . PHP_EOL;
549 549
                     }
550 550
 
551 551
                     $cleanBuffer = true;
552 552
                 }//end if
553
-            } else if (isset($this->tokenValues[strtolower($char)]) === true) {
553
+            } else if ( isset( $this->tokenValues[ strtolower( $char ) ] ) === true ) {
554 554
                 // No matter what token we end up using, we don't
555 555
                 // need the content in the buffer any more because we have
556 556
                 // found a valid token.
557
-                $newContent = substr(str_replace("\n", $this->eolChar, $buffer), 0, -1);
558
-                if ($newContent !== '') {
559
-                    $tokens[] = [
557
+                $newContent = substr( str_replace( "\n", $this->eolChar, $buffer ), 0, -1 );
558
+                if ( $newContent !== '' ) {
559
+                    $tokens[ ] = [
560 560
                         'code'    => T_STRING,
561 561
                         'type'    => 'T_STRING',
562 562
                         'content' => $newContent,
563 563
                     ];
564 564
 
565
-                    if (PHP_CODESNIFFER_VERBOSITY > 1) {
566
-                        $content = Util\Common::prepareForOutput(substr($buffer, 0, -1));
567
-                        echo "\t=> Added token T_STRING ($content)".PHP_EOL;
565
+                    if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
566
+                        $content = Util\Common::prepareForOutput( substr( $buffer, 0, -1 ) );
567
+                        echo "\t=> Added token T_STRING ($content)" . PHP_EOL;
568 568
                     }
569 569
                 }
570 570
 
571
-                if (PHP_CODESNIFFER_VERBOSITY > 1) {
572
-                    echo "\t\t* char is token, looking ahead ".($maxTokenLength - 1).' chars *'.PHP_EOL;
571
+                if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
572
+                    echo "\t\t* char is token, looking ahead " . ( $maxTokenLength - 1 ) . ' chars *' . PHP_EOL;
573 573
                 }
574 574
 
575 575
                 // The char is a token type, but we need to look ahead at the
@@ -577,24 +577,24 @@  discard block
 block discarded – undo
577 577
                 // For example, = and ===.
578 578
                 $charBuffer   = $char;
579 579
                 $matchedToken = false;
580
-                for ($x = 1; $x <= $maxTokenLength; $x++) {
581
-                    if (isset($chars[($i + $x)]) === false) {
580
+                for ( $x = 1; $x <= $maxTokenLength; $x++ ) {
581
+                    if ( isset( $chars[ ( $i + $x ) ] ) === false ) {
582 582
                         break;
583 583
                     }
584 584
 
585
-                    $charBuffer .= $chars[($i + $x)];
585
+                    $charBuffer .= $chars[ ( $i + $x ) ];
586 586
 
587
-                    if (PHP_CODESNIFFER_VERBOSITY > 1) {
588
-                        $content = Util\Common::prepareForOutput($charBuffer);
589
-                        echo "\t\t=> Looking ahead $x chars => $content".PHP_EOL;
587
+                    if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
588
+                        $content = Util\Common::prepareForOutput( $charBuffer );
589
+                        echo "\t\t=> Looking ahead $x chars => $content" . PHP_EOL;
590 590
                     }
591 591
 
592
-                    if (isset($this->tokenValues[strtolower($charBuffer)]) === true) {
592
+                    if ( isset( $this->tokenValues[ strtolower( $charBuffer ) ] ) === true ) {
593 593
                         // We've found something larger that matches
594 594
                         // so we can ignore this char.
595
-                        if (PHP_CODESNIFFER_VERBOSITY > 1) {
596
-                            $type = $this->tokenValues[strtolower($charBuffer)];
597
-                            echo "\t\t* look ahead found more specific token ($type), ignoring $i *".PHP_EOL;
595
+                        if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
596
+                            $type = $this->tokenValues[ strtolower( $charBuffer ) ];
597
+                            echo "\t\t* look ahead found more specific token ($type), ignoring $i *" . PHP_EOL;
598 598
                         }
599 599
 
600 600
                         $matchedToken = true;
@@ -602,18 +602,18 @@  discard block
 block discarded – undo
602 602
                     }
603 603
                 }//end for
604 604
 
605
-                if ($matchedToken === false) {
606
-                    $value    = $this->tokenValues[strtolower($char)];
607
-                    $tokens[] = [
608
-                        'code'    => constant($value),
605
+                if ( $matchedToken === false ) {
606
+                    $value    = $this->tokenValues[ strtolower( $char ) ];
607
+                    $tokens[ ] = [
608
+                        'code'    => constant( $value ),
609 609
                         'type'    => $value,
610 610
                         'content' => $char,
611 611
                     ];
612 612
 
613
-                    if (PHP_CODESNIFFER_VERBOSITY > 1) {
614
-                        echo "\t\t* look ahead found nothing *".PHP_EOL;
615
-                        $content = Util\Common::prepareForOutput($char);
616
-                        echo "\t=> Added token $value ($content)".PHP_EOL;
613
+                    if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
614
+                        echo "\t\t* look ahead found nothing *" . PHP_EOL;
615
+                        $content = Util\Common::prepareForOutput( $char );
616
+                        echo "\t=> Added token $value ($content)" . PHP_EOL;
617 617
                     }
618 618
 
619 619
                     $cleanBuffer = true;
@@ -623,114 +623,114 @@  discard block
 block discarded – undo
623 623
             }//end if
624 624
 
625 625
             // Keep track of content inside comments.
626
-            if ($inComment === ''
627
-                && array_key_exists($buffer, $this->commentTokens) === true
626
+            if ( $inComment === ''
627
+                && array_key_exists( $buffer, $this->commentTokens ) === true
628 628
             ) {
629 629
                 // This is not really a comment if the content
630 630
                 // looks like \// (i.e., it is escaped).
631
-                if (isset($chars[($i - 2)]) === true && $chars[($i - 2)] === '\\') {
632
-                    $lastToken   = array_pop($tokens);
633
-                    $lastContent = $lastToken['content'];
634
-                    if (PHP_CODESNIFFER_VERBOSITY > 1) {
635
-                        $value   = $this->tokenValues[strtolower($lastContent)];
636
-                        $content = Util\Common::prepareForOutput($lastContent);
637
-                        echo "\t=> Removed token $value ($content)".PHP_EOL;
631
+                if ( isset( $chars[ ( $i - 2 ) ] ) === true && $chars[ ( $i - 2 ) ] === '\\' ) {
632
+                    $lastToken   = array_pop( $tokens );
633
+                    $lastContent = $lastToken[ 'content' ];
634
+                    if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
635
+                        $value   = $this->tokenValues[ strtolower( $lastContent ) ];
636
+                        $content = Util\Common::prepareForOutput( $lastContent );
637
+                        echo "\t=> Removed token $value ($content)" . PHP_EOL;
638 638
                     }
639 639
 
640
-                    $lastChars    = str_split($lastContent);
641
-                    $lastNumChars = count($lastChars);
642
-                    for ($x = 0; $x < $lastNumChars; $x++) {
643
-                        $lastChar = $lastChars[$x];
644
-                        $value    = $this->tokenValues[strtolower($lastChar)];
645
-                        $tokens[] = [
646
-                            'code'    => constant($value),
640
+                    $lastChars    = str_split( $lastContent );
641
+                    $lastNumChars = count( $lastChars );
642
+                    for ( $x = 0; $x < $lastNumChars; $x++ ) {
643
+                        $lastChar = $lastChars[ $x ];
644
+                        $value    = $this->tokenValues[ strtolower( $lastChar ) ];
645
+                        $tokens[ ] = [
646
+                            'code'    => constant( $value ),
647 647
                             'type'    => $value,
648 648
                             'content' => $lastChar,
649 649
                         ];
650 650
 
651
-                        if (PHP_CODESNIFFER_VERBOSITY > 1) {
652
-                            $content = Util\Common::prepareForOutput($lastChar);
653
-                            echo "\t=> Added token $value ($content)".PHP_EOL;
651
+                        if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
652
+                            $content = Util\Common::prepareForOutput( $lastChar );
653
+                            echo "\t=> Added token $value ($content)" . PHP_EOL;
654 654
                         }
655 655
                     }
656 656
                 } else {
657 657
                     // We have started a comment.
658 658
                     $inComment = $buffer;
659 659
 
660
-                    if (PHP_CODESNIFFER_VERBOSITY > 1) {
661
-                        echo "\t\t* looking for end of comment *".PHP_EOL;
660
+                    if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
661
+                        echo "\t\t* looking for end of comment *" . PHP_EOL;
662 662
                     }
663 663
                 }//end if
664
-            } else if ($inComment !== '') {
665
-                if ($this->commentTokens[$inComment] === null) {
664
+            } else if ( $inComment !== '' ) {
665
+                if ( $this->commentTokens[ $inComment ] === null ) {
666 666
                     // Comment ends at the next newline.
667
-                    if (strpos($buffer, "\n") !== false) {
667
+                    if ( strpos( $buffer, "\n" ) !== false ) {
668 668
                         $inComment = '';
669 669
                     }
670 670
                 } else {
671
-                    if ($this->commentTokens[$inComment] === $buffer) {
671
+                    if ( $this->commentTokens[ $inComment ] === $buffer ) {
672 672
                         $inComment = '';
673 673
                     }
674 674
                 }
675 675
 
676
-                if (PHP_CODESNIFFER_VERBOSITY > 1) {
677
-                    if ($inComment === '') {
678
-                        echo "\t\t* found end of comment *".PHP_EOL;
676
+                if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
677
+                    if ( $inComment === '' ) {
678
+                        echo "\t\t* found end of comment *" . PHP_EOL;
679 679
                     }
680 680
                 }
681 681
 
682
-                if ($inComment === '' && $cleanBuffer === false) {
683
-                    $tokens[] = [
682
+                if ( $inComment === '' && $cleanBuffer === false ) {
683
+                    $tokens[ ] = [
684 684
                         'code'    => T_STRING,
685 685
                         'type'    => 'T_STRING',
686
-                        'content' => str_replace("\n", $this->eolChar, $buffer),
686
+                        'content' => str_replace( "\n", $this->eolChar, $buffer ),
687 687
                     ];
688 688
 
689
-                    if (PHP_CODESNIFFER_VERBOSITY > 1) {
690
-                        $content = Util\Common::prepareForOutput($buffer);
691
-                        echo "\t=> Added token T_STRING ($content)".PHP_EOL;
689
+                    if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
690
+                        $content = Util\Common::prepareForOutput( $buffer );
691
+                        echo "\t=> Added token T_STRING ($content)" . PHP_EOL;
692 692
                     }
693 693
 
694 694
                     $buffer = '';
695 695
                 }
696 696
             }//end if
697 697
 
698
-            if ($cleanBuffer === true) {
698
+            if ( $cleanBuffer === true ) {
699 699
                 $buffer      = '';
700 700
                 $cleanBuffer = false;
701 701
             }
702 702
         }//end for
703 703
 
704
-        if (empty($buffer) === false) {
705
-            if ($inString !== '') {
704
+        if ( empty( $buffer ) === false ) {
705
+            if ( $inString !== '' ) {
706 706
                 // The string did not end before the end of the file,
707 707
                 // which means there was probably a syntax error somewhere.
708
-                $tokens[] = [
708
+                $tokens[ ] = [
709 709
                     'code'    => T_STRING,
710 710
                     'type'    => 'T_STRING',
711
-                    'content' => str_replace("\n", $this->eolChar, $buffer),
711
+                    'content' => str_replace( "\n", $this->eolChar, $buffer ),
712 712
                 ];
713 713
 
714
-                if (PHP_CODESNIFFER_VERBOSITY > 1) {
715
-                    $content = Util\Common::prepareForOutput($buffer);
716
-                    echo "\t=> Added token T_STRING ($content)".PHP_EOL;
714
+                if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
715
+                    $content = Util\Common::prepareForOutput( $buffer );
716
+                    echo "\t=> Added token T_STRING ($content)" . PHP_EOL;
717 717
                 }
718 718
             } else {
719 719
                 // Buffer contains whitespace from the end of the file.
720
-                $tokens[] = [
720
+                $tokens[ ] = [
721 721
                     'code'    => T_WHITESPACE,
722 722
                     'type'    => 'T_WHITESPACE',
723
-                    'content' => str_replace("\n", $this->eolChar, $buffer),
723
+                    'content' => str_replace( "\n", $this->eolChar, $buffer ),
724 724
                 ];
725 725
 
726
-                if (PHP_CODESNIFFER_VERBOSITY > 1) {
727
-                    $content = Util\Common::prepareForOutput($buffer);
728
-                    echo "\t=> Added token T_WHITESPACE ($content)".PHP_EOL;
726
+                if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
727
+                    $content = Util\Common::prepareForOutput( $buffer );
728
+                    echo "\t=> Added token T_WHITESPACE ($content)" . PHP_EOL;
729 729
                 }
730 730
             }//end if
731 731
         }//end if
732 732
 
733
-        $tokens[] = [
733
+        $tokens[ ] = [
734 734
             'code'    => T_CLOSE_TAG,
735 735
             'type'    => 'T_CLOSE_TAG',
736 736
             'content' => '',
@@ -742,46 +742,46 @@  discard block
 block discarded – undo
742 742
             so they match what the PHP tokenizer does.
743 743
         */
744 744
 
745
-        $finalTokens = [];
745
+        $finalTokens = [ ];
746 746
         $newStackPtr = 0;
747
-        $numTokens   = count($tokens);
748
-        for ($stackPtr = 0; $stackPtr < $numTokens; $stackPtr++) {
749
-            $token = $tokens[$stackPtr];
747
+        $numTokens   = count( $tokens );
748
+        for ( $stackPtr = 0; $stackPtr < $numTokens; $stackPtr++ ) {
749
+            $token = $tokens[ $stackPtr ];
750 750
 
751 751
             /*
752 752
                 Look for comments and join the tokens together.
753 753
             */
754 754
 
755
-            if ($token['code'] === T_COMMENT || $token['code'] === T_DOC_COMMENT) {
755
+            if ( $token[ 'code' ] === T_COMMENT || $token[ 'code' ] === T_DOC_COMMENT ) {
756 756
                 $newContent   = '';
757
-                $tokenContent = $token['content'];
757
+                $tokenContent = $token[ 'content' ];
758 758
 
759 759
                 $endContent = null;
760
-                if (isset($this->commentTokens[$tokenContent]) === true) {
761
-                    $endContent = $this->commentTokens[$tokenContent];
760
+                if ( isset( $this->commentTokens[ $tokenContent ] ) === true ) {
761
+                    $endContent = $this->commentTokens[ $tokenContent ];
762 762
                 }
763 763
 
764
-                while ($tokenContent !== $endContent) {
765
-                    if ($endContent === null
766
-                        && strpos($tokenContent, $this->eolChar) !== false
764
+                while ( $tokenContent !== $endContent ) {
765
+                    if ( $endContent === null
766
+                        && strpos( $tokenContent, $this->eolChar ) !== false
767 767
                     ) {
768 768
                         // A null end token means the comment ends at the end of
769 769
                         // the line so we look for newlines and split the token.
770
-                        $tokens[$stackPtr]['content'] = substr(
770
+                        $tokens[ $stackPtr ][ 'content' ] = substr(
771 771
                             $tokenContent,
772
-                            (strpos($tokenContent, $this->eolChar) + strlen($this->eolChar))
772
+                            ( strpos( $tokenContent, $this->eolChar ) + strlen( $this->eolChar ) )
773 773
                         );
774 774
 
775 775
                         $tokenContent = substr(
776 776
                             $tokenContent,
777 777
                             0,
778
-                            (strpos($tokenContent, $this->eolChar) + strlen($this->eolChar))
778
+                            ( strpos( $tokenContent, $this->eolChar ) + strlen( $this->eolChar ) )
779 779
                         );
780 780
 
781 781
                         // If the substr failed, skip the token as the content
782 782
                         // will now be blank.
783
-                        if ($tokens[$stackPtr]['content'] !== false
784
-                            && $tokens[$stackPtr]['content'] !== ''
783
+                        if ( $tokens[ $stackPtr ][ 'content' ] !== false
784
+                            && $tokens[ $stackPtr ][ 'content' ] !== ''
785 785
                         ) {
786 786
                             $stackPtr--;
787 787
                         }
@@ -791,17 +791,17 @@  discard block
 block discarded – undo
791 791
 
792 792
                     $stackPtr++;
793 793
                     $newContent .= $tokenContent;
794
-                    if (isset($tokens[$stackPtr]) === false) {
794
+                    if ( isset( $tokens[ $stackPtr ] ) === false ) {
795 795
                         break;
796 796
                     }
797 797
 
798
-                    $tokenContent = $tokens[$stackPtr]['content'];
798
+                    $tokenContent = $tokens[ $stackPtr ][ 'content' ];
799 799
                 }//end while
800 800
 
801
-                if ($token['code'] === T_DOC_COMMENT) {
802
-                    $commentTokens = $commentTokenizer->tokenizeString($newContent.$tokenContent, $this->eolChar, $newStackPtr);
803
-                    foreach ($commentTokens as $commentToken) {
804
-                        $finalTokens[$newStackPtr] = $commentToken;
801
+                if ( $token[ 'code' ] === T_DOC_COMMENT ) {
802
+                    $commentTokens = $commentTokenizer->tokenizeString( $newContent . $tokenContent, $this->eolChar, $newStackPtr );
803
+                    foreach ( $commentTokens as $commentToken ) {
804
+                        $finalTokens[ $newStackPtr ] = $commentToken;
805 805
                         $newStackPtr++;
806 806
                     }
807 807
 
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
                 } else {
810 810
                     // Save the new content in the current token so
811 811
                     // the code below can chop it up on newlines.
812
-                    $token['content'] = $newContent.$tokenContent;
812
+                    $token[ 'content' ] = $newContent . $tokenContent;
813 813
                 }
814 814
             }//end if
815 815
 
@@ -820,49 +820,49 @@  discard block
 block discarded – undo
820 820
                 Note that $token[1] is the token's content.
821 821
             */
822 822
 
823
-            if (strpos($token['content'], $this->eolChar) !== false) {
824
-                $tokenLines = explode($this->eolChar, $token['content']);
825
-                $numLines   = count($tokenLines);
823
+            if ( strpos( $token[ 'content' ], $this->eolChar ) !== false ) {
824
+                $tokenLines = explode( $this->eolChar, $token[ 'content' ] );
825
+                $numLines   = count( $tokenLines );
826 826
 
827
-                for ($i = 0; $i < $numLines; $i++) {
828
-                    $newToken = ['content' => $tokenLines[$i]];
829
-                    if ($i === ($numLines - 1)) {
830
-                        if ($tokenLines[$i] === '') {
827
+                for ( $i = 0; $i < $numLines; $i++ ) {
828
+                    $newToken = [ 'content' => $tokenLines[ $i ] ];
829
+                    if ( $i === ( $numLines - 1 ) ) {
830
+                        if ( $tokenLines[ $i ] === '' ) {
831 831
                             break;
832 832
                         }
833 833
                     } else {
834
-                        $newToken['content'] .= $this->eolChar;
834
+                        $newToken[ 'content' ] .= $this->eolChar;
835 835
                     }
836 836
 
837
-                    $newToken['type']          = $token['type'];
838
-                    $newToken['code']          = $token['code'];
839
-                    $finalTokens[$newStackPtr] = $newToken;
837
+                    $newToken[ 'type' ]          = $token[ 'type' ];
838
+                    $newToken[ 'code' ]          = $token[ 'code' ];
839
+                    $finalTokens[ $newStackPtr ] = $newToken;
840 840
                     $newStackPtr++;
841 841
                 }
842 842
             } else {
843
-                $finalTokens[$newStackPtr] = $token;
843
+                $finalTokens[ $newStackPtr ] = $token;
844 844
                 $newStackPtr++;
845 845
             }//end if
846 846
 
847 847
             // Convert numbers, including decimals.
848
-            if ($token['code'] === T_STRING
849
-                || $token['code'] === T_OBJECT_OPERATOR
848
+            if ( $token[ 'code' ] === T_STRING
849
+                || $token[ 'code' ] === T_OBJECT_OPERATOR
850 850
             ) {
851 851
                 $newContent  = '';
852 852
                 $oldStackPtr = $stackPtr;
853
-                while (preg_match('|^[0-9\.]+$|', $tokens[$stackPtr]['content']) !== 0) {
854
-                    $newContent .= $tokens[$stackPtr]['content'];
853
+                while ( preg_match( '|^[0-9\.]+$|', $tokens[ $stackPtr ][ 'content' ] ) !== 0 ) {
854
+                    $newContent .= $tokens[ $stackPtr ][ 'content' ];
855 855
                     $stackPtr++;
856 856
                 }
857 857
 
858
-                if ($newContent !== '' && $newContent !== '.') {
859
-                    $finalTokens[($newStackPtr - 1)]['content'] = $newContent;
860
-                    if (ctype_digit($newContent) === true) {
861
-                        $finalTokens[($newStackPtr - 1)]['code'] = constant('T_LNUMBER');
862
-                        $finalTokens[($newStackPtr - 1)]['type'] = 'T_LNUMBER';
858
+                if ( $newContent !== '' && $newContent !== '.' ) {
859
+                    $finalTokens[ ( $newStackPtr - 1 ) ][ 'content' ] = $newContent;
860
+                    if ( ctype_digit( $newContent ) === true ) {
861
+                        $finalTokens[ ( $newStackPtr - 1 ) ][ 'code' ] = constant( 'T_LNUMBER' );
862
+                        $finalTokens[ ( $newStackPtr - 1 ) ][ 'type' ] = 'T_LNUMBER';
863 863
                     } else {
864
-                        $finalTokens[($newStackPtr - 1)]['code'] = constant('T_DNUMBER');
865
-                        $finalTokens[($newStackPtr - 1)]['type'] = 'T_DNUMBER';
864
+                        $finalTokens[ ( $newStackPtr - 1 ) ][ 'code' ] = constant( 'T_DNUMBER' );
865
+                        $finalTokens[ ( $newStackPtr - 1 ) ][ 'type' ] = 'T_DNUMBER';
866 866
                     }
867 867
 
868 868
                     $stackPtr--;
@@ -873,18 +873,18 @@  discard block
 block discarded – undo
873 873
             }//end if
874 874
 
875 875
             // Convert the token after an object operator into a string, in most cases.
876
-            if ($token['code'] === T_OBJECT_OPERATOR) {
877
-                for ($i = ($stackPtr + 1); $i < $numTokens; $i++) {
878
-                    if (isset(Util\Tokens::$emptyTokens[$tokens[$i]['code']]) === true) {
876
+            if ( $token[ 'code' ] === T_OBJECT_OPERATOR ) {
877
+                for ( $i = ( $stackPtr + 1 ); $i < $numTokens; $i++ ) {
878
+                    if ( isset( Util\Tokens::$emptyTokens[ $tokens[ $i ][ 'code' ] ] ) === true ) {
879 879
                         continue;
880 880
                     }
881 881
 
882
-                    if ($tokens[$i]['code'] !== T_PROTOTYPE
883
-                        && $tokens[$i]['code'] !== T_LNUMBER
884
-                        && $tokens[$i]['code'] !== T_DNUMBER
882
+                    if ( $tokens[ $i ][ 'code' ] !== T_PROTOTYPE
883
+                        && $tokens[ $i ][ 'code' ] !== T_LNUMBER
884
+                        && $tokens[ $i ][ 'code' ] !== T_DNUMBER
885 885
                     ) {
886
-                        $tokens[$i]['code'] = T_STRING;
887
-                        $tokens[$i]['type'] = 'T_STRING';
886
+                        $tokens[ $i ][ 'code' ] = T_STRING;
887
+                        $tokens[ $i ][ 'type' ] = 'T_STRING';
888 888
                     }
889 889
 
890 890
                     break;
@@ -892,8 +892,8 @@  discard block
 block discarded – undo
892 892
             }
893 893
         }//end for
894 894
 
895
-        if (PHP_CODESNIFFER_VERBOSITY > 1) {
896
-            echo "\t*** END TOKENIZING ***".PHP_EOL;
895
+        if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
896
+            echo "\t*** END TOKENIZING ***" . PHP_EOL;
897 897
         }
898 898
 
899 899
         return $finalTokens;
@@ -913,7 +913,7 @@  discard block
 block discarded – undo
913 913
      *
914 914
      * @return array<string, string>|null
915 915
      */
916
-    public function getRegexToken($char, $string, $chars, $tokens)
916
+    public function getRegexToken( $char, $string, $chars, $tokens )
917 917
     {
918 918
         $beforeTokens = [
919 919
             T_EQUAL               => true,
@@ -948,36 +948,36 @@  discard block
 block discarded – undo
948 948
 
949 949
         // Find the last non-whitespace token that was added
950 950
         // to the tokens array.
951
-        $numTokens = count($tokens);
952
-        for ($prev = ($numTokens - 1); $prev >= 0; $prev--) {
953
-            if (isset(Util\Tokens::$emptyTokens[$tokens[$prev]['code']]) === false) {
951
+        $numTokens = count( $tokens );
952
+        for ( $prev = ( $numTokens - 1 ); $prev >= 0; $prev-- ) {
953
+            if ( isset( Util\Tokens::$emptyTokens[ $tokens[ $prev ][ 'code' ] ] ) === false ) {
954 954
                 break;
955 955
             }
956 956
         }
957 957
 
958
-        if (isset($beforeTokens[$tokens[$prev]['code']]) === false) {
958
+        if ( isset( $beforeTokens[ $tokens[ $prev ][ 'code' ] ] ) === false ) {
959 959
             return null;
960 960
         }
961 961
 
962 962
         // This is probably a regular expression, so look for the end of it.
963
-        if (PHP_CODESNIFFER_VERBOSITY > 1) {
964
-            echo "\t* token possibly starts a regular expression *".PHP_EOL;
963
+        if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
964
+            echo "\t* token possibly starts a regular expression *" . PHP_EOL;
965 965
         }
966 966
 
967
-        $numChars = count($chars);
968
-        for ($next = ($char + 1); $next < $numChars; $next++) {
969
-            if ($chars[$next] === '/') {
967
+        $numChars = count( $chars );
968
+        for ( $next = ( $char + 1 ); $next < $numChars; $next++ ) {
969
+            if ( $chars[ $next ] === '/' ) {
970 970
                 // Just make sure this is not escaped first.
971
-                if ($chars[($next - 1)] !== '\\') {
971
+                if ( $chars[ ( $next - 1 ) ] !== '\\' ) {
972 972
                     // In the simple form: /.../ so we found the end.
973 973
                     break;
974
-                } else if ($chars[($next - 2)] === '\\') {
974
+                } else if ( $chars[ ( $next - 2 ) ] === '\\' ) {
975 975
                     // In the form: /...\\/ so we found the end.
976 976
                     break;
977 977
                 }
978 978
             } else {
979
-                $possibleEolChar = substr($string, $next, strlen($this->eolChar));
980
-                if ($possibleEolChar === $this->eolChar) {
979
+                $possibleEolChar = substr( $string, $next, strlen( $this->eolChar ) );
980
+                if ( $possibleEolChar === $this->eolChar ) {
981 981
                     // This is the last token on the line and regular
982 982
                     // expressions need to be defined on a single line,
983 983
                     // so this is not a regular expression.
@@ -986,15 +986,15 @@  discard block
 block discarded – undo
986 986
             }
987 987
         }
988 988
 
989
-        if ($chars[$next] !== '/') {
990
-            if (PHP_CODESNIFFER_VERBOSITY > 1) {
991
-                echo "\t* could not find end of regular expression *".PHP_EOL;
989
+        if ( $chars[ $next ] !== '/' ) {
990
+            if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
991
+                echo "\t* could not find end of regular expression *" . PHP_EOL;
992 992
             }
993 993
 
994 994
             return null;
995 995
         }
996 996
 
997
-        while (preg_match('|[a-zA-Z]|', $chars[($next + 1)]) !== 0) {
997
+        while ( preg_match( '|[a-zA-Z]|', $chars[ ( $next + 1 ) ] ) !== 0 ) {
998 998
             // The token directly after the end of the regex can
999 999
             // be modifiers like global and case insensitive
1000 1000
             // (.e.g, /pattern/gi).
@@ -1002,25 +1002,25 @@  discard block
 block discarded – undo
1002 1002
         }
1003 1003
 
1004 1004
         $regexEnd = $next;
1005
-        if (PHP_CODESNIFFER_VERBOSITY > 1) {
1006
-            echo "\t* found end of regular expression at token $regexEnd *".PHP_EOL;
1005
+        if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
1006
+            echo "\t* found end of regular expression at token $regexEnd *" . PHP_EOL;
1007 1007
         }
1008 1008
 
1009
-        for ($next += 1; $next < $numChars; $next++) {
1010
-            if ($chars[$next] !== ' ') {
1009
+        for ( $next += 1; $next < $numChars; $next++ ) {
1010
+            if ( $chars[ $next ] !== ' ' ) {
1011 1011
                 break;
1012 1012
             } else {
1013
-                $possibleEolChar = substr($string, $next, strlen($this->eolChar));
1014
-                if ($possibleEolChar === $this->eolChar) {
1013
+                $possibleEolChar = substr( $string, $next, strlen( $this->eolChar ) );
1014
+                if ( $possibleEolChar === $this->eolChar ) {
1015 1015
                     // This is the last token on the line.
1016 1016
                     break;
1017 1017
                 }
1018 1018
             }
1019 1019
         }
1020 1020
 
1021
-        if (isset($afterTokens[$chars[$next]]) === false) {
1022
-            if (PHP_CODESNIFFER_VERBOSITY > 1) {
1023
-                echo "\t* tokens after regular expression do not look correct *".PHP_EOL;
1021
+        if ( isset( $afterTokens[ $chars[ $next ] ] ) === false ) {
1022
+            if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
1023
+                echo "\t* tokens after regular expression do not look correct *" . PHP_EOL;
1024 1024
             }
1025 1025
 
1026 1026
             return null;
@@ -1028,8 +1028,8 @@  discard block
 block discarded – undo
1028 1028
 
1029 1029
         // This is a regular expression, so join all the tokens together.
1030 1030
         $content = '';
1031
-        for ($x = $char; $x <= $regexEnd; $x++) {
1032
-            $content .= $chars[$x];
1031
+        for ( $x = $char; $x <= $regexEnd; $x++ ) {
1032
+            $content .= $chars[ $x ];
1033 1033
         }
1034 1034
 
1035 1035
         $token = [
@@ -1052,110 +1052,110 @@  discard block
 block discarded – undo
1052 1052
      */
1053 1053
     public function processAdditional()
1054 1054
     {
1055
-        if (PHP_CODESNIFFER_VERBOSITY > 1) {
1056
-            echo "\t*** START ADDITIONAL JS PROCESSING ***".PHP_EOL;
1055
+        if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
1056
+            echo "\t*** START ADDITIONAL JS PROCESSING ***" . PHP_EOL;
1057 1057
         }
1058 1058
 
1059
-        $numTokens  = count($this->tokens);
1060
-        $classStack = [];
1059
+        $numTokens  = count( $this->tokens );
1060
+        $classStack = [ ];
1061 1061
 
1062
-        for ($i = 0; $i < $numTokens; $i++) {
1063
-            if (PHP_CODESNIFFER_VERBOSITY > 1) {
1064
-                $type    = $this->tokens[$i]['type'];
1065
-                $content = Util\Common::prepareForOutput($this->tokens[$i]['content']);
1062
+        for ( $i = 0; $i < $numTokens; $i++ ) {
1063
+            if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
1064
+                $type    = $this->tokens[ $i ][ 'type' ];
1065
+                $content = Util\Common::prepareForOutput( $this->tokens[ $i ][ 'content' ] );
1066 1066
 
1067
-                echo str_repeat("\t", count($classStack));
1068
-                echo "\tProcess token $i: $type => $content".PHP_EOL;
1067
+                echo str_repeat( "\t", count( $classStack ) );
1068
+                echo "\tProcess token $i: $type => $content" . PHP_EOL;
1069 1069
             }
1070 1070
 
1071 1071
             // Looking for functions that are actually closures.
1072
-            if ($this->tokens[$i]['code'] === T_FUNCTION && isset($this->tokens[$i]['scope_opener']) === true) {
1073
-                for ($x = ($i + 1); $x < $numTokens; $x++) {
1074
-                    if (isset(Util\Tokens::$emptyTokens[$this->tokens[$x]['code']]) === false) {
1072
+            if ( $this->tokens[ $i ][ 'code' ] === T_FUNCTION && isset( $this->tokens[ $i ][ 'scope_opener' ] ) === true ) {
1073
+                for ( $x = ( $i + 1 ); $x < $numTokens; $x++ ) {
1074
+                    if ( isset( Util\Tokens::$emptyTokens[ $this->tokens[ $x ][ 'code' ] ] ) === false ) {
1075 1075
                         break;
1076 1076
                     }
1077 1077
                 }
1078 1078
 
1079
-                if ($this->tokens[$x]['code'] === T_OPEN_PARENTHESIS) {
1080
-                    $this->tokens[$i]['code'] = T_CLOSURE;
1081
-                    $this->tokens[$i]['type'] = 'T_CLOSURE';
1082
-                    if (PHP_CODESNIFFER_VERBOSITY > 1) {
1083
-                        $line = $this->tokens[$i]['line'];
1084
-                        echo str_repeat("\t", count($classStack));
1085
-                        echo "\t* token $i on line $line changed from T_FUNCTION to T_CLOSURE *".PHP_EOL;
1079
+                if ( $this->tokens[ $x ][ 'code' ] === T_OPEN_PARENTHESIS ) {
1080
+                    $this->tokens[ $i ][ 'code' ] = T_CLOSURE;
1081
+                    $this->tokens[ $i ][ 'type' ] = 'T_CLOSURE';
1082
+                    if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
1083
+                        $line = $this->tokens[ $i ][ 'line' ];
1084
+                        echo str_repeat( "\t", count( $classStack ) );
1085
+                        echo "\t* token $i on line $line changed from T_FUNCTION to T_CLOSURE *" . PHP_EOL;
1086 1086
                     }
1087 1087
 
1088
-                    for ($x = ($this->tokens[$i]['scope_opener'] + 1); $x < $this->tokens[$i]['scope_closer']; $x++) {
1089
-                        if (isset($this->tokens[$x]['conditions'][$i]) === false) {
1088
+                    for ( $x = ( $this->tokens[ $i ][ 'scope_opener' ] + 1 ); $x < $this->tokens[ $i ][ 'scope_closer' ]; $x++ ) {
1089
+                        if ( isset( $this->tokens[ $x ][ 'conditions' ][ $i ] ) === false ) {
1090 1090
                             continue;
1091 1091
                         }
1092 1092
 
1093
-                        $this->tokens[$x]['conditions'][$i] = T_CLOSURE;
1094
-                        if (PHP_CODESNIFFER_VERBOSITY > 1) {
1095
-                            $type = $this->tokens[$x]['type'];
1096
-                            echo str_repeat("\t", count($classStack));
1097
-                            echo "\t\t* cleaned $x ($type) *".PHP_EOL;
1093
+                        $this->tokens[ $x ][ 'conditions' ][ $i ] = T_CLOSURE;
1094
+                        if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
1095
+                            $type = $this->tokens[ $x ][ 'type' ];
1096
+                            echo str_repeat( "\t", count( $classStack ) );
1097
+                            echo "\t\t* cleaned $x ($type) *" . PHP_EOL;
1098 1098
                         }
1099 1099
                     }
1100 1100
                 }//end if
1101 1101
 
1102 1102
                 continue;
1103
-            } else if ($this->tokens[$i]['code'] === T_OPEN_CURLY_BRACKET
1104
-                && isset($this->tokens[$i]['scope_condition']) === false
1105
-                && isset($this->tokens[$i]['bracket_closer']) === true
1103
+            } else if ( $this->tokens[ $i ][ 'code' ] === T_OPEN_CURLY_BRACKET
1104
+                && isset( $this->tokens[ $i ][ 'scope_condition' ] ) === false
1105
+                && isset( $this->tokens[ $i ][ 'bracket_closer' ] ) === true
1106 1106
             ) {
1107
-                $condition = $this->tokens[$i]['conditions'];
1108
-                $condition = end($condition);
1109
-                if ($condition === T_CLASS) {
1107
+                $condition = $this->tokens[ $i ][ 'conditions' ];
1108
+                $condition = end( $condition );
1109
+                if ( $condition === T_CLASS ) {
1110 1110
                     // Possibly an ES6 method. To be classified as one, the previous
1111 1111
                     // non-empty tokens need to be a set of parenthesis, and then a string
1112 1112
                     // (the method name).
1113
-                    for ($parenCloser = ($i - 1); $parenCloser > 0; $parenCloser--) {
1114
-                        if (isset(Util\Tokens::$emptyTokens[$this->tokens[$parenCloser]['code']]) === false) {
1113
+                    for ( $parenCloser = ( $i - 1 ); $parenCloser > 0; $parenCloser-- ) {
1114
+                        if ( isset( Util\Tokens::$emptyTokens[ $this->tokens[ $parenCloser ][ 'code' ] ] ) === false ) {
1115 1115
                             break;
1116 1116
                         }
1117 1117
                     }
1118 1118
 
1119
-                    if ($this->tokens[$parenCloser]['code'] === T_CLOSE_PARENTHESIS) {
1120
-                        $parenOpener = $this->tokens[$parenCloser]['parenthesis_opener'];
1121
-                        for ($name = ($parenOpener - 1); $name > 0; $name--) {
1122
-                            if (isset(Util\Tokens::$emptyTokens[$this->tokens[$name]['code']]) === false) {
1119
+                    if ( $this->tokens[ $parenCloser ][ 'code' ] === T_CLOSE_PARENTHESIS ) {
1120
+                        $parenOpener = $this->tokens[ $parenCloser ][ 'parenthesis_opener' ];
1121
+                        for ( $name = ( $parenOpener - 1 ); $name > 0; $name-- ) {
1122
+                            if ( isset( Util\Tokens::$emptyTokens[ $this->tokens[ $name ][ 'code' ] ] ) === false ) {
1123 1123
                                 break;
1124 1124
                             }
1125 1125
                         }
1126 1126
 
1127
-                        if ($this->tokens[$name]['code'] === T_STRING) {
1127
+                        if ( $this->tokens[ $name ][ 'code' ] === T_STRING ) {
1128 1128
                             // We found a method name.
1129
-                            if (PHP_CODESNIFFER_VERBOSITY > 1) {
1130
-                                $line = $this->tokens[$name]['line'];
1131
-                                echo str_repeat("\t", count($classStack));
1132
-                                echo "\t* token $name on line $line changed from T_STRING to T_FUNCTION *".PHP_EOL;
1129
+                            if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
1130
+                                $line = $this->tokens[ $name ][ 'line' ];
1131
+                                echo str_repeat( "\t", count( $classStack ) );
1132
+                                echo "\t* token $name on line $line changed from T_STRING to T_FUNCTION *" . PHP_EOL;
1133 1133
                             }
1134 1134
 
1135
-                            $closer = $this->tokens[$i]['bracket_closer'];
1135
+                            $closer = $this->tokens[ $i ][ 'bracket_closer' ];
1136 1136
 
1137
-                            $this->tokens[$name]['code'] = T_FUNCTION;
1138
-                            $this->tokens[$name]['type'] = 'T_FUNCTION';
1137
+                            $this->tokens[ $name ][ 'code' ] = T_FUNCTION;
1138
+                            $this->tokens[ $name ][ 'type' ] = 'T_FUNCTION';
1139 1139
 
1140
-                            foreach ([$name, $i, $closer] as $token) {
1141
-                                $this->tokens[$token]['scope_condition']    = $name;
1142
-                                $this->tokens[$token]['scope_opener']       = $i;
1143
-                                $this->tokens[$token]['scope_closer']       = $closer;
1144
-                                $this->tokens[$token]['parenthesis_opener'] = $parenOpener;
1145
-                                $this->tokens[$token]['parenthesis_closer'] = $parenCloser;
1146
-                                $this->tokens[$token]['parenthesis_owner']  = $name;
1140
+                            foreach ( [ $name, $i, $closer ] as $token ) {
1141
+                                $this->tokens[ $token ][ 'scope_condition' ]    = $name;
1142
+                                $this->tokens[ $token ][ 'scope_opener' ]       = $i;
1143
+                                $this->tokens[ $token ][ 'scope_closer' ]       = $closer;
1144
+                                $this->tokens[ $token ][ 'parenthesis_opener' ] = $parenOpener;
1145
+                                $this->tokens[ $token ][ 'parenthesis_closer' ] = $parenCloser;
1146
+                                $this->tokens[ $token ][ 'parenthesis_owner' ]  = $name;
1147 1147
                             }
1148 1148
 
1149
-                            $this->tokens[$parenOpener]['parenthesis_owner'] = $name;
1150
-                            $this->tokens[$parenCloser]['parenthesis_owner'] = $name;
1149
+                            $this->tokens[ $parenOpener ][ 'parenthesis_owner' ] = $name;
1150
+                            $this->tokens[ $parenCloser ][ 'parenthesis_owner' ] = $name;
1151 1151
 
1152
-                            for ($x = ($i + 1); $x < $closer; $x++) {
1153
-                                $this->tokens[$x]['conditions'][$name] = T_FUNCTION;
1154
-                                ksort($this->tokens[$x]['conditions'], SORT_NUMERIC);
1155
-                                if (PHP_CODESNIFFER_VERBOSITY > 1) {
1156
-                                    $type = $this->tokens[$x]['type'];
1157
-                                    echo str_repeat("\t", count($classStack));
1158
-                                    echo "\t\t* added T_FUNCTION condition to $x ($type) *".PHP_EOL;
1152
+                            for ( $x = ( $i + 1 ); $x < $closer; $x++ ) {
1153
+                                $this->tokens[ $x ][ 'conditions' ][ $name ] = T_FUNCTION;
1154
+                                ksort( $this->tokens[ $x ][ 'conditions' ], SORT_NUMERIC );
1155
+                                if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
1156
+                                    $type = $this->tokens[ $x ][ 'type' ];
1157
+                                    echo str_repeat( "\t", count( $classStack ) );
1158
+                                    echo "\t\t* added T_FUNCTION condition to $x ($type) *" . PHP_EOL;
1159 1159
                                 }
1160 1160
                             }
1161 1161
 
@@ -1164,91 +1164,91 @@  discard block
 block discarded – undo
1164 1164
                     }//end if
1165 1165
                 }//end if
1166 1166
 
1167
-                $classStack[] = $i;
1167
+                $classStack[ ] = $i;
1168 1168
 
1169
-                $closer = $this->tokens[$i]['bracket_closer'];
1170
-                $this->tokens[$i]['code']      = T_OBJECT;
1171
-                $this->tokens[$i]['type']      = 'T_OBJECT';
1172
-                $this->tokens[$closer]['code'] = T_CLOSE_OBJECT;
1173
-                $this->tokens[$closer]['type'] = 'T_CLOSE_OBJECT';
1169
+                $closer = $this->tokens[ $i ][ 'bracket_closer' ];
1170
+                $this->tokens[ $i ][ 'code' ]      = T_OBJECT;
1171
+                $this->tokens[ $i ][ 'type' ]      = 'T_OBJECT';
1172
+                $this->tokens[ $closer ][ 'code' ] = T_CLOSE_OBJECT;
1173
+                $this->tokens[ $closer ][ 'type' ] = 'T_CLOSE_OBJECT';
1174 1174
 
1175
-                if (PHP_CODESNIFFER_VERBOSITY > 1) {
1176
-                    echo str_repeat("\t", count($classStack));
1177
-                    echo "\t* token $i converted from T_OPEN_CURLY_BRACKET to T_OBJECT *".PHP_EOL;
1178
-                    echo str_repeat("\t", count($classStack));
1179
-                    echo "\t* token $closer converted from T_CLOSE_CURLY_BRACKET to T_CLOSE_OBJECT *".PHP_EOL;
1175
+                if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
1176
+                    echo str_repeat( "\t", count( $classStack ) );
1177
+                    echo "\t* token $i converted from T_OPEN_CURLY_BRACKET to T_OBJECT *" . PHP_EOL;
1178
+                    echo str_repeat( "\t", count( $classStack ) );
1179
+                    echo "\t* token $closer converted from T_CLOSE_CURLY_BRACKET to T_CLOSE_OBJECT *" . PHP_EOL;
1180 1180
                 }
1181 1181
 
1182
-                for ($x = ($i + 1); $x < $closer; $x++) {
1183
-                    $this->tokens[$x]['conditions'][$i] = T_OBJECT;
1184
-                    ksort($this->tokens[$x]['conditions'], SORT_NUMERIC);
1185
-                    if (PHP_CODESNIFFER_VERBOSITY > 1) {
1186
-                        $type = $this->tokens[$x]['type'];
1187
-                        echo str_repeat("\t", count($classStack));
1188
-                        echo "\t\t* added T_OBJECT condition to $x ($type) *".PHP_EOL;
1182
+                for ( $x = ( $i + 1 ); $x < $closer; $x++ ) {
1183
+                    $this->tokens[ $x ][ 'conditions' ][ $i ] = T_OBJECT;
1184
+                    ksort( $this->tokens[ $x ][ 'conditions' ], SORT_NUMERIC );
1185
+                    if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
1186
+                        $type = $this->tokens[ $x ][ 'type' ];
1187
+                        echo str_repeat( "\t", count( $classStack ) );
1188
+                        echo "\t\t* added T_OBJECT condition to $x ($type) *" . PHP_EOL;
1189 1189
                     }
1190 1190
                 }
1191
-            } else if ($this->tokens[$i]['code'] === T_CLOSE_OBJECT) {
1192
-                $opener = array_pop($classStack);
1193
-            } else if ($this->tokens[$i]['code'] === T_COLON) {
1191
+            } else if ( $this->tokens[ $i ][ 'code' ] === T_CLOSE_OBJECT ) {
1192
+                $opener = array_pop( $classStack );
1193
+            } else if ( $this->tokens[ $i ][ 'code' ] === T_COLON ) {
1194 1194
                 // If it is a scope opener, it belongs to a
1195 1195
                 // DEFAULT or CASE statement.
1196
-                if (isset($this->tokens[$i]['scope_condition']) === true) {
1196
+                if ( isset( $this->tokens[ $i ][ 'scope_condition' ] ) === true ) {
1197 1197
                     continue;
1198 1198
                 }
1199 1199
 
1200 1200
                 // Make sure this is not part of an inline IF statement.
1201
-                for ($x = ($i - 1); $x >= 0; $x--) {
1202
-                    if ($this->tokens[$x]['code'] === T_INLINE_THEN) {
1203
-                        $this->tokens[$i]['code'] = T_INLINE_ELSE;
1204
-                        $this->tokens[$i]['type'] = 'T_INLINE_ELSE';
1205
-
1206
-                        if (PHP_CODESNIFFER_VERBOSITY > 1) {
1207
-                            echo str_repeat("\t", count($classStack));
1208
-                            echo "\t* token $i converted from T_COLON to T_INLINE_THEN *".PHP_EOL;
1201
+                for ( $x = ( $i - 1 ); $x >= 0; $x-- ) {
1202
+                    if ( $this->tokens[ $x ][ 'code' ] === T_INLINE_THEN ) {
1203
+                        $this->tokens[ $i ][ 'code' ] = T_INLINE_ELSE;
1204
+                        $this->tokens[ $i ][ 'type' ] = 'T_INLINE_ELSE';
1205
+
1206
+                        if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
1207
+                            echo str_repeat( "\t", count( $classStack ) );
1208
+                            echo "\t* token $i converted from T_COLON to T_INLINE_THEN *" . PHP_EOL;
1209 1209
                         }
1210 1210
 
1211
-                        continue(2);
1212
-                    } else if ($this->tokens[$x]['line'] < $this->tokens[$i]['line']) {
1211
+                        continue( 2 );
1212
+                    } else if ( $this->tokens[ $x ][ 'line' ] < $this->tokens[ $i ][ 'line' ] ) {
1213 1213
                         break;
1214 1214
                     }
1215 1215
                 }
1216 1216
 
1217 1217
                 // The string to the left of the colon is either a property or label.
1218
-                for ($label = ($i - 1); $label >= 0; $label--) {
1219
-                    if (isset(Util\Tokens::$emptyTokens[$this->tokens[$label]['code']]) === false) {
1218
+                for ( $label = ( $i - 1 ); $label >= 0; $label-- ) {
1219
+                    if ( isset( Util\Tokens::$emptyTokens[ $this->tokens[ $label ][ 'code' ] ] ) === false ) {
1220 1220
                         break;
1221 1221
                     }
1222 1222
                 }
1223 1223
 
1224
-                if ($this->tokens[$label]['code'] !== T_STRING
1225
-                    && $this->tokens[$label]['code'] !== T_CONSTANT_ENCAPSED_STRING
1224
+                if ( $this->tokens[ $label ][ 'code' ] !== T_STRING
1225
+                    && $this->tokens[ $label ][ 'code' ] !== T_CONSTANT_ENCAPSED_STRING
1226 1226
                 ) {
1227 1227
                     continue;
1228 1228
                 }
1229 1229
 
1230
-                if (empty($classStack) === false) {
1231
-                    $this->tokens[$label]['code'] = T_PROPERTY;
1232
-                    $this->tokens[$label]['type'] = 'T_PROPERTY';
1230
+                if ( empty( $classStack ) === false ) {
1231
+                    $this->tokens[ $label ][ 'code' ] = T_PROPERTY;
1232
+                    $this->tokens[ $label ][ 'type' ] = 'T_PROPERTY';
1233 1233
 
1234
-                    if (PHP_CODESNIFFER_VERBOSITY > 1) {
1235
-                        echo str_repeat("\t", count($classStack));
1236
-                        echo "\t* token $label converted from T_STRING to T_PROPERTY *".PHP_EOL;
1234
+                    if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
1235
+                        echo str_repeat( "\t", count( $classStack ) );
1236
+                        echo "\t* token $label converted from T_STRING to T_PROPERTY *" . PHP_EOL;
1237 1237
                     }
1238 1238
                 } else {
1239
-                    $this->tokens[$label]['code'] = T_LABEL;
1240
-                    $this->tokens[$label]['type'] = 'T_LABEL';
1239
+                    $this->tokens[ $label ][ 'code' ] = T_LABEL;
1240
+                    $this->tokens[ $label ][ 'type' ] = 'T_LABEL';
1241 1241
 
1242
-                    if (PHP_CODESNIFFER_VERBOSITY > 1) {
1243
-                        echo str_repeat("\t", count($classStack));
1244
-                        echo "\t* token $label converted from T_STRING to T_LABEL *".PHP_EOL;
1242
+                    if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
1243
+                        echo str_repeat( "\t", count( $classStack ) );
1244
+                        echo "\t* token $label converted from T_STRING to T_LABEL *" . PHP_EOL;
1245 1245
                     }
1246 1246
                 }//end if
1247 1247
             }//end if
1248 1248
         }//end for
1249 1249
 
1250
-        if (PHP_CODESNIFFER_VERBOSITY > 1) {
1251
-            echo "\t*** END ADDITIONAL JS PROCESSING ***".PHP_EOL;
1250
+        if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
1251
+            echo "\t*** END ADDITIONAL JS PROCESSING ***" . PHP_EOL;
1252 1252
         }
1253 1253
 
1254 1254
     }//end processAdditional()
Please login to merge, or discard this patch.
vendor/squizlabs/php_codesniffer/src/Tokenizers/Comment.php 1 patch
Spacing   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -27,37 +27,37 @@  discard block
 block discarded – undo
27 27
      *
28 28
      * @return array
29 29
      */
30
-    public function tokenizeString($string, $eolChar, $stackPtr)
30
+    public function tokenizeString( $string, $eolChar, $stackPtr )
31 31
     {
32
-        if (PHP_CODESNIFFER_VERBOSITY > 1) {
33
-            echo "\t\t*** START COMMENT TOKENIZING ***".PHP_EOL;
32
+        if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
33
+            echo "\t\t*** START COMMENT TOKENIZING ***" . PHP_EOL;
34 34
         }
35 35
 
36
-        $tokens   = [];
37
-        $numChars = strlen($string);
36
+        $tokens   = [ ];
37
+        $numChars = strlen( $string );
38 38
 
39 39
         /*
40 40
             Doc block comments start with /*, but typically contain an
41 41
             extra star when they are used for function and class comments.
42 42
         */
43 43
 
44
-        $char    = ($numChars - strlen(ltrim($string, '/*')));
45
-        $openTag = substr($string, 0, $char);
46
-        $string  = ltrim($string, '/*');
44
+        $char    = ( $numChars - strlen( ltrim( $string, '/*' ) ) );
45
+        $openTag = substr( $string, 0, $char );
46
+        $string  = ltrim( $string, '/*' );
47 47
 
48
-        $tokens[$stackPtr] = [
48
+        $tokens[ $stackPtr ] = [
49 49
             'content'      => $openTag,
50 50
             'code'         => T_DOC_COMMENT_OPEN_TAG,
51 51
             'type'         => 'T_DOC_COMMENT_OPEN_TAG',
52
-            'comment_tags' => [],
52
+            'comment_tags' => [ ],
53 53
         ];
54 54
 
55 55
         $openPtr = $stackPtr;
56 56
         $stackPtr++;
57 57
 
58
-        if (PHP_CODESNIFFER_VERBOSITY > 1) {
59
-            $content = Util\Common::prepareForOutput($openTag);
60
-            echo "\t\tCreate comment token: T_DOC_COMMENT_OPEN_TAG => $content".PHP_EOL;
58
+        if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
59
+            $content = Util\Common::prepareForOutput( $openTag );
60
+            echo "\t\tCreate comment token: T_DOC_COMMENT_OPEN_TAG => $content" . PHP_EOL;
61 61
         }
62 62
 
63 63
         /*
@@ -67,56 +67,56 @@  discard block
 block discarded – undo
67 67
         */
68 68
 
69 69
         $closeTag = [
70
-            'content'        => substr($string, strlen(rtrim($string, '/*'))),
70
+            'content'        => substr( $string, strlen( rtrim( $string, '/*' ) ) ),
71 71
             'code'           => T_DOC_COMMENT_CLOSE_TAG,
72 72
             'type'           => 'T_DOC_COMMENT_CLOSE_TAG',
73 73
             'comment_opener' => $openPtr,
74 74
         ];
75 75
 
76
-        if ($closeTag['content'] === false) {
77
-            $closeTag['content'] = '';
76
+        if ( $closeTag[ 'content' ] === false ) {
77
+            $closeTag[ 'content' ] = '';
78 78
         }
79 79
 
80
-        $string = rtrim($string, '/*');
80
+        $string = rtrim( $string, '/*' );
81 81
 
82 82
         /*
83 83
             Process each line of the comment.
84 84
         */
85 85
 
86
-        $lines    = explode($eolChar, $string);
87
-        $numLines = count($lines);
88
-        foreach ($lines as $lineNum => $string) {
89
-            if ($lineNum !== ($numLines - 1)) {
86
+        $lines    = explode( $eolChar, $string );
87
+        $numLines = count( $lines );
88
+        foreach ( $lines as $lineNum => $string ) {
89
+            if ( $lineNum !== ( $numLines - 1 ) ) {
90 90
                 $string .= $eolChar;
91 91
             }
92 92
 
93 93
             $char     = 0;
94
-            $numChars = strlen($string);
94
+            $numChars = strlen( $string );
95 95
 
96 96
             // We've started a new line, so process the indent.
97
-            $space = $this->collectWhitespace($string, $char, $numChars);
98
-            if ($space !== null) {
99
-                $tokens[$stackPtr] = $space;
97
+            $space = $this->collectWhitespace( $string, $char, $numChars );
98
+            if ( $space !== null ) {
99
+                $tokens[ $stackPtr ] = $space;
100 100
                 $stackPtr++;
101
-                if (PHP_CODESNIFFER_VERBOSITY > 1) {
102
-                    $content = Util\Common::prepareForOutput($space['content']);
103
-                    echo "\t\tCreate comment token: T_DOC_COMMENT_WHITESPACE => $content".PHP_EOL;
101
+                if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
102
+                    $content = Util\Common::prepareForOutput( $space[ 'content' ] );
103
+                    echo "\t\tCreate comment token: T_DOC_COMMENT_WHITESPACE => $content" . PHP_EOL;
104 104
                 }
105 105
 
106
-                $char += strlen($space['content']);
107
-                if ($char === $numChars) {
106
+                $char += strlen( $space[ 'content' ] );
107
+                if ( $char === $numChars ) {
108 108
                     break;
109 109
                 }
110 110
             }
111 111
 
112
-            if ($string === '') {
112
+            if ( $string === '' ) {
113 113
                 continue;
114 114
             }
115 115
 
116
-            if ($lineNum > 0 && $string[$char] === '*') {
116
+            if ( $lineNum > 0 && $string[ $char ] === '*' ) {
117 117
                 // This is a function or class doc block line.
118 118
                 $char++;
119
-                $tokens[$stackPtr] = [
119
+                $tokens[ $stackPtr ] = [
120 120
                     'content' => '*',
121 121
                     'code'    => T_DOC_COMMENT_STAR,
122 122
                     'type'    => 'T_DOC_COMMENT_STAR',
@@ -124,38 +124,38 @@  discard block
 block discarded – undo
124 124
 
125 125
                 $stackPtr++;
126 126
 
127
-                if (PHP_CODESNIFFER_VERBOSITY > 1) {
128
-                    echo "\t\tCreate comment token: T_DOC_COMMENT_STAR => *".PHP_EOL;
127
+                if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
128
+                    echo "\t\tCreate comment token: T_DOC_COMMENT_STAR => *" . PHP_EOL;
129 129
                 }
130 130
             }
131 131
 
132 132
             // Now we are ready to process the actual content of the line.
133
-            $lineTokens = $this->processLine($string, $eolChar, $char, $numChars);
134
-            foreach ($lineTokens as $lineToken) {
135
-                $tokens[$stackPtr] = $lineToken;
136
-                if (PHP_CODESNIFFER_VERBOSITY > 1) {
137
-                    $content = Util\Common::prepareForOutput($lineToken['content']);
138
-                    $type    = $lineToken['type'];
139
-                    echo "\t\tCreate comment token: $type => $content".PHP_EOL;
133
+            $lineTokens = $this->processLine( $string, $eolChar, $char, $numChars );
134
+            foreach ( $lineTokens as $lineToken ) {
135
+                $tokens[ $stackPtr ] = $lineToken;
136
+                if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
137
+                    $content = Util\Common::prepareForOutput( $lineToken[ 'content' ] );
138
+                    $type    = $lineToken[ 'type' ];
139
+                    echo "\t\tCreate comment token: $type => $content" . PHP_EOL;
140 140
                 }
141 141
 
142
-                if ($lineToken['code'] === T_DOC_COMMENT_TAG) {
143
-                    $tokens[$openPtr]['comment_tags'][] = $stackPtr;
142
+                if ( $lineToken[ 'code' ] === T_DOC_COMMENT_TAG ) {
143
+                    $tokens[ $openPtr ][ 'comment_tags' ][ ] = $stackPtr;
144 144
                 }
145 145
 
146 146
                 $stackPtr++;
147 147
             }
148 148
         }//end foreach
149 149
 
150
-        $tokens[$stackPtr] = $closeTag;
151
-        $tokens[$openPtr]['comment_closer'] = $stackPtr;
152
-        if (PHP_CODESNIFFER_VERBOSITY > 1) {
153
-            $content = Util\Common::prepareForOutput($closeTag['content']);
154
-            echo "\t\tCreate comment token: T_DOC_COMMENT_CLOSE_TAG => $content".PHP_EOL;
150
+        $tokens[ $stackPtr ] = $closeTag;
151
+        $tokens[ $openPtr ][ 'comment_closer' ] = $stackPtr;
152
+        if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
153
+            $content = Util\Common::prepareForOutput( $closeTag[ 'content' ] );
154
+            echo "\t\tCreate comment token: T_DOC_COMMENT_CLOSE_TAG => $content" . PHP_EOL;
155 155
         }
156 156
 
157
-        if (PHP_CODESNIFFER_VERBOSITY > 1) {
158
-            echo "\t\t*** END COMMENT TOKENIZING ***".PHP_EOL;
157
+        if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
158
+            echo "\t\t*** END COMMENT TOKENIZING ***" . PHP_EOL;
159 159
         }
160 160
 
161 161
         return $tokens;
@@ -173,62 +173,62 @@  discard block
 block discarded – undo
173 173
      *
174 174
      * @return array
175 175
      */
176
-    private function processLine($string, $eolChar, $start, $end)
176
+    private function processLine( $string, $eolChar, $start, $end )
177 177
     {
178
-        $tokens = [];
178
+        $tokens = [ ];
179 179
 
180 180
         // Collect content padding.
181
-        $space = $this->collectWhitespace($string, $start, $end);
182
-        if ($space !== null) {
183
-            $tokens[] = $space;
184
-            $start   += strlen($space['content']);
181
+        $space = $this->collectWhitespace( $string, $start, $end );
182
+        if ( $space !== null ) {
183
+            $tokens[ ] = $space;
184
+            $start   += strlen( $space[ 'content' ] );
185 185
         }
186 186
 
187
-        if (isset($string[$start]) === false) {
187
+        if ( isset( $string[ $start ] ) === false ) {
188 188
             return $tokens;
189 189
         }
190 190
 
191
-        if ($string[$start] === '@') {
191
+        if ( $string[ $start ] === '@' ) {
192 192
             // The content up until the first whitespace is the tag name.
193
-            $matches = [];
194
-            preg_match('/@[^\s]+/', $string, $matches, 0, $start);
195
-            if (isset($matches[0]) === true
196
-                && substr(strtolower($matches[0]), 0, 7) !== '@phpcs:'
193
+            $matches = [ ];
194
+            preg_match( '/@[^\s]+/', $string, $matches, 0, $start );
195
+            if ( isset( $matches[ 0 ] ) === true
196
+                && substr( strtolower( $matches[ 0 ] ), 0, 7 ) !== '@phpcs:'
197 197
             ) {
198
-                $tagName  = $matches[0];
199
-                $start   += strlen($tagName);
200
-                $tokens[] = [
198
+                $tagName  = $matches[ 0 ];
199
+                $start   += strlen( $tagName );
200
+                $tokens[ ] = [
201 201
                     'content' => $tagName,
202 202
                     'code'    => T_DOC_COMMENT_TAG,
203 203
                     'type'    => 'T_DOC_COMMENT_TAG',
204 204
                 ];
205 205
 
206 206
                 // Then there will be some whitespace.
207
-                $space = $this->collectWhitespace($string, $start, $end);
208
-                if ($space !== null) {
209
-                    $tokens[] = $space;
210
-                    $start   += strlen($space['content']);
207
+                $space = $this->collectWhitespace( $string, $start, $end );
208
+                if ( $space !== null ) {
209
+                    $tokens[ ] = $space;
210
+                    $start   += strlen( $space[ 'content' ] );
211 211
                 }
212 212
             }
213 213
         }//end if
214 214
 
215 215
         // Process the rest of the line.
216
-        $eol = strpos($string, $eolChar, $start);
217
-        if ($eol === false) {
216
+        $eol = strpos( $string, $eolChar, $start );
217
+        if ( $eol === false ) {
218 218
             $eol = $end;
219 219
         }
220 220
 
221
-        if ($eol > $start) {
222
-            $tokens[] = [
223
-                'content' => substr($string, $start, ($eol - $start)),
221
+        if ( $eol > $start ) {
222
+            $tokens[ ] = [
223
+                'content' => substr( $string, $start, ( $eol - $start ) ),
224 224
                 'code'    => T_DOC_COMMENT_STRING,
225 225
                 'type'    => 'T_DOC_COMMENT_STRING',
226 226
             ];
227 227
         }
228 228
 
229
-        if ($eol !== $end) {
230
-            $tokens[] = [
231
-                'content' => substr($string, $eol, strlen($eolChar)),
229
+        if ( $eol !== $end ) {
230
+            $tokens[ ] = [
231
+                'content' => substr( $string, $eol, strlen( $eolChar ) ),
232 232
                 'code'    => T_DOC_COMMENT_WHITESPACE,
233 233
                 'type'    => 'T_DOC_COMMENT_WHITESPACE',
234 234
             ];
@@ -248,18 +248,18 @@  discard block
 block discarded – undo
248 248
      *
249 249
      * @return array|null
250 250
      */
251
-    private function collectWhitespace($string, $start, $end)
251
+    private function collectWhitespace( $string, $start, $end )
252 252
     {
253 253
         $space = '';
254
-        for ($start; $start < $end; $start++) {
255
-            if ($string[$start] !== ' ' && $string[$start] !== "\t") {
254
+        for ( $start; $start < $end; $start++ ) {
255
+            if ( $string[ $start ] !== ' ' && $string[ $start ] !== "\t" ) {
256 256
                 break;
257 257
             }
258 258
 
259
-            $space .= $string[$start];
259
+            $space .= $string[ $start ];
260 260
         }
261 261
 
262
-        if ($space === '') {
262
+        if ( $space === '' ) {
263 263
             return null;
264 264
         }
265 265
 
Please login to merge, or discard this patch.
vendor/squizlabs/php_codesniffer/src/Files/File.php 1 patch
Spacing   +567 added lines, -567 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
      *
107 107
      * @var array
108 108
      */
109
-    protected $tokens = [];
109
+    protected $tokens = [ ];
110 110
 
111 111
     /**
112 112
      * The errors raised from sniffs.
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
      * @var array
115 115
      * @see getErrors()
116 116
      */
117
-    protected $errors = [];
117
+    protected $errors = [ ];
118 118
 
119 119
     /**
120 120
      * The warnings raised from sniffs.
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
      * @var array
123 123
      * @see getWarnings()
124 124
      */
125
-    protected $warnings = [];
125
+    protected $warnings = [ ];
126 126
 
127 127
     /**
128 128
      * The metrics recorded by sniffs.
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
      * @var array
131 131
      * @see getMetrics()
132 132
      */
133
-    protected $metrics = [];
133
+    protected $metrics = [ ];
134 134
 
135 135
     /**
136 136
      * The metrics recorded for each token.
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
      * @var array
141 141
      * @see getMetrics()
142 142
      */
143
-    private $metricTokens = [];
143
+    private $metricTokens = [ ];
144 144
 
145 145
     /**
146 146
      * The total number of errors raised.
@@ -175,21 +175,21 @@  discard block
 block discarded – undo
175 175
      *
176 176
      * @var array
177 177
      */
178
-    protected $ignoredListeners = [];
178
+    protected $ignoredListeners = [ ];
179 179
 
180 180
     /**
181 181
      * An array of message codes that are being ignored.
182 182
      *
183 183
      * @var array
184 184
      */
185
-    protected $ignoredCodes = [];
185
+    protected $ignoredCodes = [ ];
186 186
 
187 187
     /**
188 188
      * An array of sniffs listening to this file's processing.
189 189
      *
190 190
      * @var \PHP_CodeSniffer\Sniffs\Sniff[]
191 191
      */
192
-    protected $listeners = [];
192
+    protected $listeners = [ ];
193 193
 
194 194
     /**
195 195
      * The class name of the sniff currently processing the file.
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
      *
204 204
      * @var array
205 205
      */
206
-    protected $listenerTimes = [];
206
+    protected $listenerTimes = [ ];
207 207
 
208 208
     /**
209 209
      * A cache of often used config settings to improve performance.
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
      *
213 213
      * @var array
214 214
      */
215
-    protected $configCache = [];
215
+    protected $configCache = [ ];
216 216
 
217 217
 
218 218
     /**
@@ -224,30 +224,30 @@  discard block
 block discarded – undo
224 224
      *
225 225
      * @return void
226 226
      */
227
-    public function __construct($path, Ruleset $ruleset, Config $config)
227
+    public function __construct( $path, Ruleset $ruleset, Config $config )
228 228
     {
229 229
         $this->path    = $path;
230 230
         $this->ruleset = $ruleset;
231 231
         $this->config  = $config;
232 232
         $this->fixer   = new Fixer();
233 233
 
234
-        $parts     = explode('.', $path);
235
-        $extension = array_pop($parts);
236
-        if (isset($config->extensions[$extension]) === true) {
237
-            $this->tokenizerType = $config->extensions[$extension];
234
+        $parts     = explode( '.', $path );
235
+        $extension = array_pop( $parts );
236
+        if ( isset( $config->extensions[ $extension ] ) === true ) {
237
+            $this->tokenizerType = $config->extensions[ $extension ];
238 238
         } else {
239 239
             // Revert to default.
240 240
             $this->tokenizerType = 'PHP';
241 241
         }
242 242
 
243
-        $this->configCache['cache']           = $this->config->cache;
244
-        $this->configCache['sniffs']          = array_map('strtolower', $this->config->sniffs);
245
-        $this->configCache['exclude']         = array_map('strtolower', $this->config->exclude);
246
-        $this->configCache['errorSeverity']   = $this->config->errorSeverity;
247
-        $this->configCache['warningSeverity'] = $this->config->warningSeverity;
248
-        $this->configCache['recordErrors']    = $this->config->recordErrors;
249
-        $this->configCache['ignorePatterns']  = $this->ruleset->ignorePatterns;
250
-        $this->configCache['includePatterns'] = $this->ruleset->includePatterns;
243
+        $this->configCache[ 'cache' ]           = $this->config->cache;
244
+        $this->configCache[ 'sniffs' ]          = array_map( 'strtolower', $this->config->sniffs );
245
+        $this->configCache[ 'exclude' ]         = array_map( 'strtolower', $this->config->exclude );
246
+        $this->configCache[ 'errorSeverity' ]   = $this->config->errorSeverity;
247
+        $this->configCache[ 'warningSeverity' ] = $this->config->warningSeverity;
248
+        $this->configCache[ 'recordErrors' ]    = $this->config->recordErrors;
249
+        $this->configCache[ 'ignorePatterns' ]  = $this->ruleset->ignorePatterns;
250
+        $this->configCache[ 'includePatterns' ] = $this->ruleset->includePatterns;
251 251
 
252 252
     }//end __construct()
253 253
 
@@ -261,15 +261,15 @@  discard block
 block discarded – undo
261 261
      *
262 262
      * @return void
263 263
      */
264
-    public function setContent($content)
264
+    public function setContent( $content )
265 265
     {
266 266
         $this->content = $content;
267
-        $this->tokens  = [];
267
+        $this->tokens  = [ ];
268 268
 
269 269
         try {
270
-            $this->eolChar = Util\Common::detectLineEndings($content);
271
-        } catch (RuntimeException $e) {
272
-            $this->addWarningOnLine($e->getMessage(), 1, 'Internal.DetectLineEndings');
270
+            $this->eolChar = Util\Common::detectLineEndings( $content );
271
+        } catch ( RuntimeException $e ) {
272
+            $this->addWarningOnLine( $e->getMessage(), 1, 'Internal.DetectLineEndings' );
273 273
             return;
274 274
         }
275 275
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
      */
298 298
     public function disableCaching()
299 299
     {
300
-        $this->configCache['cache'] = false;
300
+        $this->configCache[ 'cache' ] = false;
301 301
 
302 302
     }//end disableCaching()
303 303
 
@@ -309,12 +309,12 @@  discard block
 block discarded – undo
309 309
      */
310 310
     public function process()
311 311
     {
312
-        if ($this->ignored === true) {
312
+        if ( $this->ignored === true ) {
313 313
             return;
314 314
         }
315 315
 
316
-        $this->errors       = [];
317
-        $this->warnings     = [];
316
+        $this->errors       = [ ];
317
+        $this->warnings     = [ ];
318 318
         $this->errorCount   = 0;
319 319
         $this->warningCount = 0;
320 320
         $this->fixableCount = 0;
@@ -322,106 +322,106 @@  discard block
 block discarded – undo
322 322
         $this->parse();
323 323
 
324 324
         // Check if tokenizer errors cause this file to be ignored.
325
-        if ($this->ignored === true) {
325
+        if ( $this->ignored === true ) {
326 326
             return;
327 327
         }
328 328
 
329
-        $this->fixer->startFile($this);
329
+        $this->fixer->startFile( $this );
330 330
 
331
-        if (PHP_CODESNIFFER_VERBOSITY > 2) {
332
-            echo "\t*** START TOKEN PROCESSING ***".PHP_EOL;
331
+        if ( PHP_CODESNIFFER_VERBOSITY > 2 ) {
332
+            echo "\t*** START TOKEN PROCESSING ***" . PHP_EOL;
333 333
         }
334 334
 
335 335
         $foundCode        = false;
336
-        $listenerIgnoreTo = [];
337
-        $inTests          = defined('PHP_CODESNIFFER_IN_TESTS');
336
+        $listenerIgnoreTo = [ ];
337
+        $inTests          = defined( 'PHP_CODESNIFFER_IN_TESTS' );
338 338
         $checkAnnotations = $this->config->annotations;
339 339
 
340 340
         // Foreach of the listeners that have registered to listen for this
341 341
         // token, get them to process it.
342
-        foreach ($this->tokens as $stackPtr => $token) {
342
+        foreach ( $this->tokens as $stackPtr => $token ) {
343 343
             // Check for ignored lines.
344
-            if ($checkAnnotations === true
345
-                && ($token['code'] === T_COMMENT
346
-                || $token['code'] === T_PHPCS_IGNORE_FILE
347
-                || $token['code'] === T_PHPCS_SET
348
-                || $token['code'] === T_DOC_COMMENT_STRING
349
-                || $token['code'] === T_DOC_COMMENT_TAG
350
-                || ($inTests === true && $token['code'] === T_INLINE_HTML))
344
+            if ( $checkAnnotations === true
345
+                && ( $token[ 'code' ] === T_COMMENT
346
+                || $token[ 'code' ] === T_PHPCS_IGNORE_FILE
347
+                || $token[ 'code' ] === T_PHPCS_SET
348
+                || $token[ 'code' ] === T_DOC_COMMENT_STRING
349
+                || $token[ 'code' ] === T_DOC_COMMENT_TAG
350
+                || ( $inTests === true && $token[ 'code' ] === T_INLINE_HTML ) )
351 351
             ) {
352
-                $commentText      = ltrim($this->tokens[$stackPtr]['content'], ' /*');
353
-                $commentTextLower = strtolower($commentText);
354
-                if (strpos($commentText, '@codingStandards') !== false) {
355
-                    if (strpos($commentText, '@codingStandardsIgnoreFile') !== false) {
352
+                $commentText      = ltrim( $this->tokens[ $stackPtr ][ 'content' ], ' /*' );
353
+                $commentTextLower = strtolower( $commentText );
354
+                if ( strpos( $commentText, '@codingStandards' ) !== false ) {
355
+                    if ( strpos( $commentText, '@codingStandardsIgnoreFile' ) !== false ) {
356 356
                         // Ignoring the whole file, just a little late.
357
-                        $this->errors       = [];
358
-                        $this->warnings     = [];
357
+                        $this->errors       = [ ];
358
+                        $this->warnings     = [ ];
359 359
                         $this->errorCount   = 0;
360 360
                         $this->warningCount = 0;
361 361
                         $this->fixableCount = 0;
362 362
                         return;
363
-                    } else if (strpos($commentText, '@codingStandardsChangeSetting') !== false) {
364
-                        $start   = strpos($commentText, '@codingStandardsChangeSetting');
365
-                        $comment = substr($commentText, ($start + 30));
366
-                        $parts   = explode(' ', $comment);
367
-                        if (count($parts) >= 2) {
368
-                            $sniffParts = explode('.', $parts[0]);
369
-                            if (count($sniffParts) >= 3) {
363
+                    } else if ( strpos( $commentText, '@codingStandardsChangeSetting' ) !== false ) {
364
+                        $start   = strpos( $commentText, '@codingStandardsChangeSetting' );
365
+                        $comment = substr( $commentText, ( $start + 30 ) );
366
+                        $parts   = explode( ' ', $comment );
367
+                        if ( count( $parts ) >= 2 ) {
368
+                            $sniffParts = explode( '.', $parts[ 0 ] );
369
+                            if ( count( $sniffParts ) >= 3 ) {
370 370
                                 // If the sniff code is not known to us, it has not been registered in this run.
371 371
                                 // But don't throw an error as it could be there for a different standard to use.
372
-                                if (isset($this->ruleset->sniffCodes[$parts[0]]) === true) {
373
-                                    $listenerCode  = array_shift($parts);
374
-                                    $propertyCode  = array_shift($parts);
375
-                                    $propertyValue = rtrim(implode(' ', $parts), " */\r\n");
376
-                                    $listenerClass = $this->ruleset->sniffCodes[$listenerCode];
377
-                                    $this->ruleset->setSniffProperty($listenerClass, $propertyCode, $propertyValue);
372
+                                if ( isset( $this->ruleset->sniffCodes[ $parts[ 0 ] ] ) === true ) {
373
+                                    $listenerCode  = array_shift( $parts );
374
+                                    $propertyCode  = array_shift( $parts );
375
+                                    $propertyValue = rtrim( implode( ' ', $parts ), " */\r\n" );
376
+                                    $listenerClass = $this->ruleset->sniffCodes[ $listenerCode ];
377
+                                    $this->ruleset->setSniffProperty( $listenerClass, $propertyCode, $propertyValue );
378 378
                                 }
379 379
                             }
380 380
                         }
381 381
                     }//end if
382
-                } else if (substr($commentTextLower, 0, 16) === 'phpcs:ignorefile'
383
-                    || substr($commentTextLower, 0, 17) === '@phpcs:ignorefile'
382
+                } else if ( substr( $commentTextLower, 0, 16 ) === 'phpcs:ignorefile'
383
+                    || substr( $commentTextLower, 0, 17 ) === '@phpcs:ignorefile'
384 384
                 ) {
385 385
                     // Ignoring the whole file, just a little late.
386
-                    $this->errors       = [];
387
-                    $this->warnings     = [];
386
+                    $this->errors       = [ ];
387
+                    $this->warnings     = [ ];
388 388
                     $this->errorCount   = 0;
389 389
                     $this->warningCount = 0;
390 390
                     $this->fixableCount = 0;
391 391
                     return;
392
-                } else if (substr($commentTextLower, 0, 9) === 'phpcs:set'
393
-                    || substr($commentTextLower, 0, 10) === '@phpcs:set'
392
+                } else if ( substr( $commentTextLower, 0, 9 ) === 'phpcs:set'
393
+                    || substr( $commentTextLower, 0, 10 ) === '@phpcs:set'
394 394
                 ) {
395
-                    if (isset($token['sniffCode']) === true) {
396
-                        $listenerCode = $token['sniffCode'];
397
-                        if (isset($this->ruleset->sniffCodes[$listenerCode]) === true) {
398
-                            $propertyCode  = $token['sniffProperty'];
399
-                            $propertyValue = $token['sniffPropertyValue'];
400
-                            $listenerClass = $this->ruleset->sniffCodes[$listenerCode];
401
-                            $this->ruleset->setSniffProperty($listenerClass, $propertyCode, $propertyValue);
395
+                    if ( isset( $token[ 'sniffCode' ] ) === true ) {
396
+                        $listenerCode = $token[ 'sniffCode' ];
397
+                        if ( isset( $this->ruleset->sniffCodes[ $listenerCode ] ) === true ) {
398
+                            $propertyCode  = $token[ 'sniffProperty' ];
399
+                            $propertyValue = $token[ 'sniffPropertyValue' ];
400
+                            $listenerClass = $this->ruleset->sniffCodes[ $listenerCode ];
401
+                            $this->ruleset->setSniffProperty( $listenerClass, $propertyCode, $propertyValue );
402 402
                         }
403 403
                     }
404 404
                 }//end if
405 405
             }//end if
406 406
 
407
-            if (PHP_CODESNIFFER_VERBOSITY > 2) {
408
-                $type    = $token['type'];
409
-                $content = Util\Common::prepareForOutput($token['content']);
410
-                echo "\t\tProcess token $stackPtr: $type => $content".PHP_EOL;
407
+            if ( PHP_CODESNIFFER_VERBOSITY > 2 ) {
408
+                $type    = $token[ 'type' ];
409
+                $content = Util\Common::prepareForOutput( $token[ 'content' ] );
410
+                echo "\t\tProcess token $stackPtr: $type => $content" . PHP_EOL;
411 411
             }
412 412
 
413
-            if ($token['code'] !== T_INLINE_HTML) {
413
+            if ( $token[ 'code' ] !== T_INLINE_HTML ) {
414 414
                 $foundCode = true;
415 415
             }
416 416
 
417
-            if (isset($this->ruleset->tokenListeners[$token['code']]) === false) {
417
+            if ( isset( $this->ruleset->tokenListeners[ $token[ 'code' ] ] ) === false ) {
418 418
                 continue;
419 419
             }
420 420
 
421
-            foreach ($this->ruleset->tokenListeners[$token['code']] as $listenerData) {
422
-                if (isset($this->ignoredListeners[$listenerData['class']]) === true
423
-                    || (isset($listenerIgnoreTo[$listenerData['class']]) === true
424
-                    && $listenerIgnoreTo[$listenerData['class']] > $stackPtr)
421
+            foreach ( $this->ruleset->tokenListeners[ $token[ 'code' ] ] as $listenerData ) {
422
+                if ( isset( $this->ignoredListeners[ $listenerData[ 'class' ] ] ) === true
423
+                    || ( isset( $listenerIgnoreTo[ $listenerData[ 'class' ] ] ) === true
424
+                    && $listenerIgnoreTo[ $listenerData[ 'class' ] ] > $stackPtr )
425 425
                 ) {
426 426
                     // This sniff is ignoring past this token, or the whole file.
427 427
                     continue;
@@ -429,78 +429,78 @@  discard block
 block discarded – undo
429 429
 
430 430
                 // Make sure this sniff supports the tokenizer
431 431
                 // we are currently using.
432
-                $class = $listenerData['class'];
432
+                $class = $listenerData[ 'class' ];
433 433
 
434
-                if (isset($listenerData['tokenizers'][$this->tokenizerType]) === false) {
434
+                if ( isset( $listenerData[ 'tokenizers' ][ $this->tokenizerType ] ) === false ) {
435 435
                     continue;
436 436
                 }
437 437
 
438 438
                 // If the file path matches one of our ignore patterns, skip it.
439 439
                 // While there is support for a type of each pattern
440 440
                 // (absolute or relative) we don't actually support it here.
441
-                foreach ($listenerData['ignore'] as $pattern) {
441
+                foreach ( $listenerData[ 'ignore' ] as $pattern ) {
442 442
                     // We assume a / directory separator, as do the exclude rules
443 443
                     // most developers write, so we need a special case for any system
444 444
                     // that is different.
445
-                    if (DIRECTORY_SEPARATOR === '\\') {
446
-                        $pattern = str_replace('/', '\\\\', $pattern);
445
+                    if ( DIRECTORY_SEPARATOR === '\\' ) {
446
+                        $pattern = str_replace( '/', '\\\\', $pattern );
447 447
                     }
448 448
 
449
-                    $pattern = '`'.$pattern.'`i';
450
-                    if (preg_match($pattern, $this->path) === 1) {
451
-                        $this->ignoredListeners[$class] = true;
452
-                        continue(2);
449
+                    $pattern = '`' . $pattern . '`i';
450
+                    if ( preg_match( $pattern, $this->path ) === 1 ) {
451
+                        $this->ignoredListeners[ $class ] = true;
452
+                        continue( 2 );
453 453
                     }
454 454
                 }
455 455
 
456 456
                 // If the file path does not match one of our include patterns, skip it.
457 457
                 // While there is support for a type of each pattern
458 458
                 // (absolute or relative) we don't actually support it here.
459
-                if (empty($listenerData['include']) === false) {
459
+                if ( empty( $listenerData[ 'include' ] ) === false ) {
460 460
                     $included = false;
461
-                    foreach ($listenerData['include'] as $pattern) {
461
+                    foreach ( $listenerData[ 'include' ] as $pattern ) {
462 462
                         // We assume a / directory separator, as do the exclude rules
463 463
                         // most developers write, so we need a special case for any system
464 464
                         // that is different.
465
-                        if (DIRECTORY_SEPARATOR === '\\') {
466
-                            $pattern = str_replace('/', '\\\\', $pattern);
465
+                        if ( DIRECTORY_SEPARATOR === '\\' ) {
466
+                            $pattern = str_replace( '/', '\\\\', $pattern );
467 467
                         }
468 468
 
469
-                        $pattern = '`'.$pattern.'`i';
470
-                        if (preg_match($pattern, $this->path) === 1) {
469
+                        $pattern = '`' . $pattern . '`i';
470
+                        if ( preg_match( $pattern, $this->path ) === 1 ) {
471 471
                             $included = true;
472 472
                             break;
473 473
                         }
474 474
                     }
475 475
 
476
-                    if ($included === false) {
477
-                        $this->ignoredListeners[$class] = true;
476
+                    if ( $included === false ) {
477
+                        $this->ignoredListeners[ $class ] = true;
478 478
                         continue;
479 479
                     }
480 480
                 }//end if
481 481
 
482 482
                 $this->activeListener = $class;
483 483
 
484
-                if (PHP_CODESNIFFER_VERBOSITY > 2) {
485
-                    $startTime = microtime(true);
486
-                    echo "\t\t\tProcessing ".$this->activeListener.'... ';
484
+                if ( PHP_CODESNIFFER_VERBOSITY > 2 ) {
485
+                    $startTime = microtime( true );
486
+                    echo "\t\t\tProcessing " . $this->activeListener . '... ';
487 487
                 }
488 488
 
489
-                $ignoreTo = $this->ruleset->sniffs[$class]->process($this, $stackPtr);
490
-                if ($ignoreTo !== null) {
491
-                    $listenerIgnoreTo[$this->activeListener] = $ignoreTo;
489
+                $ignoreTo = $this->ruleset->sniffs[ $class ]->process( $this, $stackPtr );
490
+                if ( $ignoreTo !== null ) {
491
+                    $listenerIgnoreTo[ $this->activeListener ] = $ignoreTo;
492 492
                 }
493 493
 
494
-                if (PHP_CODESNIFFER_VERBOSITY > 2) {
495
-                    $timeTaken = (microtime(true) - $startTime);
496
-                    if (isset($this->listenerTimes[$this->activeListener]) === false) {
497
-                        $this->listenerTimes[$this->activeListener] = 0;
494
+                if ( PHP_CODESNIFFER_VERBOSITY > 2 ) {
495
+                    $timeTaken = ( microtime( true ) - $startTime );
496
+                    if ( isset( $this->listenerTimes[ $this->activeListener ] ) === false ) {
497
+                        $this->listenerTimes[ $this->activeListener ] = 0;
498 498
                     }
499 499
 
500
-                    $this->listenerTimes[$this->activeListener] += $timeTaken;
500
+                    $this->listenerTimes[ $this->activeListener ] += $timeTaken;
501 501
 
502
-                    $timeTaken = round(($timeTaken), 4);
503
-                    echo "DONE in $timeTaken seconds".PHP_EOL;
502
+                    $timeTaken = round( ( $timeTaken ), 4 );
503
+                    echo "DONE in $timeTaken seconds" . PHP_EOL;
504 504
                 }
505 505
 
506 506
                 $this->activeListener = '';
@@ -513,25 +513,25 @@  discard block
 block discarded – undo
513 513
         // We don't show this error for STDIN because we can't be sure the content
514 514
         // actually came directly from the user. It could be something like
515 515
         // refs from a Git pre-push hook.
516
-        if ($foundCode === false && $this->tokenizerType === 'PHP' && $this->path !== 'STDIN') {
517
-            $shortTags = (bool) ini_get('short_open_tag');
518
-            if ($shortTags === false) {
516
+        if ( $foundCode === false && $this->tokenizerType === 'PHP' && $this->path !== 'STDIN' ) {
517
+            $shortTags = (bool)ini_get( 'short_open_tag' );
518
+            if ( $shortTags === false ) {
519 519
                 $error = 'No PHP code was found in this file and short open tags are not allowed by this install of PHP. This file may be using short open tags but PHP does not allow them.';
520
-                $this->addWarning($error, null, 'Internal.NoCodeFound');
520
+                $this->addWarning( $error, null, 'Internal.NoCodeFound' );
521 521
             }
522 522
         }
523 523
 
524
-        if (PHP_CODESNIFFER_VERBOSITY > 2) {
525
-            echo "\t*** END TOKEN PROCESSING ***".PHP_EOL;
526
-            echo "\t*** START SNIFF PROCESSING REPORT ***".PHP_EOL;
524
+        if ( PHP_CODESNIFFER_VERBOSITY > 2 ) {
525
+            echo "\t*** END TOKEN PROCESSING ***" . PHP_EOL;
526
+            echo "\t*** START SNIFF PROCESSING REPORT ***" . PHP_EOL;
527 527
 
528
-            asort($this->listenerTimes, SORT_NUMERIC);
529
-            $this->listenerTimes = array_reverse($this->listenerTimes, true);
530
-            foreach ($this->listenerTimes as $listener => $timeTaken) {
531
-                echo "\t$listener: ".round(($timeTaken), 4).' secs'.PHP_EOL;
528
+            asort( $this->listenerTimes, SORT_NUMERIC );
529
+            $this->listenerTimes = array_reverse( $this->listenerTimes, true );
530
+            foreach ( $this->listenerTimes as $listener => $timeTaken ) {
531
+                echo "\t$listener: " . round( ( $timeTaken ), 4 ) . ' secs' . PHP_EOL;
532 532
             }
533 533
 
534
-            echo "\t*** END SNIFF PROCESSING REPORT ***".PHP_EOL;
534
+            echo "\t*** END SNIFF PROCESSING REPORT ***" . PHP_EOL;
535 535
         }
536 536
 
537 537
         $this->fixedCount += $this->fixer->getFixCount();
@@ -546,21 +546,21 @@  discard block
 block discarded – undo
546 546
      */
547 547
     public function parse()
548 548
     {
549
-        if (empty($this->tokens) === false) {
549
+        if ( empty( $this->tokens ) === false ) {
550 550
             // File has already been parsed.
551 551
             return;
552 552
         }
553 553
 
554 554
         try {
555
-            $tokenizerClass  = 'PHP_CodeSniffer\Tokenizers\\'.$this->tokenizerType;
556
-            $this->tokenizer = new $tokenizerClass($this->content, $this->config, $this->eolChar);
555
+            $tokenizerClass  = 'PHP_CodeSniffer\Tokenizers\\' . $this->tokenizerType;
556
+            $this->tokenizer = new $tokenizerClass( $this->content, $this->config, $this->eolChar );
557 557
             $this->tokens    = $this->tokenizer->getTokens();
558
-        } catch (TokenizerException $e) {
558
+        } catch ( TokenizerException $e ) {
559 559
             $this->ignored = true;
560
-            $this->addWarning($e->getMessage(), null, 'Internal.Tokenizer.Exception');
561
-            if (PHP_CODESNIFFER_VERBOSITY > 0) {
560
+            $this->addWarning( $e->getMessage(), null, 'Internal.Tokenizer.Exception' );
561
+            if ( PHP_CODESNIFFER_VERBOSITY > 0 ) {
562 562
                 echo "[$this->tokenizerType => tokenizer error]... ";
563
-                if (PHP_CODESNIFFER_VERBOSITY > 1) {
563
+                if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
564 564
                     echo PHP_EOL;
565 565
                 }
566 566
             }
@@ -568,31 +568,31 @@  discard block
 block discarded – undo
568 568
             return;
569 569
         }
570 570
 
571
-        $this->numTokens = count($this->tokens);
571
+        $this->numTokens = count( $this->tokens );
572 572
 
573 573
         // Check for mixed line endings as these can cause tokenizer errors and we
574 574
         // should let the user know that the results they get may be incorrect.
575 575
         // This is done by removing all backslashes, removing the newline char we
576 576
         // detected, then converting newlines chars into text. If any backslashes
577 577
         // are left at the end, we have additional newline chars in use.
578
-        $contents = str_replace('\\', '', $this->content);
579
-        $contents = str_replace($this->eolChar, '', $contents);
580
-        $contents = str_replace("\n", '\n', $contents);
581
-        $contents = str_replace("\r", '\r', $contents);
582
-        if (strpos($contents, '\\') !== false) {
578
+        $contents = str_replace( '\\', '', $this->content );
579
+        $contents = str_replace( $this->eolChar, '', $contents );
580
+        $contents = str_replace( "\n", '\n', $contents );
581
+        $contents = str_replace( "\r", '\r', $contents );
582
+        if ( strpos( $contents, '\\' ) !== false ) {
583 583
             $error = 'File has mixed line endings; this may cause incorrect results';
584
-            $this->addWarningOnLine($error, 1, 'Internal.LineEndings.Mixed');
584
+            $this->addWarningOnLine( $error, 1, 'Internal.LineEndings.Mixed' );
585 585
         }
586 586
 
587
-        if (PHP_CODESNIFFER_VERBOSITY > 0) {
588
-            if ($this->numTokens === 0) {
587
+        if ( PHP_CODESNIFFER_VERBOSITY > 0 ) {
588
+            if ( $this->numTokens === 0 ) {
589 589
                 $numLines = 0;
590 590
             } else {
591
-                $numLines = $this->tokens[($this->numTokens - 1)]['line'];
591
+                $numLines = $this->tokens[ ( $this->numTokens - 1 ) ][ 'line' ];
592 592
             }
593 593
 
594 594
             echo "[$this->tokenizerType => $this->numTokens tokens in $numLines lines]... ";
595
-            if (PHP_CODESNIFFER_VERBOSITY > 1) {
595
+            if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
596 596
                 echo PHP_EOL;
597 597
             }
598 598
         }
@@ -648,19 +648,19 @@  discard block
 block discarded – undo
648 648
         $error,
649 649
         $stackPtr,
650 650
         $code,
651
-        $data=[],
652
-        $severity=0,
653
-        $fixable=false
651
+        $data = [ ],
652
+        $severity = 0,
653
+        $fixable = false
654 654
     ) {
655
-        if ($stackPtr === null) {
655
+        if ( $stackPtr === null ) {
656 656
             $line   = 1;
657 657
             $column = 1;
658 658
         } else {
659
-            $line   = $this->tokens[$stackPtr]['line'];
660
-            $column = $this->tokens[$stackPtr]['column'];
659
+            $line   = $this->tokens[ $stackPtr ][ 'line' ];
660
+            $column = $this->tokens[ $stackPtr ][ 'column' ];
661 661
         }
662 662
 
663
-        return $this->addMessage(true, $error, $line, $column, $code, $data, $severity, $fixable);
663
+        return $this->addMessage( true, $error, $line, $column, $code, $data, $severity, $fixable );
664 664
 
665 665
     }//end addError()
666 666
 
@@ -682,19 +682,19 @@  discard block
 block discarded – undo
682 682
         $warning,
683 683
         $stackPtr,
684 684
         $code,
685
-        $data=[],
686
-        $severity=0,
687
-        $fixable=false
685
+        $data = [ ],
686
+        $severity = 0,
687
+        $fixable = false
688 688
     ) {
689
-        if ($stackPtr === null) {
689
+        if ( $stackPtr === null ) {
690 690
             $line   = 1;
691 691
             $column = 1;
692 692
         } else {
693
-            $line   = $this->tokens[$stackPtr]['line'];
694
-            $column = $this->tokens[$stackPtr]['column'];
693
+            $line   = $this->tokens[ $stackPtr ][ 'line' ];
694
+            $column = $this->tokens[ $stackPtr ][ 'column' ];
695 695
         }
696 696
 
697
-        return $this->addMessage(false, $warning, $line, $column, $code, $data, $severity, $fixable);
697
+        return $this->addMessage( false, $warning, $line, $column, $code, $data, $severity, $fixable );
698 698
 
699 699
     }//end addWarning()
700 700
 
@@ -715,10 +715,10 @@  discard block
 block discarded – undo
715 715
         $error,
716 716
         $line,
717 717
         $code,
718
-        $data=[],
719
-        $severity=0
718
+        $data = [ ],
719
+        $severity = 0
720 720
     ) {
721
-        return $this->addMessage(true, $error, $line, 1, $code, $data, $severity, false);
721
+        return $this->addMessage( true, $error, $line, 1, $code, $data, $severity, false );
722 722
 
723 723
     }//end addErrorOnLine()
724 724
 
@@ -739,10 +739,10 @@  discard block
 block discarded – undo
739 739
         $warning,
740 740
         $line,
741 741
         $code,
742
-        $data=[],
743
-        $severity=0
742
+        $data = [ ],
743
+        $severity = 0
744 744
     ) {
745
-        return $this->addMessage(false, $warning, $line, 1, $code, $data, $severity, false);
745
+        return $this->addMessage( false, $warning, $line, 1, $code, $data, $severity, false );
746 746
 
747 747
     }//end addWarningOnLine()
748 748
 
@@ -765,11 +765,11 @@  discard block
 block discarded – undo
765 765
         $error,
766 766
         $stackPtr,
767 767
         $code,
768
-        $data=[],
769
-        $severity=0
768
+        $data = [ ],
769
+        $severity = 0
770 770
     ) {
771
-        $recorded = $this->addError($error, $stackPtr, $code, $data, $severity, true);
772
-        if ($recorded === true && $this->fixer->enabled === true) {
771
+        $recorded = $this->addError( $error, $stackPtr, $code, $data, $severity, true );
772
+        if ( $recorded === true && $this->fixer->enabled === true ) {
773 773
             return true;
774 774
         }
775 775
 
@@ -796,11 +796,11 @@  discard block
 block discarded – undo
796 796
         $warning,
797 797
         $stackPtr,
798 798
         $code,
799
-        $data=[],
800
-        $severity=0
799
+        $data = [ ],
800
+        $severity = 0
801 801
     ) {
802
-        $recorded = $this->addWarning($warning, $stackPtr, $code, $data, $severity, true);
803
-        if ($recorded === true && $this->fixer->enabled === true) {
802
+        $recorded = $this->addWarning( $warning, $stackPtr, $code, $data, $severity, true );
803
+        if ( $recorded === true && $this->fixer->enabled === true ) {
804 804
             return true;
805 805
         }
806 806
 
@@ -824,156 +824,156 @@  discard block
 block discarded – undo
824 824
      *
825 825
      * @return boolean
826 826
      */
827
-    protected function addMessage($error, $message, $line, $column, $code, $data, $severity, $fixable)
827
+    protected function addMessage( $error, $message, $line, $column, $code, $data, $severity, $fixable )
828 828
     {
829 829
         // Check if this line is ignoring all message codes.
830
-        if (isset($this->tokenizer->ignoredLines[$line]['.all']) === true) {
830
+        if ( isset( $this->tokenizer->ignoredLines[ $line ][ '.all' ] ) === true ) {
831 831
             return false;
832 832
         }
833 833
 
834 834
         // Work out which sniff generated the message.
835
-        $parts = explode('.', $code);
836
-        if ($parts[0] === 'Internal') {
835
+        $parts = explode( '.', $code );
836
+        if ( $parts[ 0 ] === 'Internal' ) {
837 837
             // An internal message.
838
-            $listenerCode = Util\Common::getSniffCode($this->activeListener);
838
+            $listenerCode = Util\Common::getSniffCode( $this->activeListener );
839 839
             $sniffCode    = $code;
840
-            $checkCodes   = [$sniffCode];
840
+            $checkCodes   = [ $sniffCode ];
841 841
         } else {
842
-            if ($parts[0] !== $code) {
842
+            if ( $parts[ 0 ] !== $code ) {
843 843
                 // The full message code has been passed in.
844 844
                 $sniffCode    = $code;
845
-                $listenerCode = substr($sniffCode, 0, strrpos($sniffCode, '.'));
845
+                $listenerCode = substr( $sniffCode, 0, strrpos( $sniffCode, '.' ) );
846 846
             } else {
847
-                $listenerCode = Util\Common::getSniffCode($this->activeListener);
848
-                $sniffCode    = $listenerCode.'.'.$code;
849
-                $parts        = explode('.', $sniffCode);
847
+                $listenerCode = Util\Common::getSniffCode( $this->activeListener );
848
+                $sniffCode    = $listenerCode . '.' . $code;
849
+                $parts        = explode( '.', $sniffCode );
850 850
             }
851 851
 
852 852
             $checkCodes = [
853 853
                 $sniffCode,
854
-                $parts[0].'.'.$parts[1].'.'.$parts[2],
855
-                $parts[0].'.'.$parts[1],
856
-                $parts[0],
854
+                $parts[ 0 ] . '.' . $parts[ 1 ] . '.' . $parts[ 2 ],
855
+                $parts[ 0 ] . '.' . $parts[ 1 ],
856
+                $parts[ 0 ],
857 857
             ];
858 858
         }//end if
859 859
 
860
-        if (isset($this->tokenizer->ignoredLines[$line]) === true) {
860
+        if ( isset( $this->tokenizer->ignoredLines[ $line ] ) === true ) {
861 861
             // Check if this line is ignoring this specific message.
862 862
             $ignored = false;
863
-            foreach ($checkCodes as $checkCode) {
864
-                if (isset($this->tokenizer->ignoredLines[$line][$checkCode]) === true) {
863
+            foreach ( $checkCodes as $checkCode ) {
864
+                if ( isset( $this->tokenizer->ignoredLines[ $line ][ $checkCode ] ) === true ) {
865 865
                     $ignored = true;
866 866
                     break;
867 867
                 }
868 868
             }
869 869
 
870 870
             // If it is ignored, make sure it's not whitelisted.
871
-            if ($ignored === true
872
-                && isset($this->tokenizer->ignoredLines[$line]['.except']) === true
871
+            if ( $ignored === true
872
+                && isset( $this->tokenizer->ignoredLines[ $line ][ '.except' ] ) === true
873 873
             ) {
874
-                foreach ($checkCodes as $checkCode) {
875
-                    if (isset($this->tokenizer->ignoredLines[$line]['.except'][$checkCode]) === true) {
874
+                foreach ( $checkCodes as $checkCode ) {
875
+                    if ( isset( $this->tokenizer->ignoredLines[ $line ][ '.except' ][ $checkCode ] ) === true ) {
876 876
                         $ignored = false;
877 877
                         break;
878 878
                     }
879 879
                 }
880 880
             }
881 881
 
882
-            if ($ignored === true) {
882
+            if ( $ignored === true ) {
883 883
                 return false;
884 884
             }
885 885
         }//end if
886 886
 
887 887
         $includeAll = true;
888
-        if ($this->configCache['cache'] === false
889
-            || $this->configCache['recordErrors'] === false
888
+        if ( $this->configCache[ 'cache' ] === false
889
+            || $this->configCache[ 'recordErrors' ] === false
890 890
         ) {
891 891
             $includeAll = false;
892 892
         }
893 893
 
894 894
         // Filter out any messages for sniffs that shouldn't have run
895 895
         // due to the use of the --sniffs command line argument.
896
-        if ($includeAll === false
897
-            && ((empty($this->configCache['sniffs']) === false
898
-            && in_array(strtolower($listenerCode), $this->configCache['sniffs'], true) === false)
899
-            || (empty($this->configCache['exclude']) === false
900
-            && in_array(strtolower($listenerCode), $this->configCache['exclude'], true) === true))
896
+        if ( $includeAll === false
897
+            && ( ( empty( $this->configCache[ 'sniffs' ] ) === false
898
+            && in_array( strtolower( $listenerCode ), $this->configCache[ 'sniffs' ], true ) === false )
899
+            || ( empty( $this->configCache[ 'exclude' ] ) === false
900
+            && in_array( strtolower( $listenerCode ), $this->configCache[ 'exclude' ], true ) === true ) )
901 901
         ) {
902 902
             return false;
903 903
         }
904 904
 
905 905
         // If we know this sniff code is being ignored for this file, return early.
906
-        foreach ($checkCodes as $checkCode) {
907
-            if (isset($this->ignoredCodes[$checkCode]) === true) {
906
+        foreach ( $checkCodes as $checkCode ) {
907
+            if ( isset( $this->ignoredCodes[ $checkCode ] ) === true ) {
908 908
                 return false;
909 909
             }
910 910
         }
911 911
 
912 912
         $oppositeType = 'warning';
913
-        if ($error === false) {
913
+        if ( $error === false ) {
914 914
             $oppositeType = 'error';
915 915
         }
916 916
 
917
-        foreach ($checkCodes as $checkCode) {
917
+        foreach ( $checkCodes as $checkCode ) {
918 918
             // Make sure this message type has not been set to the opposite message type.
919
-            if (isset($this->ruleset->ruleset[$checkCode]['type']) === true
920
-                && $this->ruleset->ruleset[$checkCode]['type'] === $oppositeType
919
+            if ( isset( $this->ruleset->ruleset[ $checkCode ][ 'type' ] ) === true
920
+                && $this->ruleset->ruleset[ $checkCode ][ 'type' ] === $oppositeType
921 921
             ) {
922
-                $error = !$error;
922
+                $error = ! $error;
923 923
                 break;
924 924
             }
925 925
         }
926 926
 
927
-        if ($error === true) {
928
-            $configSeverity = $this->configCache['errorSeverity'];
927
+        if ( $error === true ) {
928
+            $configSeverity = $this->configCache[ 'errorSeverity' ];
929 929
             $messageCount   = &$this->errorCount;
930 930
             $messages       = &$this->errors;
931 931
         } else {
932
-            $configSeverity = $this->configCache['warningSeverity'];
932
+            $configSeverity = $this->configCache[ 'warningSeverity' ];
933 933
             $messageCount   = &$this->warningCount;
934 934
             $messages       = &$this->warnings;
935 935
         }
936 936
 
937
-        if ($includeAll === false && $configSeverity === 0) {
937
+        if ( $includeAll === false && $configSeverity === 0 ) {
938 938
             // Don't bother doing any processing as these messages are just going to
939 939
             // be hidden in the reports anyway.
940 940
             return false;
941 941
         }
942 942
 
943
-        if ($severity === 0) {
943
+        if ( $severity === 0 ) {
944 944
             $severity = 5;
945 945
         }
946 946
 
947
-        foreach ($checkCodes as $checkCode) {
947
+        foreach ( $checkCodes as $checkCode ) {
948 948
             // Make sure we are interested in this severity level.
949
-            if (isset($this->ruleset->ruleset[$checkCode]['severity']) === true) {
950
-                $severity = $this->ruleset->ruleset[$checkCode]['severity'];
949
+            if ( isset( $this->ruleset->ruleset[ $checkCode ][ 'severity' ] ) === true ) {
950
+                $severity = $this->ruleset->ruleset[ $checkCode ][ 'severity' ];
951 951
                 break;
952 952
             }
953 953
         }
954 954
 
955
-        if ($includeAll === false && $configSeverity > $severity) {
955
+        if ( $includeAll === false && $configSeverity > $severity ) {
956 956
             return false;
957 957
         }
958 958
 
959 959
         // Make sure we are not ignoring this file.
960 960
         $included = null;
961
-        foreach ($checkCodes as $checkCode) {
961
+        foreach ( $checkCodes as $checkCode ) {
962 962
             $patterns = null;
963 963
 
964
-            if (isset($this->configCache['includePatterns'][$checkCode]) === true) {
965
-                $patterns  = $this->configCache['includePatterns'][$checkCode];
964
+            if ( isset( $this->configCache[ 'includePatterns' ][ $checkCode ] ) === true ) {
965
+                $patterns  = $this->configCache[ 'includePatterns' ][ $checkCode ];
966 966
                 $excluding = false;
967
-            } else if (isset($this->configCache['ignorePatterns'][$checkCode]) === true) {
968
-                $patterns  = $this->configCache['ignorePatterns'][$checkCode];
967
+            } else if ( isset( $this->configCache[ 'ignorePatterns' ][ $checkCode ] ) === true ) {
968
+                $patterns  = $this->configCache[ 'ignorePatterns' ][ $checkCode ];
969 969
                 $excluding = true;
970 970
             }
971 971
 
972
-            if ($patterns === null) {
972
+            if ( $patterns === null ) {
973 973
                 continue;
974 974
             }
975 975
 
976
-            foreach ($patterns as $pattern => $type) {
976
+            foreach ( $patterns as $pattern => $type ) {
977 977
                 // While there is support for a type of each pattern
978 978
                 // (absolute or relative) we don't actually support it here.
979 979
                 $replacements = [
@@ -984,15 +984,15 @@  discard block
 block discarded – undo
984 984
                 // We assume a / directory separator, as do the exclude rules
985 985
                 // most developers write, so we need a special case for any system
986 986
                 // that is different.
987
-                if (DIRECTORY_SEPARATOR === '\\') {
988
-                    $replacements['/'] = '\\\\';
987
+                if ( DIRECTORY_SEPARATOR === '\\' ) {
988
+                    $replacements[ '/' ] = '\\\\';
989 989
                 }
990 990
 
991
-                $pattern = '`'.strtr($pattern, $replacements).'`i';
992
-                $matched = preg_match($pattern, $this->path);
991
+                $pattern = '`' . strtr( $pattern, $replacements ) . '`i';
992
+                $matched = preg_match( $pattern, $this->path );
993 993
 
994
-                if ($matched === 0) {
995
-                    if ($excluding === false && $included === null) {
994
+                if ( $matched === 0 ) {
995
+                    if ( $excluding === false && $included === null ) {
996 996
                         // This file path is not being included.
997 997
                         $included = false;
998 998
                     }
@@ -1000,9 +1000,9 @@  discard block
 block discarded – undo
1000 1000
                     continue;
1001 1001
                 }
1002 1002
 
1003
-                if ($excluding === true) {
1003
+                if ( $excluding === true ) {
1004 1004
                     // This file path is being excluded.
1005
-                    $this->ignoredCodes[$checkCode] = true;
1005
+                    $this->ignoredCodes[ $checkCode ] = true;
1006 1006
                     return false;
1007 1007
                 }
1008 1008
 
@@ -1012,41 +1012,41 @@  discard block
 block discarded – undo
1012 1012
             }//end foreach
1013 1013
         }//end foreach
1014 1014
 
1015
-        if ($included === false) {
1015
+        if ( $included === false ) {
1016 1016
             // There were include rules set, but this file
1017 1017
             // path didn't match any of them.
1018 1018
             return false;
1019 1019
         }
1020 1020
 
1021 1021
         $messageCount++;
1022
-        if ($fixable === true) {
1022
+        if ( $fixable === true ) {
1023 1023
             $this->fixableCount++;
1024 1024
         }
1025 1025
 
1026
-        if ($this->configCache['recordErrors'] === false
1026
+        if ( $this->configCache[ 'recordErrors' ] === false
1027 1027
             && $includeAll === false
1028 1028
         ) {
1029 1029
             return true;
1030 1030
         }
1031 1031
 
1032 1032
         // Work out the error message.
1033
-        if (isset($this->ruleset->ruleset[$sniffCode]['message']) === true) {
1034
-            $message = $this->ruleset->ruleset[$sniffCode]['message'];
1033
+        if ( isset( $this->ruleset->ruleset[ $sniffCode ][ 'message' ] ) === true ) {
1034
+            $message = $this->ruleset->ruleset[ $sniffCode ][ 'message' ];
1035 1035
         }
1036 1036
 
1037
-        if (empty($data) === false) {
1038
-            $message = vsprintf($message, $data);
1037
+        if ( empty( $data ) === false ) {
1038
+            $message = vsprintf( $message, $data );
1039 1039
         }
1040 1040
 
1041
-        if (isset($messages[$line]) === false) {
1042
-            $messages[$line] = [];
1041
+        if ( isset( $messages[ $line ] ) === false ) {
1042
+            $messages[ $line ] = [ ];
1043 1043
         }
1044 1044
 
1045
-        if (isset($messages[$line][$column]) === false) {
1046
-            $messages[$line][$column] = [];
1045
+        if ( isset( $messages[ $line ][ $column ] ) === false ) {
1046
+            $messages[ $line ][ $column ] = [ ];
1047 1047
         }
1048 1048
 
1049
-        $messages[$line][$column][] = [
1049
+        $messages[ $line ][ $column ][ ] = [
1050 1050
             'message'  => $message,
1051 1051
             'source'   => $sniffCode,
1052 1052
             'listener' => $this->activeListener,
@@ -1054,12 +1054,12 @@  discard block
 block discarded – undo
1054 1054
             'fixable'  => $fixable,
1055 1055
         ];
1056 1056
 
1057
-        if (PHP_CODESNIFFER_VERBOSITY > 1
1057
+        if ( PHP_CODESNIFFER_VERBOSITY > 1
1058 1058
             && $this->fixer->enabled === true
1059 1059
             && $fixable === true
1060 1060
         ) {
1061 1061
             @ob_end_clean();
1062
-            echo "\tE: [Line $line] $message ($sniffCode)".PHP_EOL;
1062
+            echo "\tE: [Line $line] $message ($sniffCode)" . PHP_EOL;
1063 1063
             ob_start();
1064 1064
         }
1065 1065
 
@@ -1077,17 +1077,17 @@  discard block
 block discarded – undo
1077 1077
      *
1078 1078
      * @return boolean
1079 1079
      */
1080
-    public function recordMetric($stackPtr, $metric, $value)
1080
+    public function recordMetric( $stackPtr, $metric, $value )
1081 1081
     {
1082
-        if (isset($this->metrics[$metric]) === false) {
1083
-            $this->metrics[$metric] = ['values' => [$value => 1]];
1084
-            $this->metricTokens[$metric][$stackPtr] = true;
1085
-        } else if (isset($this->metricTokens[$metric][$stackPtr]) === false) {
1086
-            $this->metricTokens[$metric][$stackPtr] = true;
1087
-            if (isset($this->metrics[$metric]['values'][$value]) === false) {
1088
-                $this->metrics[$metric]['values'][$value] = 1;
1082
+        if ( isset( $this->metrics[ $metric ] ) === false ) {
1083
+            $this->metrics[ $metric ] = [ 'values' => [ $value => 1 ] ];
1084
+            $this->metricTokens[ $metric ][ $stackPtr ] = true;
1085
+        } else if ( isset( $this->metricTokens[ $metric ][ $stackPtr ] ) === false ) {
1086
+            $this->metricTokens[ $metric ][ $stackPtr ] = true;
1087
+            if ( isset( $this->metrics[ $metric ][ 'values' ][ $value ] ) === false ) {
1088
+                $this->metrics[ $metric ][ 'values' ][ $value ] = 1;
1089 1089
             } else {
1090
-                $this->metrics[$metric]['values'][$value]++;
1090
+                $this->metrics[ $metric ][ 'values' ][ $value ]++;
1091 1091
             }
1092 1092
         }
1093 1093
 
@@ -1216,34 +1216,34 @@  discard block
 block discarded – undo
1216 1216
      *                                                      T_FUNCTION, T_CLASS, T_ANON_CLASS,
1217 1217
      *                                                      T_CLOSURE, T_TRAIT, or T_INTERFACE.
1218 1218
      */
1219
-    public function getDeclarationName($stackPtr)
1219
+    public function getDeclarationName( $stackPtr )
1220 1220
     {
1221
-        $tokenCode = $this->tokens[$stackPtr]['code'];
1221
+        $tokenCode = $this->tokens[ $stackPtr ][ 'code' ];
1222 1222
 
1223
-        if ($tokenCode === T_ANON_CLASS || $tokenCode === T_CLOSURE) {
1223
+        if ( $tokenCode === T_ANON_CLASS || $tokenCode === T_CLOSURE ) {
1224 1224
             return null;
1225 1225
         }
1226 1226
 
1227
-        if ($tokenCode !== T_FUNCTION
1227
+        if ( $tokenCode !== T_FUNCTION
1228 1228
             && $tokenCode !== T_CLASS
1229 1229
             && $tokenCode !== T_INTERFACE
1230 1230
             && $tokenCode !== T_TRAIT
1231 1231
         ) {
1232
-            throw new RuntimeException('Token type "'.$this->tokens[$stackPtr]['type'].'" is not T_FUNCTION, T_CLASS, T_INTERFACE or T_TRAIT');
1232
+            throw new RuntimeException( 'Token type "' . $this->tokens[ $stackPtr ][ 'type' ] . '" is not T_FUNCTION, T_CLASS, T_INTERFACE or T_TRAIT' );
1233 1233
         }
1234 1234
 
1235
-        if ($tokenCode === T_FUNCTION
1236
-            && strtolower($this->tokens[$stackPtr]['content']) !== 'function'
1235
+        if ( $tokenCode === T_FUNCTION
1236
+            && strtolower( $this->tokens[ $stackPtr ][ 'content' ] ) !== 'function'
1237 1237
         ) {
1238 1238
             // This is a function declared without the "function" keyword.
1239 1239
             // So this token is the function name.
1240
-            return $this->tokens[$stackPtr]['content'];
1240
+            return $this->tokens[ $stackPtr ][ 'content' ];
1241 1241
         }
1242 1242
 
1243 1243
         $content = null;
1244
-        for ($i = $stackPtr; $i < $this->numTokens; $i++) {
1245
-            if ($this->tokens[$i]['code'] === T_STRING) {
1246
-                $content = $this->tokens[$i]['content'];
1244
+        for ( $i = $stackPtr; $i < $this->numTokens; $i++ ) {
1245
+            if ( $this->tokens[ $i ][ 'code' ] === T_STRING ) {
1246
+                $content = $this->tokens[ $i ][ 'content' ];
1247 1247
                 break;
1248 1248
             }
1249 1249
         }
@@ -1282,20 +1282,20 @@  discard block
 block discarded – undo
1282 1282
      * @throws \PHP_CodeSniffer\Exceptions\TokenizerException If the specified $stackPtr is not of
1283 1283
      *                                                        type T_FUNCTION or T_CLOSURE.
1284 1284
      */
1285
-    public function getMethodParameters($stackPtr)
1285
+    public function getMethodParameters( $stackPtr )
1286 1286
     {
1287
-        if ($this->tokens[$stackPtr]['code'] !== T_FUNCTION
1288
-            && $this->tokens[$stackPtr]['code'] !== T_CLOSURE
1287
+        if ( $this->tokens[ $stackPtr ][ 'code' ] !== T_FUNCTION
1288
+            && $this->tokens[ $stackPtr ][ 'code' ] !== T_CLOSURE
1289 1289
         ) {
1290
-            throw new TokenizerException('$stackPtr must be of type T_FUNCTION or T_CLOSURE');
1290
+            throw new TokenizerException( '$stackPtr must be of type T_FUNCTION or T_CLOSURE' );
1291 1291
         }
1292 1292
 
1293
-        $opener = $this->tokens[$stackPtr]['parenthesis_opener'];
1294
-        $closer = $this->tokens[$stackPtr]['parenthesis_closer'];
1293
+        $opener = $this->tokens[ $stackPtr ][ 'parenthesis_opener' ];
1294
+        $closer = $this->tokens[ $stackPtr ][ 'parenthesis_closer' ];
1295 1295
 
1296
-        $vars            = [];
1296
+        $vars            = [ ];
1297 1297
         $currVar         = null;
1298
-        $paramStart      = ($opener + 1);
1298
+        $paramStart      = ( $opener + 1 );
1299 1299
         $defaultStart    = null;
1300 1300
         $paramCount      = 0;
1301 1301
         $passByReference = false;
@@ -1304,28 +1304,28 @@  discard block
 block discarded – undo
1304 1304
         $typeHintToken   = false;
1305 1305
         $nullableType    = false;
1306 1306
 
1307
-        for ($i = $paramStart; $i <= $closer; $i++) {
1307
+        for ( $i = $paramStart; $i <= $closer; $i++ ) {
1308 1308
             // Check to see if this token has a parenthesis or bracket opener. If it does
1309 1309
             // it's likely to be an array which might have arguments in it. This
1310 1310
             // could cause problems in our parsing below, so lets just skip to the
1311 1311
             // end of it.
1312
-            if (isset($this->tokens[$i]['parenthesis_opener']) === true) {
1312
+            if ( isset( $this->tokens[ $i ][ 'parenthesis_opener' ] ) === true ) {
1313 1313
                 // Don't do this if it's the close parenthesis for the method.
1314
-                if ($i !== $this->tokens[$i]['parenthesis_closer']) {
1315
-                    $i = ($this->tokens[$i]['parenthesis_closer'] + 1);
1314
+                if ( $i !== $this->tokens[ $i ][ 'parenthesis_closer' ] ) {
1315
+                    $i = ( $this->tokens[ $i ][ 'parenthesis_closer' ] + 1 );
1316 1316
                 }
1317 1317
             }
1318 1318
 
1319
-            if (isset($this->tokens[$i]['bracket_opener']) === true) {
1319
+            if ( isset( $this->tokens[ $i ][ 'bracket_opener' ] ) === true ) {
1320 1320
                 // Don't do this if it's the close parenthesis for the method.
1321
-                if ($i !== $this->tokens[$i]['bracket_closer']) {
1322
-                    $i = ($this->tokens[$i]['bracket_closer'] + 1);
1321
+                if ( $i !== $this->tokens[ $i ][ 'bracket_closer' ] ) {
1322
+                    $i = ( $this->tokens[ $i ][ 'bracket_closer' ] + 1 );
1323 1323
                 }
1324 1324
             }
1325 1325
 
1326
-            switch ($this->tokens[$i]['code']) {
1326
+            switch ( $this->tokens[ $i ][ 'code' ] ) {
1327 1327
             case T_BITWISE_AND:
1328
-                if ($defaultStart === null) {
1328
+                if ( $defaultStart === null ) {
1329 1329
                     $passByReference = true;
1330 1330
                 }
1331 1331
                 break;
@@ -1336,99 +1336,99 @@  discard block
 block discarded – undo
1336 1336
                 $variableLength = true;
1337 1337
                 break;
1338 1338
             case T_CALLABLE:
1339
-                if ($typeHintToken === false) {
1339
+                if ( $typeHintToken === false ) {
1340 1340
                     $typeHintToken = $i;
1341 1341
                 }
1342 1342
 
1343
-                $typeHint .= $this->tokens[$i]['content'];
1343
+                $typeHint .= $this->tokens[ $i ][ 'content' ];
1344 1344
                 break;
1345 1345
             case T_SELF:
1346 1346
             case T_PARENT:
1347 1347
             case T_STATIC:
1348 1348
                 // Self and parent are valid, static invalid, but was probably intended as type hint.
1349
-                if (isset($defaultStart) === false) {
1350
-                    if ($typeHintToken === false) {
1349
+                if ( isset( $defaultStart ) === false ) {
1350
+                    if ( $typeHintToken === false ) {
1351 1351
                         $typeHintToken = $i;
1352 1352
                     }
1353 1353
 
1354
-                    $typeHint .= $this->tokens[$i]['content'];
1354
+                    $typeHint .= $this->tokens[ $i ][ 'content' ];
1355 1355
                 }
1356 1356
                 break;
1357 1357
             case T_STRING:
1358 1358
                 // This is a string, so it may be a type hint, but it could
1359 1359
                 // also be a constant used as a default value.
1360 1360
                 $prevComma = false;
1361
-                for ($t = $i; $t >= $opener; $t--) {
1362
-                    if ($this->tokens[$t]['code'] === T_COMMA) {
1361
+                for ( $t = $i; $t >= $opener; $t-- ) {
1362
+                    if ( $this->tokens[ $t ][ 'code' ] === T_COMMA ) {
1363 1363
                         $prevComma = $t;
1364 1364
                         break;
1365 1365
                     }
1366 1366
                 }
1367 1367
 
1368
-                if ($prevComma !== false) {
1368
+                if ( $prevComma !== false ) {
1369 1369
                     $nextEquals = false;
1370
-                    for ($t = $prevComma; $t < $i; $t++) {
1371
-                        if ($this->tokens[$t]['code'] === T_EQUAL) {
1370
+                    for ( $t = $prevComma; $t < $i; $t++ ) {
1371
+                        if ( $this->tokens[ $t ][ 'code' ] === T_EQUAL ) {
1372 1372
                             $nextEquals = $t;
1373 1373
                             break;
1374 1374
                         }
1375 1375
                     }
1376 1376
 
1377
-                    if ($nextEquals !== false) {
1377
+                    if ( $nextEquals !== false ) {
1378 1378
                         break;
1379 1379
                     }
1380 1380
                 }
1381 1381
 
1382
-                if ($defaultStart === null) {
1383
-                    if ($typeHintToken === false) {
1382
+                if ( $defaultStart === null ) {
1383
+                    if ( $typeHintToken === false ) {
1384 1384
                         $typeHintToken = $i;
1385 1385
                     }
1386 1386
 
1387
-                    $typeHint .= $this->tokens[$i]['content'];
1387
+                    $typeHint .= $this->tokens[ $i ][ 'content' ];
1388 1388
                 }
1389 1389
                 break;
1390 1390
             case T_NS_SEPARATOR:
1391 1391
                 // Part of a type hint or default value.
1392
-                if ($defaultStart === null) {
1393
-                    if ($typeHintToken === false) {
1392
+                if ( $defaultStart === null ) {
1393
+                    if ( $typeHintToken === false ) {
1394 1394
                         $typeHintToken = $i;
1395 1395
                     }
1396 1396
 
1397
-                    $typeHint .= $this->tokens[$i]['content'];
1397
+                    $typeHint .= $this->tokens[ $i ][ 'content' ];
1398 1398
                 }
1399 1399
                 break;
1400 1400
             case T_NULLABLE:
1401
-                if ($defaultStart === null) {
1401
+                if ( $defaultStart === null ) {
1402 1402
                     $nullableType = true;
1403
-                    $typeHint    .= $this->tokens[$i]['content'];
1403
+                    $typeHint    .= $this->tokens[ $i ][ 'content' ];
1404 1404
                 }
1405 1405
                 break;
1406 1406
             case T_CLOSE_PARENTHESIS:
1407 1407
             case T_COMMA:
1408 1408
                 // If it's null, then there must be no parameters for this
1409 1409
                 // method.
1410
-                if ($currVar === null) {
1410
+                if ( $currVar === null ) {
1411 1411
                     continue 2;
1412 1412
                 }
1413 1413
 
1414
-                $vars[$paramCount]            = [];
1415
-                $vars[$paramCount]['token']   = $currVar;
1416
-                $vars[$paramCount]['name']    = $this->tokens[$currVar]['content'];
1417
-                $vars[$paramCount]['content'] = trim($this->getTokensAsString($paramStart, ($i - $paramStart)));
1414
+                $vars[ $paramCount ]            = [ ];
1415
+                $vars[ $paramCount ][ 'token' ]   = $currVar;
1416
+                $vars[ $paramCount ][ 'name' ]    = $this->tokens[ $currVar ][ 'content' ];
1417
+                $vars[ $paramCount ][ 'content' ] = trim( $this->getTokensAsString( $paramStart, ( $i - $paramStart ) ) );
1418 1418
 
1419
-                if ($defaultStart !== null) {
1420
-                    $vars[$paramCount]['default'] = trim($this->getTokensAsString($defaultStart, ($i - $defaultStart)));
1419
+                if ( $defaultStart !== null ) {
1420
+                    $vars[ $paramCount ][ 'default' ] = trim( $this->getTokensAsString( $defaultStart, ( $i - $defaultStart ) ) );
1421 1421
                 }
1422 1422
 
1423
-                $vars[$paramCount]['pass_by_reference'] = $passByReference;
1424
-                $vars[$paramCount]['variable_length']   = $variableLength;
1425
-                $vars[$paramCount]['type_hint']         = $typeHint;
1426
-                $vars[$paramCount]['type_hint_token']   = $typeHintToken;
1427
-                $vars[$paramCount]['nullable_type']     = $nullableType;
1423
+                $vars[ $paramCount ][ 'pass_by_reference' ] = $passByReference;
1424
+                $vars[ $paramCount ][ 'variable_length' ]   = $variableLength;
1425
+                $vars[ $paramCount ][ 'type_hint' ]         = $typeHint;
1426
+                $vars[ $paramCount ][ 'type_hint_token' ]   = $typeHintToken;
1427
+                $vars[ $paramCount ][ 'nullable_type' ]     = $nullableType;
1428 1428
 
1429 1429
                 // Reset the vars, as we are about to process the next parameter.
1430 1430
                 $defaultStart    = null;
1431
-                $paramStart      = ($i + 1);
1431
+                $paramStart      = ( $i + 1 );
1432 1432
                 $passByReference = false;
1433 1433
                 $variableLength  = false;
1434 1434
                 $typeHint        = '';
@@ -1438,7 +1438,7 @@  discard block
 block discarded – undo
1438 1438
                 $paramCount++;
1439 1439
                 break;
1440 1440
             case T_EQUAL:
1441
-                $defaultStart = ($i + 1);
1441
+                $defaultStart = ( $i + 1 );
1442 1442
                 break;
1443 1443
             }//end switch
1444 1444
         }//end for
@@ -1474,15 +1474,15 @@  discard block
 block discarded – undo
1474 1474
      * @throws \PHP_CodeSniffer\Exceptions\TokenizerException If the specified position is not a
1475 1475
      *                                                        T_FUNCTION token.
1476 1476
      */
1477
-    public function getMethodProperties($stackPtr)
1477
+    public function getMethodProperties( $stackPtr )
1478 1478
     {
1479
-        if ($this->tokens[$stackPtr]['code'] !== T_FUNCTION
1480
-            && $this->tokens[$stackPtr]['code'] !== T_CLOSURE
1479
+        if ( $this->tokens[ $stackPtr ][ 'code' ] !== T_FUNCTION
1480
+            && $this->tokens[ $stackPtr ][ 'code' ] !== T_CLOSURE
1481 1481
         ) {
1482
-            throw new TokenizerException('$stackPtr must be of type T_FUNCTION or T_CLOSURE');
1482
+            throw new TokenizerException( '$stackPtr must be of type T_FUNCTION or T_CLOSURE' );
1483 1483
         }
1484 1484
 
1485
-        if ($this->tokens[$stackPtr]['code'] === T_FUNCTION) {
1485
+        if ( $this->tokens[ $stackPtr ][ 'code' ] === T_FUNCTION ) {
1486 1486
             $valid = [
1487 1487
                 T_PUBLIC      => T_PUBLIC,
1488 1488
                 T_PRIVATE     => T_PRIVATE,
@@ -1509,12 +1509,12 @@  discard block
 block discarded – undo
1509 1509
         $isFinal        = false;
1510 1510
         $isStatic       = false;
1511 1511
 
1512
-        for ($i = ($stackPtr - 1); $i > 0; $i--) {
1513
-            if (isset($valid[$this->tokens[$i]['code']]) === false) {
1512
+        for ( $i = ( $stackPtr - 1 ); $i > 0; $i-- ) {
1513
+            if ( isset( $valid[ $this->tokens[ $i ][ 'code' ] ] ) === false ) {
1514 1514
                 break;
1515 1515
             }
1516 1516
 
1517
-            switch ($this->tokens[$i]['code']) {
1517
+            switch ( $this->tokens[ $i ][ 'code' ] ) {
1518 1518
             case T_PUBLIC:
1519 1519
                 $scope          = 'public';
1520 1520
                 $scopeSpecified = true;
@@ -1544,10 +1544,10 @@  discard block
 block discarded – undo
1544 1544
         $nullableReturnType = false;
1545 1545
         $hasBody            = true;
1546 1546
 
1547
-        if (isset($this->tokens[$stackPtr]['parenthesis_closer']) === true) {
1547
+        if ( isset( $this->tokens[ $stackPtr ][ 'parenthesis_closer' ] ) === true ) {
1548 1548
             $scopeOpener = null;
1549
-            if (isset($this->tokens[$stackPtr]['scope_opener']) === true) {
1550
-                $scopeOpener = $this->tokens[$stackPtr]['scope_opener'];
1549
+            if ( isset( $this->tokens[ $stackPtr ][ 'scope_opener' ] ) === true ) {
1550
+                $scopeOpener = $this->tokens[ $stackPtr ][ 'scope_opener' ];
1551 1551
             }
1552 1552
 
1553 1553
             $valid = [
@@ -1558,33 +1558,33 @@  discard block
 block discarded – undo
1558 1558
                 T_NS_SEPARATOR => T_NS_SEPARATOR,
1559 1559
             ];
1560 1560
 
1561
-            for ($i = $this->tokens[$stackPtr]['parenthesis_closer']; $i < $this->numTokens; $i++) {
1562
-                if (($scopeOpener === null && $this->tokens[$i]['code'] === T_SEMICOLON)
1563
-                    || ($scopeOpener !== null && $i === $scopeOpener)
1561
+            for ( $i = $this->tokens[ $stackPtr ][ 'parenthesis_closer' ]; $i < $this->numTokens; $i++ ) {
1562
+                if ( ( $scopeOpener === null && $this->tokens[ $i ][ 'code' ] === T_SEMICOLON )
1563
+                    || ( $scopeOpener !== null && $i === $scopeOpener )
1564 1564
                 ) {
1565 1565
                     // End of function definition.
1566 1566
                     break;
1567 1567
                 }
1568 1568
 
1569
-                if ($this->tokens[$i]['code'] === T_NULLABLE) {
1569
+                if ( $this->tokens[ $i ][ 'code' ] === T_NULLABLE ) {
1570 1570
                     $nullableReturnType = true;
1571 1571
                 }
1572 1572
 
1573
-                if (isset($valid[$this->tokens[$i]['code']]) === true) {
1574
-                    if ($returnTypeToken === false) {
1573
+                if ( isset( $valid[ $this->tokens[ $i ][ 'code' ] ] ) === true ) {
1574
+                    if ( $returnTypeToken === false ) {
1575 1575
                         $returnTypeToken = $i;
1576 1576
                     }
1577 1577
 
1578
-                    $returnType .= $this->tokens[$i]['content'];
1578
+                    $returnType .= $this->tokens[ $i ][ 'content' ];
1579 1579
                 }
1580 1580
             }
1581 1581
 
1582
-            $end     = $this->findNext([T_OPEN_CURLY_BRACKET, T_SEMICOLON], $this->tokens[$stackPtr]['parenthesis_closer']);
1583
-            $hasBody = $this->tokens[$end]['code'] === T_OPEN_CURLY_BRACKET;
1582
+            $end     = $this->findNext( [ T_OPEN_CURLY_BRACKET, T_SEMICOLON ], $this->tokens[ $stackPtr ][ 'parenthesis_closer' ] );
1583
+            $hasBody = $this->tokens[ $end ][ 'code' ] === T_OPEN_CURLY_BRACKET;
1584 1584
         }//end if
1585 1585
 
1586
-        if ($returnType !== '' && $nullableReturnType === true) {
1587
-            $returnType = '?'.$returnType;
1586
+        if ( $returnType !== '' && $nullableReturnType === true ) {
1587
+            $returnType = '?' . $returnType;
1588 1588
         }
1589 1589
 
1590 1590
         return [
@@ -1624,47 +1624,47 @@  discard block
 block discarded – undo
1624 1624
      *                                                        T_VARIABLE token, or if the position is not
1625 1625
      *                                                        a class member variable.
1626 1626
      */
1627
-    public function getMemberProperties($stackPtr)
1627
+    public function getMemberProperties( $stackPtr )
1628 1628
     {
1629
-        if ($this->tokens[$stackPtr]['code'] !== T_VARIABLE) {
1630
-            throw new TokenizerException('$stackPtr must be of type T_VARIABLE');
1629
+        if ( $this->tokens[ $stackPtr ][ 'code' ] !== T_VARIABLE ) {
1630
+            throw new TokenizerException( '$stackPtr must be of type T_VARIABLE' );
1631 1631
         }
1632 1632
 
1633
-        $conditions = array_keys($this->tokens[$stackPtr]['conditions']);
1634
-        $ptr        = array_pop($conditions);
1635
-        if (isset($this->tokens[$ptr]) === false
1636
-            || ($this->tokens[$ptr]['code'] !== T_CLASS
1637
-            && $this->tokens[$ptr]['code'] !== T_ANON_CLASS
1638
-            && $this->tokens[$ptr]['code'] !== T_TRAIT)
1633
+        $conditions = array_keys( $this->tokens[ $stackPtr ][ 'conditions' ] );
1634
+        $ptr        = array_pop( $conditions );
1635
+        if ( isset( $this->tokens[ $ptr ] ) === false
1636
+            || ( $this->tokens[ $ptr ][ 'code' ] !== T_CLASS
1637
+            && $this->tokens[ $ptr ][ 'code' ] !== T_ANON_CLASS
1638
+            && $this->tokens[ $ptr ][ 'code' ] !== T_TRAIT )
1639 1639
         ) {
1640
-            if (isset($this->tokens[$ptr]) === true
1641
-                && $this->tokens[$ptr]['code'] === T_INTERFACE
1640
+            if ( isset( $this->tokens[ $ptr ] ) === true
1641
+                && $this->tokens[ $ptr ][ 'code' ] === T_INTERFACE
1642 1642
             ) {
1643 1643
                 // T_VARIABLEs in interfaces can actually be method arguments
1644 1644
                 // but they wont be seen as being inside the method because there
1645 1645
                 // are no scope openers and closers for abstract methods. If it is in
1646 1646
                 // parentheses, we can be pretty sure it is a method argument.
1647
-                if (isset($this->tokens[$stackPtr]['nested_parenthesis']) === false
1648
-                    || empty($this->tokens[$stackPtr]['nested_parenthesis']) === true
1647
+                if ( isset( $this->tokens[ $stackPtr ][ 'nested_parenthesis' ] ) === false
1648
+                    || empty( $this->tokens[ $stackPtr ][ 'nested_parenthesis' ] ) === true
1649 1649
                 ) {
1650 1650
                     $error = 'Possible parse error: interfaces may not include member vars';
1651
-                    $this->addWarning($error, $stackPtr, 'Internal.ParseError.InterfaceHasMemberVar');
1652
-                    return [];
1651
+                    $this->addWarning( $error, $stackPtr, 'Internal.ParseError.InterfaceHasMemberVar' );
1652
+                    return [ ];
1653 1653
                 }
1654 1654
             } else {
1655
-                throw new TokenizerException('$stackPtr is not a class member var');
1655
+                throw new TokenizerException( '$stackPtr is not a class member var' );
1656 1656
             }
1657 1657
         }
1658 1658
 
1659 1659
         // Make sure it's not a method parameter.
1660
-        if (empty($this->tokens[$stackPtr]['nested_parenthesis']) === false) {
1661
-            $parenthesis = array_keys($this->tokens[$stackPtr]['nested_parenthesis']);
1662
-            $deepestOpen = array_pop($parenthesis);
1663
-            if ($deepestOpen > $ptr
1664
-                && isset($this->tokens[$deepestOpen]['parenthesis_owner']) === true
1665
-                && $this->tokens[$this->tokens[$deepestOpen]['parenthesis_owner']]['code'] === T_FUNCTION
1660
+        if ( empty( $this->tokens[ $stackPtr ][ 'nested_parenthesis' ] ) === false ) {
1661
+            $parenthesis = array_keys( $this->tokens[ $stackPtr ][ 'nested_parenthesis' ] );
1662
+            $deepestOpen = array_pop( $parenthesis );
1663
+            if ( $deepestOpen > $ptr
1664
+                && isset( $this->tokens[ $deepestOpen ][ 'parenthesis_owner' ] ) === true
1665
+                && $this->tokens[ $this->tokens[ $deepestOpen ][ 'parenthesis_owner' ] ][ 'code' ] === T_FUNCTION
1666 1666
             ) {
1667
-                throw new TokenizerException('$stackPtr is not a class member var');
1667
+                throw new TokenizerException( '$stackPtr is not a class member var' );
1668 1668
             }
1669 1669
         }
1670 1670
 
@@ -1688,15 +1688,15 @@  discard block
 block discarded – undo
1688 1688
                 T_OPEN_CURLY_BRACKET,
1689 1689
                 T_CLOSE_CURLY_BRACKET,
1690 1690
             ],
1691
-            ($stackPtr - 1)
1691
+            ( $stackPtr - 1 )
1692 1692
         );
1693 1693
 
1694
-        for ($i = ($startOfStatement + 1); $i < $stackPtr; $i++) {
1695
-            if (isset($valid[$this->tokens[$i]['code']]) === false) {
1694
+        for ( $i = ( $startOfStatement + 1 ); $i < $stackPtr; $i++ ) {
1695
+            if ( isset( $valid[ $this->tokens[ $i ][ 'code' ] ] ) === false ) {
1696 1696
                 break;
1697 1697
             }
1698 1698
 
1699
-            switch ($this->tokens[$i]['code']) {
1699
+            switch ( $this->tokens[ $i ][ 'code' ] ) {
1700 1700
             case T_PUBLIC:
1701 1701
                 $scope          = 'public';
1702 1702
                 $scopeSpecified = true;
@@ -1742,10 +1742,10 @@  discard block
 block discarded – undo
1742 1742
      * @throws \PHP_CodeSniffer\Exceptions\TokenizerException If the specified position is not a
1743 1743
      *                                                        T_CLASS token.
1744 1744
      */
1745
-    public function getClassProperties($stackPtr)
1745
+    public function getClassProperties( $stackPtr )
1746 1746
     {
1747
-        if ($this->tokens[$stackPtr]['code'] !== T_CLASS) {
1748
-            throw new TokenizerException('$stackPtr must be of type T_CLASS');
1747
+        if ( $this->tokens[ $stackPtr ][ 'code' ] !== T_CLASS ) {
1748
+            throw new TokenizerException( '$stackPtr must be of type T_CLASS' );
1749 1749
         }
1750 1750
 
1751 1751
         $valid = [
@@ -1759,12 +1759,12 @@  discard block
 block discarded – undo
1759 1759
         $isAbstract = false;
1760 1760
         $isFinal    = false;
1761 1761
 
1762
-        for ($i = ($stackPtr - 1); $i > 0; $i--) {
1763
-            if (isset($valid[$this->tokens[$i]['code']]) === false) {
1762
+        for ( $i = ( $stackPtr - 1 ); $i > 0; $i-- ) {
1763
+            if ( isset( $valid[ $this->tokens[ $i ][ 'code' ] ] ) === false ) {
1764 1764
                 break;
1765 1765
             }
1766 1766
 
1767
-            switch ($this->tokens[$i]['code']) {
1767
+            switch ( $this->tokens[ $i ][ 'code' ] ) {
1768 1768
             case T_ABSTRACT:
1769 1769
                 $isAbstract = true;
1770 1770
                 break;
@@ -1793,35 +1793,35 @@  discard block
 block discarded – undo
1793 1793
      *
1794 1794
      * @return boolean
1795 1795
      */
1796
-    public function isReference($stackPtr)
1796
+    public function isReference( $stackPtr )
1797 1797
     {
1798
-        if ($this->tokens[$stackPtr]['code'] !== T_BITWISE_AND) {
1798
+        if ( $this->tokens[ $stackPtr ][ 'code' ] !== T_BITWISE_AND ) {
1799 1799
             return false;
1800 1800
         }
1801 1801
 
1802 1802
         $tokenBefore = $this->findPrevious(
1803 1803
             Util\Tokens::$emptyTokens,
1804
-            ($stackPtr - 1),
1804
+            ( $stackPtr - 1 ),
1805 1805
             null,
1806 1806
             true
1807 1807
         );
1808 1808
 
1809
-        if ($this->tokens[$tokenBefore]['code'] === T_FUNCTION) {
1809
+        if ( $this->tokens[ $tokenBefore ][ 'code' ] === T_FUNCTION ) {
1810 1810
             // Function returns a reference.
1811 1811
             return true;
1812 1812
         }
1813 1813
 
1814
-        if ($this->tokens[$tokenBefore]['code'] === T_DOUBLE_ARROW) {
1814
+        if ( $this->tokens[ $tokenBefore ][ 'code' ] === T_DOUBLE_ARROW ) {
1815 1815
             // Inside a foreach loop or array assignment, this is a reference.
1816 1816
             return true;
1817 1817
         }
1818 1818
 
1819
-        if ($this->tokens[$tokenBefore]['code'] === T_AS) {
1819
+        if ( $this->tokens[ $tokenBefore ][ 'code' ] === T_AS ) {
1820 1820
             // Inside a foreach loop, this is a reference.
1821 1821
             return true;
1822 1822
         }
1823 1823
 
1824
-        if (isset(Util\Tokens::$assignmentTokens[$this->tokens[$tokenBefore]['code']]) === true) {
1824
+        if ( isset( Util\Tokens::$assignmentTokens[ $this->tokens[ $tokenBefore ][ 'code' ] ] ) === true ) {
1825 1825
             // This is directly after an assignment. It's a reference. Even if
1826 1826
             // it is part of an operation, the other tests will handle it.
1827 1827
             return true;
@@ -1829,37 +1829,37 @@  discard block
 block discarded – undo
1829 1829
 
1830 1830
         $tokenAfter = $this->findNext(
1831 1831
             Util\Tokens::$emptyTokens,
1832
-            ($stackPtr + 1),
1832
+            ( $stackPtr + 1 ),
1833 1833
             null,
1834 1834
             true
1835 1835
         );
1836 1836
 
1837
-        if ($this->tokens[$tokenAfter]['code'] === T_NEW) {
1837
+        if ( $this->tokens[ $tokenAfter ][ 'code' ] === T_NEW ) {
1838 1838
             return true;
1839 1839
         }
1840 1840
 
1841
-        if (isset($this->tokens[$stackPtr]['nested_parenthesis']) === true) {
1842
-            $brackets    = $this->tokens[$stackPtr]['nested_parenthesis'];
1843
-            $lastBracket = array_pop($brackets);
1844
-            if (isset($this->tokens[$lastBracket]['parenthesis_owner']) === true) {
1845
-                $owner = $this->tokens[$this->tokens[$lastBracket]['parenthesis_owner']];
1846
-                if ($owner['code'] === T_FUNCTION
1847
-                    || $owner['code'] === T_CLOSURE
1841
+        if ( isset( $this->tokens[ $stackPtr ][ 'nested_parenthesis' ] ) === true ) {
1842
+            $brackets    = $this->tokens[ $stackPtr ][ 'nested_parenthesis' ];
1843
+            $lastBracket = array_pop( $brackets );
1844
+            if ( isset( $this->tokens[ $lastBracket ][ 'parenthesis_owner' ] ) === true ) {
1845
+                $owner = $this->tokens[ $this->tokens[ $lastBracket ][ 'parenthesis_owner' ] ];
1846
+                if ( $owner[ 'code' ] === T_FUNCTION
1847
+                    || $owner[ 'code' ] === T_CLOSURE
1848 1848
                 ) {
1849
-                    $params = $this->getMethodParameters($this->tokens[$lastBracket]['parenthesis_owner']);
1850
-                    foreach ($params as $param) {
1849
+                    $params = $this->getMethodParameters( $this->tokens[ $lastBracket ][ 'parenthesis_owner' ] );
1850
+                    foreach ( $params as $param ) {
1851 1851
                         $varToken = $tokenAfter;
1852
-                        if ($param['variable_length'] === true) {
1852
+                        if ( $param[ 'variable_length' ] === true ) {
1853 1853
                             $varToken = $this->findNext(
1854
-                                (Util\Tokens::$emptyTokens + [T_ELLIPSIS]),
1855
-                                ($stackPtr + 1),
1854
+                                ( Util\Tokens::$emptyTokens + [ T_ELLIPSIS ] ),
1855
+                                ( $stackPtr + 1 ),
1856 1856
                                 null,
1857 1857
                                 true
1858 1858
                             );
1859 1859
                         }
1860 1860
 
1861
-                        if ($param['token'] === $varToken
1862
-                            && $param['pass_by_reference'] === true
1861
+                        if ( $param[ 'token' ] === $varToken
1862
+                            && $param[ 'pass_by_reference' ] === true
1863 1863
                         ) {
1864 1864
                             // Function parameter declared to be passed by reference.
1865 1865
                             return true;
@@ -1868,14 +1868,14 @@  discard block
 block discarded – undo
1868 1868
                 }//end if
1869 1869
             } else {
1870 1870
                 $prev = false;
1871
-                for ($t = ($this->tokens[$lastBracket]['parenthesis_opener'] - 1); $t >= 0; $t--) {
1872
-                    if ($this->tokens[$t]['code'] !== T_WHITESPACE) {
1871
+                for ( $t = ( $this->tokens[ $lastBracket ][ 'parenthesis_opener' ] - 1 ); $t >= 0; $t-- ) {
1872
+                    if ( $this->tokens[ $t ][ 'code' ] !== T_WHITESPACE ) {
1873 1873
                         $prev = $t;
1874 1874
                         break;
1875 1875
                     }
1876 1876
                 }
1877 1877
 
1878
-                if ($prev !== false && $this->tokens[$prev]['code'] === T_USE) {
1878
+                if ( $prev !== false && $this->tokens[ $prev ][ 'code' ] === T_USE ) {
1879 1879
                     // Closure use by reference.
1880 1880
                     return true;
1881 1881
                 }
@@ -1883,29 +1883,29 @@  discard block
 block discarded – undo
1883 1883
         }//end if
1884 1884
 
1885 1885
         // Pass by reference in function calls and assign by reference in arrays.
1886
-        if ($this->tokens[$tokenBefore]['code'] === T_OPEN_PARENTHESIS
1887
-            || $this->tokens[$tokenBefore]['code'] === T_COMMA
1888
-            || $this->tokens[$tokenBefore]['code'] === T_OPEN_SHORT_ARRAY
1886
+        if ( $this->tokens[ $tokenBefore ][ 'code' ] === T_OPEN_PARENTHESIS
1887
+            || $this->tokens[ $tokenBefore ][ 'code' ] === T_COMMA
1888
+            || $this->tokens[ $tokenBefore ][ 'code' ] === T_OPEN_SHORT_ARRAY
1889 1889
         ) {
1890
-            if ($this->tokens[$tokenAfter]['code'] === T_VARIABLE) {
1890
+            if ( $this->tokens[ $tokenAfter ][ 'code' ] === T_VARIABLE ) {
1891 1891
                 return true;
1892 1892
             } else {
1893 1893
                 $skip   = Util\Tokens::$emptyTokens;
1894
-                $skip[] = T_NS_SEPARATOR;
1895
-                $skip[] = T_SELF;
1896
-                $skip[] = T_PARENT;
1897
-                $skip[] = T_STATIC;
1898
-                $skip[] = T_STRING;
1899
-                $skip[] = T_NAMESPACE;
1900
-                $skip[] = T_DOUBLE_COLON;
1894
+                $skip[ ] = T_NS_SEPARATOR;
1895
+                $skip[ ] = T_SELF;
1896
+                $skip[ ] = T_PARENT;
1897
+                $skip[ ] = T_STATIC;
1898
+                $skip[ ] = T_STRING;
1899
+                $skip[ ] = T_NAMESPACE;
1900
+                $skip[ ] = T_DOUBLE_COLON;
1901 1901
 
1902 1902
                 $nextSignificantAfter = $this->findNext(
1903 1903
                     $skip,
1904
-                    ($stackPtr + 1),
1904
+                    ( $stackPtr + 1 ),
1905 1905
                     null,
1906 1906
                     true
1907 1907
                 );
1908
-                if ($this->tokens[$nextSignificantAfter]['code'] === T_VARIABLE) {
1908
+                if ( $this->tokens[ $nextSignificantAfter ][ 'code' ] === T_VARIABLE ) {
1909 1909
                     return true;
1910 1910
                 }
1911 1911
             }//end if
@@ -1927,29 +1927,29 @@  discard block
 block discarded – undo
1927 1927
      *
1928 1928
      * @return string The token contents.
1929 1929
      */
1930
-    public function getTokensAsString($start, $length, $origContent=false)
1930
+    public function getTokensAsString( $start, $length, $origContent = false )
1931 1931
     {
1932
-        if (is_int($start) === false || isset($this->tokens[$start]) === false) {
1933
-            throw new RuntimeException('The $start position for getTokensAsString() must exist in the token stack');
1932
+        if ( is_int( $start ) === false || isset( $this->tokens[ $start ] ) === false ) {
1933
+            throw new RuntimeException( 'The $start position for getTokensAsString() must exist in the token stack' );
1934 1934
         }
1935 1935
 
1936
-        if (is_int($length) === false || $length <= 0) {
1936
+        if ( is_int( $length ) === false || $length <= 0 ) {
1937 1937
             return '';
1938 1938
         }
1939 1939
 
1940 1940
         $str = '';
1941
-        $end = ($start + $length);
1942
-        if ($end > $this->numTokens) {
1941
+        $end = ( $start + $length );
1942
+        if ( $end > $this->numTokens ) {
1943 1943
             $end = $this->numTokens;
1944 1944
         }
1945 1945
 
1946
-        for ($i = $start; $i < $end; $i++) {
1946
+        for ( $i = $start; $i < $end; $i++ ) {
1947 1947
             // If tabs are being converted to spaces by the tokeniser, the
1948 1948
             // original content should be used instead of the converted content.
1949
-            if ($origContent === true && isset($this->tokens[$i]['orig_content']) === true) {
1950
-                $str .= $this->tokens[$i]['orig_content'];
1949
+            if ( $origContent === true && isset( $this->tokens[ $i ][ 'orig_content' ] ) === true ) {
1950
+                $str .= $this->tokens[ $i ][ 'orig_content' ];
1951 1951
             } else {
1952
-                $str .= $this->tokens[$i]['content'];
1952
+                $str .= $this->tokens[ $i ][ 'content' ];
1953 1953
             }
1954 1954
         }
1955 1955
 
@@ -1987,48 +1987,48 @@  discard block
 block discarded – undo
1987 1987
     public function findPrevious(
1988 1988
         $types,
1989 1989
         $start,
1990
-        $end=null,
1991
-        $exclude=false,
1992
-        $value=null,
1993
-        $local=false
1990
+        $end = null,
1991
+        $exclude = false,
1992
+        $value = null,
1993
+        $local = false
1994 1994
     ) {
1995
-        $types = (array) $types;
1995
+        $types = (array)$types;
1996 1996
 
1997
-        if ($end === null) {
1997
+        if ( $end === null ) {
1998 1998
             $end = 0;
1999 1999
         }
2000 2000
 
2001
-        for ($i = $start; $i >= $end; $i--) {
2002
-            $found = (bool) $exclude;
2003
-            foreach ($types as $type) {
2004
-                if ($this->tokens[$i]['code'] === $type) {
2005
-                    $found = !$exclude;
2001
+        for ( $i = $start; $i >= $end; $i-- ) {
2002
+            $found = (bool)$exclude;
2003
+            foreach ( $types as $type ) {
2004
+                if ( $this->tokens[ $i ][ 'code' ] === $type ) {
2005
+                    $found = ! $exclude;
2006 2006
                     break;
2007 2007
                 }
2008 2008
             }
2009 2009
 
2010
-            if ($found === true) {
2011
-                if ($value === null) {
2010
+            if ( $found === true ) {
2011
+                if ( $value === null ) {
2012 2012
                     return $i;
2013
-                } else if ($this->tokens[$i]['content'] === $value) {
2013
+                } else if ( $this->tokens[ $i ][ 'content' ] === $value ) {
2014 2014
                     return $i;
2015 2015
                 }
2016 2016
             }
2017 2017
 
2018
-            if ($local === true) {
2019
-                if (isset($this->tokens[$i]['scope_opener']) === true
2020
-                    && $i === $this->tokens[$i]['scope_closer']
2018
+            if ( $local === true ) {
2019
+                if ( isset( $this->tokens[ $i ][ 'scope_opener' ] ) === true
2020
+                    && $i === $this->tokens[ $i ][ 'scope_closer' ]
2021 2021
                 ) {
2022
-                    $i = $this->tokens[$i]['scope_opener'];
2023
-                } else if (isset($this->tokens[$i]['bracket_opener']) === true
2024
-                    && $i === $this->tokens[$i]['bracket_closer']
2022
+                    $i = $this->tokens[ $i ][ 'scope_opener' ];
2023
+                } else if ( isset( $this->tokens[ $i ][ 'bracket_opener' ] ) === true
2024
+                    && $i === $this->tokens[ $i ][ 'bracket_closer' ]
2025 2025
                 ) {
2026
-                    $i = $this->tokens[$i]['bracket_opener'];
2027
-                } else if (isset($this->tokens[$i]['parenthesis_opener']) === true
2028
-                    && $i === $this->tokens[$i]['parenthesis_closer']
2026
+                    $i = $this->tokens[ $i ][ 'bracket_opener' ];
2027
+                } else if ( isset( $this->tokens[ $i ][ 'parenthesis_opener' ] ) === true
2028
+                    && $i === $this->tokens[ $i ][ 'parenthesis_closer' ]
2029 2029
                 ) {
2030
-                    $i = $this->tokens[$i]['parenthesis_opener'];
2031
-                } else if ($this->tokens[$i]['code'] === T_SEMICOLON) {
2030
+                    $i = $this->tokens[ $i ][ 'parenthesis_opener' ];
2031
+                } else if ( $this->tokens[ $i ][ 'code' ] === T_SEMICOLON ) {
2032 2032
                     break;
2033 2033
                 }
2034 2034
             }
@@ -2068,35 +2068,35 @@  discard block
 block discarded – undo
2068 2068
     public function findNext(
2069 2069
         $types,
2070 2070
         $start,
2071
-        $end=null,
2072
-        $exclude=false,
2073
-        $value=null,
2074
-        $local=false
2071
+        $end = null,
2072
+        $exclude = false,
2073
+        $value = null,
2074
+        $local = false
2075 2075
     ) {
2076
-        $types = (array) $types;
2076
+        $types = (array)$types;
2077 2077
 
2078
-        if ($end === null || $end > $this->numTokens) {
2078
+        if ( $end === null || $end > $this->numTokens ) {
2079 2079
             $end = $this->numTokens;
2080 2080
         }
2081 2081
 
2082
-        for ($i = $start; $i < $end; $i++) {
2083
-            $found = (bool) $exclude;
2084
-            foreach ($types as $type) {
2085
-                if ($this->tokens[$i]['code'] === $type) {
2086
-                    $found = !$exclude;
2082
+        for ( $i = $start; $i < $end; $i++ ) {
2083
+            $found = (bool)$exclude;
2084
+            foreach ( $types as $type ) {
2085
+                if ( $this->tokens[ $i ][ 'code' ] === $type ) {
2086
+                    $found = ! $exclude;
2087 2087
                     break;
2088 2088
                 }
2089 2089
             }
2090 2090
 
2091
-            if ($found === true) {
2092
-                if ($value === null) {
2091
+            if ( $found === true ) {
2092
+                if ( $value === null ) {
2093 2093
                     return $i;
2094
-                } else if ($this->tokens[$i]['content'] === $value) {
2094
+                } else if ( $this->tokens[ $i ][ 'content' ] === $value ) {
2095 2095
                     return $i;
2096 2096
                 }
2097 2097
             }
2098 2098
 
2099
-            if ($local === true && $this->tokens[$i]['code'] === T_SEMICOLON) {
2099
+            if ( $local === true && $this->tokens[ $i ][ 'code' ] === T_SEMICOLON ) {
2100 2100
                 break;
2101 2101
             }
2102 2102
         }//end for
@@ -2114,52 +2114,52 @@  discard block
 block discarded – undo
2114 2114
      *
2115 2115
      * @return int
2116 2116
      */
2117
-    public function findStartOfStatement($start, $ignore=null)
2117
+    public function findStartOfStatement( $start, $ignore = null )
2118 2118
     {
2119 2119
         $endTokens = Util\Tokens::$blockOpeners;
2120 2120
 
2121
-        $endTokens[T_COLON]            = true;
2122
-        $endTokens[T_COMMA]            = true;
2123
-        $endTokens[T_DOUBLE_ARROW]     = true;
2124
-        $endTokens[T_SEMICOLON]        = true;
2125
-        $endTokens[T_OPEN_TAG]         = true;
2126
-        $endTokens[T_CLOSE_TAG]        = true;
2127
-        $endTokens[T_OPEN_SHORT_ARRAY] = true;
2128
-
2129
-        if ($ignore !== null) {
2130
-            $ignore = (array) $ignore;
2131
-            foreach ($ignore as $code) {
2132
-                unset($endTokens[$code]);
2121
+        $endTokens[ T_COLON ]            = true;
2122
+        $endTokens[ T_COMMA ]            = true;
2123
+        $endTokens[ T_DOUBLE_ARROW ]     = true;
2124
+        $endTokens[ T_SEMICOLON ]        = true;
2125
+        $endTokens[ T_OPEN_TAG ]         = true;
2126
+        $endTokens[ T_CLOSE_TAG ]        = true;
2127
+        $endTokens[ T_OPEN_SHORT_ARRAY ] = true;
2128
+
2129
+        if ( $ignore !== null ) {
2130
+            $ignore = (array)$ignore;
2131
+            foreach ( $ignore as $code ) {
2132
+                unset( $endTokens[ $code ] );
2133 2133
             }
2134 2134
         }
2135 2135
 
2136 2136
         $lastNotEmpty = $start;
2137 2137
 
2138
-        for ($i = $start; $i >= 0; $i--) {
2139
-            if (isset($endTokens[$this->tokens[$i]['code']]) === true) {
2138
+        for ( $i = $start; $i >= 0; $i-- ) {
2139
+            if ( isset( $endTokens[ $this->tokens[ $i ][ 'code' ] ] ) === true ) {
2140 2140
                 // Found the end of the previous statement.
2141 2141
                 return $lastNotEmpty;
2142 2142
             }
2143 2143
 
2144
-            if (isset($this->tokens[$i]['scope_opener']) === true
2145
-                && $i === $this->tokens[$i]['scope_closer']
2144
+            if ( isset( $this->tokens[ $i ][ 'scope_opener' ] ) === true
2145
+                && $i === $this->tokens[ $i ][ 'scope_closer' ]
2146 2146
             ) {
2147 2147
                 // Found the end of the previous scope block.
2148 2148
                 return $lastNotEmpty;
2149 2149
             }
2150 2150
 
2151 2151
             // Skip nested statements.
2152
-            if (isset($this->tokens[$i]['bracket_opener']) === true
2153
-                && $i === $this->tokens[$i]['bracket_closer']
2152
+            if ( isset( $this->tokens[ $i ][ 'bracket_opener' ] ) === true
2153
+                && $i === $this->tokens[ $i ][ 'bracket_closer' ]
2154 2154
             ) {
2155
-                $i = $this->tokens[$i]['bracket_opener'];
2156
-            } else if (isset($this->tokens[$i]['parenthesis_opener']) === true
2157
-                && $i === $this->tokens[$i]['parenthesis_closer']
2155
+                $i = $this->tokens[ $i ][ 'bracket_opener' ];
2156
+            } else if ( isset( $this->tokens[ $i ][ 'parenthesis_opener' ] ) === true
2157
+                && $i === $this->tokens[ $i ][ 'parenthesis_closer' ]
2158 2158
             ) {
2159
-                $i = $this->tokens[$i]['parenthesis_opener'];
2159
+                $i = $this->tokens[ $i ][ 'parenthesis_opener' ];
2160 2160
             }
2161 2161
 
2162
-            if (isset(Util\Tokens::$emptyTokens[$this->tokens[$i]['code']]) === false) {
2162
+            if ( isset( Util\Tokens::$emptyTokens[ $this->tokens[ $i ][ 'code' ] ] ) === false ) {
2163 2163
                 $lastNotEmpty = $i;
2164 2164
             }
2165 2165
         }//end for
@@ -2177,7 +2177,7 @@  discard block
 block discarded – undo
2177 2177
      *
2178 2178
      * @return int
2179 2179
      */
2180
-    public function findEndOfStatement($start, $ignore=null)
2180
+    public function findEndOfStatement( $start, $ignore = null )
2181 2181
     {
2182 2182
         $endTokens = [
2183 2183
             T_COLON                => true,
@@ -2192,24 +2192,24 @@  discard block
 block discarded – undo
2192 2192
             T_CLOSE_TAG            => true,
2193 2193
         ];
2194 2194
 
2195
-        if ($ignore !== null) {
2196
-            $ignore = (array) $ignore;
2197
-            foreach ($ignore as $code) {
2198
-                unset($endTokens[$code]);
2195
+        if ( $ignore !== null ) {
2196
+            $ignore = (array)$ignore;
2197
+            foreach ( $ignore as $code ) {
2198
+                unset( $endTokens[ $code ] );
2199 2199
             }
2200 2200
         }
2201 2201
 
2202 2202
         $lastNotEmpty = $start;
2203 2203
 
2204
-        for ($i = $start; $i < $this->numTokens; $i++) {
2205
-            if ($i !== $start && isset($endTokens[$this->tokens[$i]['code']]) === true) {
2204
+        for ( $i = $start; $i < $this->numTokens; $i++ ) {
2205
+            if ( $i !== $start && isset( $endTokens[ $this->tokens[ $i ][ 'code' ] ] ) === true ) {
2206 2206
                 // Found the end of the statement.
2207
-                if ($this->tokens[$i]['code'] === T_CLOSE_PARENTHESIS
2208
-                    || $this->tokens[$i]['code'] === T_CLOSE_SQUARE_BRACKET
2209
-                    || $this->tokens[$i]['code'] === T_CLOSE_CURLY_BRACKET
2210
-                    || $this->tokens[$i]['code'] === T_CLOSE_SHORT_ARRAY
2211
-                    || $this->tokens[$i]['code'] === T_OPEN_TAG
2212
-                    || $this->tokens[$i]['code'] === T_CLOSE_TAG
2207
+                if ( $this->tokens[ $i ][ 'code' ] === T_CLOSE_PARENTHESIS
2208
+                    || $this->tokens[ $i ][ 'code' ] === T_CLOSE_SQUARE_BRACKET
2209
+                    || $this->tokens[ $i ][ 'code' ] === T_CLOSE_CURLY_BRACKET
2210
+                    || $this->tokens[ $i ][ 'code' ] === T_CLOSE_SHORT_ARRAY
2211
+                    || $this->tokens[ $i ][ 'code' ] === T_OPEN_TAG
2212
+                    || $this->tokens[ $i ][ 'code' ] === T_CLOSE_TAG
2213 2213
                 ) {
2214 2214
                     return $lastNotEmpty;
2215 2215
                 }
@@ -2218,31 +2218,31 @@  discard block
 block discarded – undo
2218 2218
             }
2219 2219
 
2220 2220
             // Skip nested statements.
2221
-            if (isset($this->tokens[$i]['scope_closer']) === true
2222
-                && ($i === $this->tokens[$i]['scope_opener']
2223
-                || $i === $this->tokens[$i]['scope_condition'])
2221
+            if ( isset( $this->tokens[ $i ][ 'scope_closer' ] ) === true
2222
+                && ( $i === $this->tokens[ $i ][ 'scope_opener' ]
2223
+                || $i === $this->tokens[ $i ][ 'scope_condition' ] )
2224 2224
             ) {
2225
-                if ($i === $start && isset(Util\Tokens::$scopeOpeners[$this->tokens[$i]['code']]) === true) {
2226
-                    return $this->tokens[$i]['scope_closer'];
2225
+                if ( $i === $start && isset( Util\Tokens::$scopeOpeners[ $this->tokens[ $i ][ 'code' ] ] ) === true ) {
2226
+                    return $this->tokens[ $i ][ 'scope_closer' ];
2227 2227
                 }
2228 2228
 
2229
-                $i = $this->tokens[$i]['scope_closer'];
2230
-            } else if (isset($this->tokens[$i]['bracket_closer']) === true
2231
-                && $i === $this->tokens[$i]['bracket_opener']
2229
+                $i = $this->tokens[ $i ][ 'scope_closer' ];
2230
+            } else if ( isset( $this->tokens[ $i ][ 'bracket_closer' ] ) === true
2231
+                && $i === $this->tokens[ $i ][ 'bracket_opener' ]
2232 2232
             ) {
2233
-                $i = $this->tokens[$i]['bracket_closer'];
2234
-            } else if (isset($this->tokens[$i]['parenthesis_closer']) === true
2235
-                && $i === $this->tokens[$i]['parenthesis_opener']
2233
+                $i = $this->tokens[ $i ][ 'bracket_closer' ];
2234
+            } else if ( isset( $this->tokens[ $i ][ 'parenthesis_closer' ] ) === true
2235
+                && $i === $this->tokens[ $i ][ 'parenthesis_opener' ]
2236 2236
             ) {
2237
-                $i = $this->tokens[$i]['parenthesis_closer'];
2237
+                $i = $this->tokens[ $i ][ 'parenthesis_closer' ];
2238 2238
             }
2239 2239
 
2240
-            if (isset(Util\Tokens::$emptyTokens[$this->tokens[$i]['code']]) === false) {
2240
+            if ( isset( Util\Tokens::$emptyTokens[ $this->tokens[ $i ][ 'code' ] ] ) === false ) {
2241 2241
                 $lastNotEmpty = $i;
2242 2242
             }
2243 2243
         }//end for
2244 2244
 
2245
-        return ($this->numTokens - 1);
2245
+        return ( $this->numTokens - 1 );
2246 2246
 
2247 2247
     }//end findEndOfStatement()
2248 2248
 
@@ -2264,38 +2264,38 @@  discard block
 block discarded – undo
2264 2264
      *
2265 2265
      * @return int | bool
2266 2266
      */
2267
-    public function findFirstOnLine($types, $start, $exclude=false, $value=null)
2267
+    public function findFirstOnLine( $types, $start, $exclude = false, $value = null )
2268 2268
     {
2269
-        if (is_array($types) === false) {
2270
-            $types = [$types];
2269
+        if ( is_array( $types ) === false ) {
2270
+            $types = [ $types ];
2271 2271
         }
2272 2272
 
2273 2273
         $foundToken = false;
2274 2274
 
2275
-        for ($i = $start; $i >= 0; $i--) {
2276
-            if ($this->tokens[$i]['line'] < $this->tokens[$start]['line']) {
2275
+        for ( $i = $start; $i >= 0; $i-- ) {
2276
+            if ( $this->tokens[ $i ][ 'line' ] < $this->tokens[ $start ][ 'line' ] ) {
2277 2277
                 break;
2278 2278
             }
2279 2279
 
2280 2280
             $found = $exclude;
2281
-            foreach ($types as $type) {
2282
-                if ($exclude === false) {
2283
-                    if ($this->tokens[$i]['code'] === $type) {
2281
+            foreach ( $types as $type ) {
2282
+                if ( $exclude === false ) {
2283
+                    if ( $this->tokens[ $i ][ 'code' ] === $type ) {
2284 2284
                         $found = true;
2285 2285
                         break;
2286 2286
                     }
2287 2287
                 } else {
2288
-                    if ($this->tokens[$i]['code'] === $type) {
2288
+                    if ( $this->tokens[ $i ][ 'code' ] === $type ) {
2289 2289
                         $found = false;
2290 2290
                         break;
2291 2291
                     }
2292 2292
                 }
2293 2293
             }
2294 2294
 
2295
-            if ($found === true) {
2296
-                if ($value === null) {
2295
+            if ( $found === true ) {
2296
+                if ( $value === null ) {
2297 2297
                     $foundToken = $i;
2298
-                } else if ($this->tokens[$i]['content'] === $value) {
2298
+                } else if ( $this->tokens[ $i ][ 'content' ] === $value ) {
2299 2299
                     $foundToken = $i;
2300 2300
                 }
2301 2301
             }
@@ -2314,23 +2314,23 @@  discard block
 block discarded – undo
2314 2314
      *
2315 2315
      * @return boolean
2316 2316
      */
2317
-    public function hasCondition($stackPtr, $types)
2317
+    public function hasCondition( $stackPtr, $types )
2318 2318
     {
2319 2319
         // Check for the existence of the token.
2320
-        if (isset($this->tokens[$stackPtr]) === false) {
2320
+        if ( isset( $this->tokens[ $stackPtr ] ) === false ) {
2321 2321
             return false;
2322 2322
         }
2323 2323
 
2324 2324
         // Make sure the token has conditions.
2325
-        if (isset($this->tokens[$stackPtr]['conditions']) === false) {
2325
+        if ( isset( $this->tokens[ $stackPtr ][ 'conditions' ] ) === false ) {
2326 2326
             return false;
2327 2327
         }
2328 2328
 
2329
-        $types      = (array) $types;
2330
-        $conditions = $this->tokens[$stackPtr]['conditions'];
2329
+        $types      = (array)$types;
2330
+        $conditions = $this->tokens[ $stackPtr ][ 'conditions' ];
2331 2331
 
2332
-        foreach ($types as $type) {
2333
-            if (in_array($type, $conditions, true) === true) {
2332
+        foreach ( $types as $type ) {
2333
+            if ( in_array( $type, $conditions, true ) === true ) {
2334 2334
                 // We found a token with the required type.
2335 2335
                 return true;
2336 2336
             }
@@ -2351,21 +2351,21 @@  discard block
 block discarded – undo
2351 2351
      *
2352 2352
      * @return int
2353 2353
      */
2354
-    public function getCondition($stackPtr, $type)
2354
+    public function getCondition( $stackPtr, $type )
2355 2355
     {
2356 2356
         // Check for the existence of the token.
2357
-        if (isset($this->tokens[$stackPtr]) === false) {
2357
+        if ( isset( $this->tokens[ $stackPtr ] ) === false ) {
2358 2358
             return false;
2359 2359
         }
2360 2360
 
2361 2361
         // Make sure the token has conditions.
2362
-        if (isset($this->tokens[$stackPtr]['conditions']) === false) {
2362
+        if ( isset( $this->tokens[ $stackPtr ][ 'conditions' ] ) === false ) {
2363 2363
             return false;
2364 2364
         }
2365 2365
 
2366
-        $conditions = $this->tokens[$stackPtr]['conditions'];
2367
-        foreach ($conditions as $token => $condition) {
2368
-            if ($condition === $type) {
2366
+        $conditions = $this->tokens[ $stackPtr ][ 'conditions' ];
2367
+        foreach ( $conditions as $token => $condition ) {
2368
+            if ( $condition === $type ) {
2369 2369
                 return $token;
2370 2370
             }
2371 2371
         }
@@ -2385,27 +2385,27 @@  discard block
 block discarded – undo
2385 2385
      *
2386 2386
      * @return string|false
2387 2387
      */
2388
-    public function findExtendedClassName($stackPtr)
2388
+    public function findExtendedClassName( $stackPtr )
2389 2389
     {
2390 2390
         // Check for the existence of the token.
2391
-        if (isset($this->tokens[$stackPtr]) === false) {
2391
+        if ( isset( $this->tokens[ $stackPtr ] ) === false ) {
2392 2392
             return false;
2393 2393
         }
2394 2394
 
2395
-        if ($this->tokens[$stackPtr]['code'] !== T_CLASS
2396
-            && $this->tokens[$stackPtr]['code'] !== T_ANON_CLASS
2397
-            && $this->tokens[$stackPtr]['code'] !== T_INTERFACE
2395
+        if ( $this->tokens[ $stackPtr ][ 'code' ] !== T_CLASS
2396
+            && $this->tokens[ $stackPtr ][ 'code' ] !== T_ANON_CLASS
2397
+            && $this->tokens[ $stackPtr ][ 'code' ] !== T_INTERFACE
2398 2398
         ) {
2399 2399
             return false;
2400 2400
         }
2401 2401
 
2402
-        if (isset($this->tokens[$stackPtr]['scope_opener']) === false) {
2402
+        if ( isset( $this->tokens[ $stackPtr ][ 'scope_opener' ] ) === false ) {
2403 2403
             return false;
2404 2404
         }
2405 2405
 
2406
-        $classOpenerIndex = $this->tokens[$stackPtr]['scope_opener'];
2407
-        $extendsIndex     = $this->findNext(T_EXTENDS, $stackPtr, $classOpenerIndex);
2408
-        if (false === $extendsIndex) {
2406
+        $classOpenerIndex = $this->tokens[ $stackPtr ][ 'scope_opener' ];
2407
+        $extendsIndex     = $this->findNext( T_EXTENDS, $stackPtr, $classOpenerIndex );
2408
+        if ( false === $extendsIndex ) {
2409 2409
             return false;
2410 2410
         }
2411 2411
 
@@ -2415,11 +2415,11 @@  discard block
 block discarded – undo
2415 2415
             T_WHITESPACE,
2416 2416
         ];
2417 2417
 
2418
-        $end  = $this->findNext($find, ($extendsIndex + 1), ($classOpenerIndex + 1), true);
2419
-        $name = $this->getTokensAsString(($extendsIndex + 1), ($end - $extendsIndex - 1));
2420
-        $name = trim($name);
2418
+        $end  = $this->findNext( $find, ( $extendsIndex + 1 ), ( $classOpenerIndex + 1 ), true );
2419
+        $name = $this->getTokensAsString( ( $extendsIndex + 1 ), ( $end - $extendsIndex - 1 ) );
2420
+        $name = trim( $name );
2421 2421
 
2422
-        if ($name === '') {
2422
+        if ( $name === '' ) {
2423 2423
             return false;
2424 2424
         }
2425 2425
 
@@ -2437,26 +2437,26 @@  discard block
 block discarded – undo
2437 2437
      *
2438 2438
      * @return array|false
2439 2439
      */
2440
-    public function findImplementedInterfaceNames($stackPtr)
2440
+    public function findImplementedInterfaceNames( $stackPtr )
2441 2441
     {
2442 2442
         // Check for the existence of the token.
2443
-        if (isset($this->tokens[$stackPtr]) === false) {
2443
+        if ( isset( $this->tokens[ $stackPtr ] ) === false ) {
2444 2444
             return false;
2445 2445
         }
2446 2446
 
2447
-        if ($this->tokens[$stackPtr]['code'] !== T_CLASS
2448
-            && $this->tokens[$stackPtr]['code'] !== T_ANON_CLASS
2447
+        if ( $this->tokens[ $stackPtr ][ 'code' ] !== T_CLASS
2448
+            && $this->tokens[ $stackPtr ][ 'code' ] !== T_ANON_CLASS
2449 2449
         ) {
2450 2450
             return false;
2451 2451
         }
2452 2452
 
2453
-        if (isset($this->tokens[$stackPtr]['scope_closer']) === false) {
2453
+        if ( isset( $this->tokens[ $stackPtr ][ 'scope_closer' ] ) === false ) {
2454 2454
             return false;
2455 2455
         }
2456 2456
 
2457
-        $classOpenerIndex = $this->tokens[$stackPtr]['scope_opener'];
2458
-        $implementsIndex  = $this->findNext(T_IMPLEMENTS, $stackPtr, $classOpenerIndex);
2459
-        if ($implementsIndex === false) {
2457
+        $classOpenerIndex = $this->tokens[ $stackPtr ][ 'scope_opener' ];
2458
+        $implementsIndex  = $this->findNext( T_IMPLEMENTS, $stackPtr, $classOpenerIndex );
2459
+        if ( $implementsIndex === false ) {
2460 2460
             return false;
2461 2461
         }
2462 2462
 
@@ -2467,15 +2467,15 @@  discard block
 block discarded – undo
2467 2467
             T_COMMA,
2468 2468
         ];
2469 2469
 
2470
-        $end  = $this->findNext($find, ($implementsIndex + 1), ($classOpenerIndex + 1), true);
2471
-        $name = $this->getTokensAsString(($implementsIndex + 1), ($end - $implementsIndex - 1));
2472
-        $name = trim($name);
2470
+        $end  = $this->findNext( $find, ( $implementsIndex + 1 ), ( $classOpenerIndex + 1 ), true );
2471
+        $name = $this->getTokensAsString( ( $implementsIndex + 1 ), ( $end - $implementsIndex - 1 ) );
2472
+        $name = trim( $name );
2473 2473
 
2474
-        if ($name === '') {
2474
+        if ( $name === '' ) {
2475 2475
             return false;
2476 2476
         } else {
2477
-            $names = explode(',', $name);
2478
-            $names = array_map('trim', $names);
2477
+            $names = explode( ',', $name );
2478
+            $names = array_map( 'trim', $names );
2479 2479
             return $names;
2480 2480
         }
2481 2481
 
Please login to merge, or discard this patch.
vendor/squizlabs/php_codesniffer/src/Files/FileList.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
      *
26 26
      * @var array
27 27
      */
28
-    private $files = [];
28
+    private $files = [ ];
29 29
 
30 30
     /**
31 31
      * The number of files in the list.
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      *
54 54
      * @var array
55 55
      */
56
-    protected $ignorePatterns = [];
56
+    protected $ignorePatterns = [ ];
57 57
 
58 58
 
59 59
     /**
@@ -64,35 +64,35 @@  discard block
 block discarded – undo
64 64
      *
65 65
      * @return void
66 66
      */
67
-    public function __construct(Config $config, Ruleset $ruleset)
67
+    public function __construct( Config $config, Ruleset $ruleset )
68 68
     {
69 69
         $this->ruleset = $ruleset;
70 70
         $this->config  = $config;
71 71
 
72 72
         $paths = $config->files;
73
-        foreach ($paths as $path) {
74
-            $isPharFile = Util\Common::isPharFile($path);
75
-            if (is_dir($path) === true || $isPharFile === true) {
76
-                if ($isPharFile === true) {
77
-                    $path = 'phar://'.$path;
73
+        foreach ( $paths as $path ) {
74
+            $isPharFile = Util\Common::isPharFile( $path );
75
+            if ( is_dir( $path ) === true || $isPharFile === true ) {
76
+                if ( $isPharFile === true ) {
77
+                    $path = 'phar://' . $path;
78 78
                 }
79 79
 
80 80
                 $filterClass = $this->getFilterClass();
81 81
 
82
-                $di       = new \RecursiveDirectoryIterator($path, (\RecursiveDirectoryIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS));
83
-                $filter   = new $filterClass($di, $path, $config, $ruleset);
84
-                $iterator = new \RecursiveIteratorIterator($filter);
82
+                $di       = new \RecursiveDirectoryIterator( $path, ( \RecursiveDirectoryIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS ) );
83
+                $filter   = new $filterClass( $di, $path, $config, $ruleset );
84
+                $iterator = new \RecursiveIteratorIterator( $filter );
85 85
 
86
-                foreach ($iterator as $file) {
87
-                    $this->files[$file->getPathname()] = null;
86
+                foreach ( $iterator as $file ) {
87
+                    $this->files[ $file->getPathname() ] = null;
88 88
                     $this->numFiles++;
89 89
                 }
90 90
             } else {
91
-                $this->addFile($path);
91
+                $this->addFile( $path );
92 92
             }//end if
93 93
         }//end foreach
94 94
 
95
-        reset($this->files);
95
+        reset( $this->files );
96 96
 
97 97
     }//end __construct()
98 98
 
@@ -108,24 +108,24 @@  discard block
 block discarded – undo
108 108
      *
109 109
      * @return void
110 110
      */
111
-    public function addFile($path, $file=null)
111
+    public function addFile( $path, $file = null )
112 112
     {
113 113
         // No filtering is done for STDIN when the filename
114 114
         // has not been specified.
115
-        if ($path === 'STDIN') {
116
-            $this->files[$path] = $file;
115
+        if ( $path === 'STDIN' ) {
116
+            $this->files[ $path ] = $file;
117 117
             $this->numFiles++;
118 118
             return;
119 119
         }
120 120
 
121 121
         $filterClass = $this->getFilterClass();
122 122
 
123
-        $di       = new \RecursiveArrayIterator([$path]);
124
-        $filter   = new $filterClass($di, $path, $this->config, $this->ruleset);
125
-        $iterator = new \RecursiveIteratorIterator($filter);
123
+        $di       = new \RecursiveArrayIterator( [ $path ] );
124
+        $filter   = new $filterClass( $di, $path, $this->config, $this->ruleset );
125
+        $iterator = new \RecursiveIteratorIterator( $filter );
126 126
 
127
-        foreach ($iterator as $path) {
128
-            $this->files[$path] = $file;
127
+        foreach ( $iterator as $path ) {
128
+            $this->files[ $path ] = $file;
129 129
             $this->numFiles++;
130 130
         }
131 131
 
@@ -141,20 +141,20 @@  discard block
 block discarded – undo
141 141
     {
142 142
         $filterType = $this->config->filter;
143 143
 
144
-        if ($filterType === null) {
144
+        if ( $filterType === null ) {
145 145
             $filterClass = '\PHP_CodeSniffer\Filters\Filter';
146 146
         } else {
147
-            if (strpos($filterType, '.') !== false) {
147
+            if ( strpos( $filterType, '.' ) !== false ) {
148 148
                 // This is a path to a custom filter class.
149
-                $filename = realpath($filterType);
150
-                if ($filename === false) {
151
-                    $error = "ERROR: Custom filter \"$filterType\" not found".PHP_EOL;
152
-                    throw new DeepExitException($error, 3);
149
+                $filename = realpath( $filterType );
150
+                if ( $filename === false ) {
151
+                    $error = "ERROR: Custom filter \"$filterType\" not found" . PHP_EOL;
152
+                    throw new DeepExitException( $error, 3 );
153 153
                 }
154 154
 
155
-                $filterClass = Autoload::loadFile($filename);
155
+                $filterClass = Autoload::loadFile( $filename );
156 156
             } else {
157
-                $filterClass = '\PHP_CodeSniffer\Filters\\'.$filterType;
157
+                $filterClass = '\PHP_CodeSniffer\Filters\\' . $filterType;
158 158
             }
159 159
         }
160 160
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
      */
171 171
     public function rewind()
172 172
     {
173
-        reset($this->files);
173
+        reset( $this->files );
174 174
 
175 175
     }//end rewind()
176 176
 
@@ -182,12 +182,12 @@  discard block
 block discarded – undo
182 182
      */
183 183
     public function current()
184 184
     {
185
-        $path = key($this->files);
186
-        if ($this->files[$path] === null) {
187
-            $this->files[$path] = new LocalFile($path, $this->ruleset, $this->config);
185
+        $path = key( $this->files );
186
+        if ( $this->files[ $path ] === null ) {
187
+            $this->files[ $path ] = new LocalFile( $path, $this->ruleset, $this->config );
188 188
         }
189 189
 
190
-        return $this->files[$path];
190
+        return $this->files[ $path ];
191 191
 
192 192
     }//end current()
193 193
 
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
      */
200 200
     public function key()
201 201
     {
202
-        return key($this->files);
202
+        return key( $this->files );
203 203
 
204 204
     }//end key()
205 205
 
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
      */
212 212
     public function next()
213 213
     {
214
-        next($this->files);
214
+        next( $this->files );
215 215
 
216 216
     }//end next()
217 217
 
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
      */
224 224
     public function valid()
225 225
     {
226
-        if (current($this->files) === false) {
226
+        if ( current( $this->files ) === false ) {
227 227
             return false;
228 228
         }
229 229
 
Please login to merge, or discard this patch.
vendor/squizlabs/php_codesniffer/src/Files/LocalFile.php 1 patch
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -26,13 +26,13 @@  discard block
 block discarded – undo
26 26
      *
27 27
      * @return void
28 28
      */
29
-    public function __construct($path, Ruleset $ruleset, Config $config)
29
+    public function __construct( $path, Ruleset $ruleset, Config $config )
30 30
     {
31
-        $this->path = trim($path);
32
-        if (is_readable($this->path) === false) {
33
-            parent::__construct($this->path, $ruleset, $config);
31
+        $this->path = trim( $path );
32
+        if ( is_readable( $this->path ) === false ) {
33
+            parent::__construct( $this->path, $ruleset, $config );
34 34
             $error = 'Error opening file; file no longer exists or you do not have access to read the file';
35
-            $this->addMessage(true, $error, 1, 1, 'Internal.LocalFile', [], 5, false);
35
+            $this->addMessage( true, $error, 1, 1, 'Internal.LocalFile', [ ], 5, false );
36 36
             $this->ignored = true;
37 37
             return;
38 38
         }
@@ -40,15 +40,15 @@  discard block
 block discarded – undo
40 40
         // Before we go and spend time tokenizing this file, just check
41 41
         // to see if there is a tag up top to indicate that the whole
42 42
         // file should be ignored. It must be on one of the first two lines.
43
-        if ($config->annotations === true) {
44
-            $handle = fopen($this->path, 'r');
45
-            if ($handle !== false) {
46
-                $firstContent  = fgets($handle);
47
-                $firstContent .= fgets($handle);
48
-                fclose($handle);
49
-
50
-                if (strpos($firstContent, '@codingStandardsIgnoreFile') !== false
51
-                    || stripos($firstContent, 'phpcs:ignorefile') !== false
43
+        if ( $config->annotations === true ) {
44
+            $handle = fopen( $this->path, 'r' );
45
+            if ( $handle !== false ) {
46
+                $firstContent  = fgets( $handle );
47
+                $firstContent .= fgets( $handle );
48
+                fclose( $handle );
49
+
50
+                if ( strpos( $firstContent, '@codingStandardsIgnoreFile' ) !== false
51
+                    || stripos( $firstContent, 'phpcs:ignorefile' ) !== false
52 52
                 ) {
53 53
                     // We are ignoring the whole file.
54 54
                     $this->ignored = true;
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 
60 60
         $this->reloadContent();
61 61
 
62
-        parent::__construct($this->path, $ruleset, $config);
62
+        parent::__construct( $this->path, $ruleset, $config );
63 63
 
64 64
     }//end __construct()
65 65
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
      */
72 72
     public function reloadContent()
73 73
     {
74
-        $this->setContent(file_get_contents($this->path));
74
+        $this->setContent( file_get_contents( $this->path ) );
75 75
 
76 76
     }//end reloadContent()
77 77
 
@@ -83,45 +83,45 @@  discard block
 block discarded – undo
83 83
      */
84 84
     public function process()
85 85
     {
86
-        if ($this->ignored === true) {
86
+        if ( $this->ignored === true ) {
87 87
             return;
88 88
         }
89 89
 
90
-        if ($this->configCache['cache'] === false) {
90
+        if ( $this->configCache[ 'cache' ] === false ) {
91 91
             parent::process();
92 92
             return;
93 93
         }
94 94
 
95
-        $hash  = md5_file($this->path);
96
-        $cache = Cache::get($this->path);
97
-        if ($cache !== false && $cache['hash'] === $hash) {
95
+        $hash  = md5_file( $this->path );
96
+        $cache = Cache::get( $this->path );
97
+        if ( $cache !== false && $cache[ 'hash' ] === $hash ) {
98 98
             // We can't filter metrics, so just load all of them.
99
-            $this->metrics = $cache['metrics'];
99
+            $this->metrics = $cache[ 'metrics' ];
100 100
 
101
-            if ($this->configCache['recordErrors'] === true) {
101
+            if ( $this->configCache[ 'recordErrors' ] === true ) {
102 102
                 // Replay the cached errors and warnings to filter out the ones
103 103
                 // we don't need for this specific run.
104
-                $this->configCache['cache'] = false;
105
-                $this->replayErrors($cache['errors'], $cache['warnings']);
106
-                $this->configCache['cache'] = true;
104
+                $this->configCache[ 'cache' ] = false;
105
+                $this->replayErrors( $cache[ 'errors' ], $cache[ 'warnings' ] );
106
+                $this->configCache[ 'cache' ] = true;
107 107
             } else {
108
-                $this->errorCount   = $cache['errorCount'];
109
-                $this->warningCount = $cache['warningCount'];
110
-                $this->fixableCount = $cache['fixableCount'];
108
+                $this->errorCount   = $cache[ 'errorCount' ];
109
+                $this->warningCount = $cache[ 'warningCount' ];
110
+                $this->fixableCount = $cache[ 'fixableCount' ];
111 111
             }
112 112
 
113
-            if (PHP_CODESNIFFER_VERBOSITY > 0
114
-                || (PHP_CODESNIFFER_CBF === true && empty($this->config->files) === false)
113
+            if ( PHP_CODESNIFFER_VERBOSITY > 0
114
+                || ( PHP_CODESNIFFER_CBF === true && empty( $this->config->files ) === false )
115 115
             ) {
116 116
                 echo "[loaded from cache]... ";
117 117
             }
118 118
 
119
-            $this->numTokens = $cache['numTokens'];
119
+            $this->numTokens = $cache[ 'numTokens' ];
120 120
             $this->fromCache = true;
121 121
             return;
122 122
         }//end if
123 123
 
124
-        if (PHP_CODESNIFFER_VERBOSITY > 1) {
124
+        if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
125 125
             echo PHP_EOL;
126 126
         }
127 127
 
@@ -138,14 +138,14 @@  discard block
 block discarded – undo
138 138
             'numTokens'    => $this->numTokens,
139 139
         ];
140 140
 
141
-        Cache::set($this->path, $cache);
141
+        Cache::set( $this->path, $cache );
142 142
 
143 143
         // During caching, we don't filter out errors in any way, so
144 144
         // we need to do that manually now by replaying them.
145
-        if ($this->configCache['recordErrors'] === true) {
146
-            $this->configCache['cache'] = false;
147
-            $this->replayErrors($this->errors, $this->warnings);
148
-            $this->configCache['cache'] = true;
145
+        if ( $this->configCache[ 'recordErrors' ] === true ) {
146
+            $this->configCache[ 'cache' ] = false;
147
+            $this->replayErrors( $this->errors, $this->warnings );
148
+            $this->configCache[ 'cache' ] = true;
149 149
         }
150 150
 
151 151
     }//end process()
@@ -163,45 +163,45 @@  discard block
 block discarded – undo
163 163
      *
164 164
      * @return void
165 165
      */
166
-    private function replayErrors($errors, $warnings)
166
+    private function replayErrors( $errors, $warnings )
167 167
     {
168
-        $this->errors       = [];
169
-        $this->warnings     = [];
168
+        $this->errors       = [ ];
169
+        $this->warnings     = [ ];
170 170
         $this->errorCount   = 0;
171 171
         $this->warningCount = 0;
172 172
         $this->fixableCount = 0;
173 173
 
174
-        foreach ($errors as $line => $lineErrors) {
175
-            foreach ($lineErrors as $column => $colErrors) {
176
-                foreach ($colErrors as $error) {
177
-                    $this->activeListener = $error['listener'];
174
+        foreach ( $errors as $line => $lineErrors ) {
175
+            foreach ( $lineErrors as $column => $colErrors ) {
176
+                foreach ( $colErrors as $error ) {
177
+                    $this->activeListener = $error[ 'listener' ];
178 178
                     $this->addMessage(
179 179
                         true,
180
-                        $error['message'],
180
+                        $error[ 'message' ],
181 181
                         $line,
182 182
                         $column,
183
-                        $error['source'],
184
-                        [],
185
-                        $error['severity'],
186
-                        $error['fixable']
183
+                        $error[ 'source' ],
184
+                        [ ],
185
+                        $error[ 'severity' ],
186
+                        $error[ 'fixable' ]
187 187
                     );
188 188
                 }
189 189
             }
190 190
         }
191 191
 
192
-        foreach ($warnings as $line => $lineErrors) {
193
-            foreach ($lineErrors as $column => $colErrors) {
194
-                foreach ($colErrors as $error) {
195
-                    $this->activeListener = $error['listener'];
192
+        foreach ( $warnings as $line => $lineErrors ) {
193
+            foreach ( $lineErrors as $column => $colErrors ) {
194
+                foreach ( $colErrors as $error ) {
195
+                    $this->activeListener = $error[ 'listener' ];
196 196
                     $this->addMessage(
197 197
                         false,
198
-                        $error['message'],
198
+                        $error[ 'message' ],
199 199
                         $line,
200 200
                         $column,
201
-                        $error['source'],
202
-                        [],
203
-                        $error['severity'],
204
-                        $error['fixable']
201
+                        $error[ 'source' ],
202
+                        [ ],
203
+                        $error[ 'severity' ],
204
+                        $error[ 'fixable' ]
205 205
                     );
206 206
                 }
207 207
             }
Please login to merge, or discard this patch.
vendor/squizlabs/php_codesniffer/src/Files/DummyFile.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -30,31 +30,31 @@  discard block
 block discarded – undo
30 30
      *
31 31
      * @return void
32 32
      */
33
-    public function __construct($content, Ruleset $ruleset, Config $config)
33
+    public function __construct( $content, Ruleset $ruleset, Config $config )
34 34
     {
35
-        $this->setContent($content);
35
+        $this->setContent( $content );
36 36
 
37 37
         // See if a filename was defined in the content.
38 38
         // This is done by including: phpcs_input_file: [file path]
39 39
         // as the first line of content.
40 40
         $path = 'STDIN';
41
-        if ($content !== null) {
42
-            if (substr($content, 0, 17) === 'phpcs_input_file:') {
43
-                $eolPos   = strpos($content, $this->eolChar);
44
-                $filename = trim(substr($content, 17, ($eolPos - 17)));
45
-                $content  = substr($content, ($eolPos + strlen($this->eolChar)));
41
+        if ( $content !== null ) {
42
+            if ( substr( $content, 0, 17 ) === 'phpcs_input_file:' ) {
43
+                $eolPos   = strpos( $content, $this->eolChar );
44
+                $filename = trim( substr( $content, 17, ( $eolPos - 17 ) ) );
45
+                $content  = substr( $content, ( $eolPos + strlen( $this->eolChar ) ) );
46 46
                 $path     = $filename;
47 47
 
48
-                $this->setContent($content);
48
+                $this->setContent( $content );
49 49
             }
50 50
         }
51 51
 
52 52
         // The CLI arg overrides anything passed in the content.
53
-        if ($config->stdinPath !== null) {
53
+        if ( $config->stdinPath !== null ) {
54 54
             $path = $config->stdinPath;
55 55
         }
56 56
 
57
-        parent::__construct($path, $ruleset, $config);
57
+        parent::__construct( $path, $ruleset, $config );
58 58
 
59 59
     }//end __construct()
60 60
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
      *
70 70
      * @return void
71 71
      */
72
-    public function setErrorCounts($errorCount, $warningCount, $fixableCount, $fixedCount)
72
+    public function setErrorCounts( $errorCount, $warningCount, $fixableCount, $fixedCount )
73 73
     {
74 74
         $this->errorCount   = $errorCount;
75 75
         $this->warningCount = $warningCount;
Please login to merge, or discard this patch.
vendor/squizlabs/php_codesniffer/src/Ruleset.php 1 patch
Spacing   +505 added lines, -505 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      *
38 38
      * @var string[]
39 39
      */
40
-    public $paths = [];
40
+    public $paths = [ ];
41 41
 
42 42
     /**
43 43
      * A list of regular expressions used to ignore specific sniffs for files and folders.
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      *
49 49
      * @var array<string, string>
50 50
      */
51
-    public $ignorePatterns = [];
51
+    public $ignorePatterns = [ ];
52 52
 
53 53
     /**
54 54
      * A list of regular expressions used to include specific sniffs for files and folders.
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
      *
60 60
      * @var array<string, array<string, string>>
61 61
      */
62
-    public $includePatterns = [];
62
+    public $includePatterns = [ ];
63 63
 
64 64
     /**
65 65
      * An array of sniff objects that are being used to check files.
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
      *
70 70
      * @var array<string, \PHP_CodeSniffer\Sniffs\Sniff>
71 71
      */
72
-    public $sniffs = [];
72
+    public $sniffs = [ ];
73 73
 
74 74
     /**
75 75
      * A mapping of sniff codes to fully qualified class names.
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
      *
80 80
      * @var array<string, string>
81 81
      */
82
-    public $sniffCodes = [];
82
+    public $sniffCodes = [ ];
83 83
 
84 84
     /**
85 85
      * An array of token types and the sniffs that are listening for them.
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
      *
90 90
      * @var array<int, \PHP_CodeSniffer\Sniffs\Sniff>
91 91
      */
92
-    public $tokenListeners = [];
92
+    public $tokenListeners = [ ];
93 93
 
94 94
     /**
95 95
      * An array of rules from the ruleset.xml file.
@@ -99,14 +99,14 @@  discard block
 block discarded – undo
99 99
      *
100 100
      * @var array<string, mixed>
101 101
      */
102
-    public $ruleset = [];
102
+    public $ruleset = [ ];
103 103
 
104 104
     /**
105 105
      * The directories that the processed rulesets are in.
106 106
      *
107 107
      * @var string[]
108 108
      */
109
-    protected $rulesetDirs = [];
109
+    protected $rulesetDirs = [ ];
110 110
 
111 111
     /**
112 112
      * The config data for the run.
@@ -123,63 +123,63 @@  discard block
 block discarded – undo
123 123
      *
124 124
      * @return void
125 125
      */
126
-    public function __construct(Config $config)
126
+    public function __construct( Config $config )
127 127
     {
128 128
         // Ignore sniff restrictions if caching is on.
129
-        $restrictions = [];
130
-        $exclusions   = [];
131
-        if ($config->cache === false) {
129
+        $restrictions = [ ];
130
+        $exclusions   = [ ];
131
+        if ( $config->cache === false ) {
132 132
             $restrictions = $config->sniffs;
133 133
             $exclusions   = $config->exclude;
134 134
         }
135 135
 
136 136
         $this->config = $config;
137
-        $sniffs       = [];
138
-
139
-        $standardPaths = [];
140
-        foreach ($config->standards as $standard) {
141
-            $installed = Util\Standards::getInstalledStandardPath($standard);
142
-            if ($installed === null) {
143
-                $standard = Util\Common::realpath($standard);
144
-                if (is_dir($standard) === true
145
-                    && is_file(Util\Common::realpath($standard.DIRECTORY_SEPARATOR.'ruleset.xml')) === true
137
+        $sniffs       = [ ];
138
+
139
+        $standardPaths = [ ];
140
+        foreach ( $config->standards as $standard ) {
141
+            $installed = Util\Standards::getInstalledStandardPath( $standard );
142
+            if ( $installed === null ) {
143
+                $standard = Util\Common::realpath( $standard );
144
+                if ( is_dir( $standard ) === true
145
+                    && is_file( Util\Common::realpath( $standard . DIRECTORY_SEPARATOR . 'ruleset.xml' ) ) === true
146 146
                 ) {
147
-                    $standard = Util\Common::realpath($standard.DIRECTORY_SEPARATOR.'ruleset.xml');
147
+                    $standard = Util\Common::realpath( $standard . DIRECTORY_SEPARATOR . 'ruleset.xml' );
148 148
                 }
149 149
             } else {
150 150
                 $standard = $installed;
151 151
             }
152 152
 
153
-            $standardPaths[] = $standard;
153
+            $standardPaths[ ] = $standard;
154 154
         }
155 155
 
156
-        foreach ($standardPaths as $standard) {
157
-            $ruleset = @simplexml_load_string(file_get_contents($standard));
158
-            if ($ruleset !== false) {
159
-                $standardName = (string) $ruleset['name'];
160
-                if ($this->name !== '') {
156
+        foreach ( $standardPaths as $standard ) {
157
+            $ruleset = @simplexml_load_string( file_get_contents( $standard ) );
158
+            if ( $ruleset !== false ) {
159
+                $standardName = (string)$ruleset[ 'name' ];
160
+                if ( $this->name !== '' ) {
161 161
                     $this->name .= ', ';
162 162
                 }
163 163
 
164 164
                 $this->name .= $standardName;
165 165
 
166 166
                 // Allow autoloading of custom files inside this standard.
167
-                if (isset($ruleset['namespace']) === true) {
168
-                    $namespace = (string) $ruleset['namespace'];
167
+                if ( isset( $ruleset[ 'namespace' ] ) === true ) {
168
+                    $namespace = (string)$ruleset[ 'namespace' ];
169 169
                 } else {
170
-                    $namespace = basename(dirname($standard));
170
+                    $namespace = basename( dirname( $standard ) );
171 171
                 }
172 172
 
173
-                Autoload::addSearchPath(dirname($standard), $namespace);
173
+                Autoload::addSearchPath( dirname( $standard ), $namespace );
174 174
             }
175 175
 
176
-            if (defined('PHP_CODESNIFFER_IN_TESTS') === true && empty($restrictions) === false) {
176
+            if ( defined( 'PHP_CODESNIFFER_IN_TESTS' ) === true && empty( $restrictions ) === false ) {
177 177
                 // In unit tests, only register the sniffs that the test wants and not the entire standard.
178 178
                 try {
179
-                    foreach ($restrictions as $restriction) {
180
-                        $sniffs = array_merge($sniffs, $this->expandRulesetReference($restriction, dirname($standard)));
179
+                    foreach ( $restrictions as $restriction ) {
180
+                        $sniffs = array_merge( $sniffs, $this->expandRulesetReference( $restriction, dirname( $standard ) ) );
181 181
                     }
182
-                } catch (RuntimeException $e) {
182
+                } catch ( RuntimeException $e ) {
183 183
                     // Sniff reference could not be expanded, which probably means this
184 184
                     // is an installed standard. Let the unit test system take care of
185 185
                     // setting the correct sniff for testing.
@@ -189,40 +189,40 @@  discard block
 block discarded – undo
189 189
                 break;
190 190
             }
191 191
 
192
-            if (PHP_CODESNIFFER_VERBOSITY === 1) {
192
+            if ( PHP_CODESNIFFER_VERBOSITY === 1 ) {
193 193
                 echo "Registering sniffs in the $standardName standard... ";
194
-                if (count($config->standards) > 1 || PHP_CODESNIFFER_VERBOSITY > 2) {
194
+                if ( count( $config->standards ) > 1 || PHP_CODESNIFFER_VERBOSITY > 2 ) {
195 195
                     echo PHP_EOL;
196 196
                 }
197 197
             }
198 198
 
199
-            $sniffs = array_merge($sniffs, $this->processRuleset($standard));
199
+            $sniffs = array_merge( $sniffs, $this->processRuleset( $standard ) );
200 200
         }//end foreach
201 201
 
202
-        $sniffRestrictions = [];
203
-        foreach ($restrictions as $sniffCode) {
204
-            $parts     = explode('.', strtolower($sniffCode));
205
-            $sniffName = $parts[0].'\sniffs\\'.$parts[1].'\\'.$parts[2].'sniff';
206
-            $sniffRestrictions[$sniffName] = true;
202
+        $sniffRestrictions = [ ];
203
+        foreach ( $restrictions as $sniffCode ) {
204
+            $parts     = explode( '.', strtolower( $sniffCode ) );
205
+            $sniffName = $parts[ 0 ] . '\sniffs\\' . $parts[ 1 ] . '\\' . $parts[ 2 ] . 'sniff';
206
+            $sniffRestrictions[ $sniffName ] = true;
207 207
         }
208 208
 
209
-        $sniffExclusions = [];
210
-        foreach ($exclusions as $sniffCode) {
211
-            $parts     = explode('.', strtolower($sniffCode));
212
-            $sniffName = $parts[0].'\sniffs\\'.$parts[1].'\\'.$parts[2].'sniff';
213
-            $sniffExclusions[$sniffName] = true;
209
+        $sniffExclusions = [ ];
210
+        foreach ( $exclusions as $sniffCode ) {
211
+            $parts     = explode( '.', strtolower( $sniffCode ) );
212
+            $sniffName = $parts[ 0 ] . '\sniffs\\' . $parts[ 1 ] . '\\' . $parts[ 2 ] . 'sniff';
213
+            $sniffExclusions[ $sniffName ] = true;
214 214
         }
215 215
 
216
-        $this->registerSniffs($sniffs, $sniffRestrictions, $sniffExclusions);
216
+        $this->registerSniffs( $sniffs, $sniffRestrictions, $sniffExclusions );
217 217
         $this->populateTokenListeners();
218 218
 
219
-        $numSniffs = count($this->sniffs);
220
-        if (PHP_CODESNIFFER_VERBOSITY === 1) {
221
-            echo "DONE ($numSniffs sniffs registered)".PHP_EOL;
219
+        $numSniffs = count( $this->sniffs );
220
+        if ( PHP_CODESNIFFER_VERBOSITY === 1 ) {
221
+            echo "DONE ($numSniffs sniffs registered)" . PHP_EOL;
222 222
         }
223 223
 
224
-        if ($numSniffs === 0) {
225
-            throw new RuntimeException('No sniffs were registered');
224
+        if ( $numSniffs === 0 ) {
225
+            throw new RuntimeException( 'No sniffs were registered' );
226 226
         }
227 227
 
228 228
     }//end __construct()
@@ -235,58 +235,58 @@  discard block
 block discarded – undo
235 235
      */
236 236
     public function explain()
237 237
     {
238
-        $sniffs = array_keys($this->sniffCodes);
239
-        sort($sniffs);
238
+        $sniffs = array_keys( $this->sniffCodes );
239
+        sort( $sniffs );
240 240
 
241 241
         ob_start();
242 242
 
243 243
         $lastStandard = null;
244 244
         $lastCount    = '';
245
-        $sniffCount   = count($sniffs);
245
+        $sniffCount   = count( $sniffs );
246 246
 
247 247
         // Add a dummy entry to the end so we loop
248 248
         // one last time and clear the output buffer.
249
-        $sniffs[] = '';
249
+        $sniffs[ ] = '';
250 250
 
251
-        echo PHP_EOL."The $this->name standard contains $sniffCount sniffs".PHP_EOL;
251
+        echo PHP_EOL . "The $this->name standard contains $sniffCount sniffs" . PHP_EOL;
252 252
 
253 253
         ob_start();
254 254
 
255
-        foreach ($sniffs as $i => $sniff) {
256
-            if ($i === $sniffCount) {
255
+        foreach ( $sniffs as $i => $sniff ) {
256
+            if ( $i === $sniffCount ) {
257 257
                 $currentStandard = null;
258 258
             } else {
259
-                $currentStandard = substr($sniff, 0, strpos($sniff, '.'));
260
-                if ($lastStandard === null) {
259
+                $currentStandard = substr( $sniff, 0, strpos( $sniff, '.' ) );
260
+                if ( $lastStandard === null ) {
261 261
                     $lastStandard = $currentStandard;
262 262
                 }
263 263
             }
264 264
 
265
-            if ($currentStandard !== $lastStandard) {
265
+            if ( $currentStandard !== $lastStandard ) {
266 266
                 $sniffList = ob_get_contents();
267 267
                 ob_end_clean();
268 268
 
269
-                echo PHP_EOL.$lastStandard.' ('.$lastCount.' sniff';
270
-                if ($lastCount > 1) {
269
+                echo PHP_EOL . $lastStandard . ' (' . $lastCount . ' sniff';
270
+                if ( $lastCount > 1 ) {
271 271
                     echo 's';
272 272
                 }
273 273
 
274
-                echo ')'.PHP_EOL;
275
-                echo str_repeat('-', (strlen($lastStandard.$lastCount) + 10));
274
+                echo ')' . PHP_EOL;
275
+                echo str_repeat( '-', ( strlen( $lastStandard . $lastCount ) + 10 ) );
276 276
                 echo PHP_EOL;
277 277
                 echo $sniffList;
278 278
 
279 279
                 $lastStandard = $currentStandard;
280 280
                 $lastCount    = 0;
281 281
 
282
-                if ($currentStandard === null) {
282
+                if ( $currentStandard === null ) {
283 283
                     break;
284 284
                 }
285 285
 
286 286
                 ob_start();
287 287
             }//end if
288 288
 
289
-            echo '  '.$sniff.PHP_EOL;
289
+            echo '  ' . $sniff . PHP_EOL;
290 290
             $lastCount++;
291 291
         }//end foreach
292 292
 
@@ -306,292 +306,292 @@  discard block
 block discarded – undo
306 306
      * @return string[]
307 307
      * @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the ruleset path is invalid.
308 308
      */
309
-    public function processRuleset($rulesetPath, $depth=0)
309
+    public function processRuleset( $rulesetPath, $depth = 0 )
310 310
     {
311
-        $rulesetPath = Util\Common::realpath($rulesetPath);
312
-        if (PHP_CODESNIFFER_VERBOSITY > 1) {
313
-            echo str_repeat("\t", $depth);
314
-            echo 'Processing ruleset '.Util\Common::stripBasepath($rulesetPath, $this->config->basepath).PHP_EOL;
311
+        $rulesetPath = Util\Common::realpath( $rulesetPath );
312
+        if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
313
+            echo str_repeat( "\t", $depth );
314
+            echo 'Processing ruleset ' . Util\Common::stripBasepath( $rulesetPath, $this->config->basepath ) . PHP_EOL;
315 315
         }
316 316
 
317
-        libxml_use_internal_errors(true);
318
-        $ruleset = simplexml_load_string(file_get_contents($rulesetPath));
319
-        if ($ruleset === false) {
320
-            $errorMsg = "Ruleset $rulesetPath is not valid".PHP_EOL;
317
+        libxml_use_internal_errors( true );
318
+        $ruleset = simplexml_load_string( file_get_contents( $rulesetPath ) );
319
+        if ( $ruleset === false ) {
320
+            $errorMsg = "Ruleset $rulesetPath is not valid" . PHP_EOL;
321 321
             $errors   = libxml_get_errors();
322
-            foreach ($errors as $error) {
323
-                $errorMsg .= '- On line '.$error->line.', column '.$error->column.': '.$error->message;
322
+            foreach ( $errors as $error ) {
323
+                $errorMsg .= '- On line ' . $error->line . ', column ' . $error->column . ': ' . $error->message;
324 324
             }
325 325
 
326 326
             libxml_clear_errors();
327
-            throw new RuntimeException($errorMsg);
327
+            throw new RuntimeException( $errorMsg );
328 328
         }
329 329
 
330
-        libxml_use_internal_errors(false);
330
+        libxml_use_internal_errors( false );
331 331
 
332
-        $ownSniffs      = [];
333
-        $includedSniffs = [];
334
-        $excludedSniffs = [];
332
+        $ownSniffs      = [ ];
333
+        $includedSniffs = [ ];
334
+        $excludedSniffs = [ ];
335 335
 
336
-        $this->paths[]       = $rulesetPath;
337
-        $rulesetDir          = dirname($rulesetPath);
338
-        $this->rulesetDirs[] = $rulesetDir;
336
+        $this->paths[ ]       = $rulesetPath;
337
+        $rulesetDir          = dirname( $rulesetPath );
338
+        $this->rulesetDirs[ ] = $rulesetDir;
339 339
 
340
-        $sniffDir = $rulesetDir.DIRECTORY_SEPARATOR.'Sniffs';
341
-        if (is_dir($sniffDir) === true) {
342
-            if (PHP_CODESNIFFER_VERBOSITY > 1) {
343
-                echo str_repeat("\t", $depth);
344
-                echo "\tAdding sniff files from ".Util\Common::stripBasepath($sniffDir, $this->config->basepath).' directory'.PHP_EOL;
340
+        $sniffDir = $rulesetDir . DIRECTORY_SEPARATOR . 'Sniffs';
341
+        if ( is_dir( $sniffDir ) === true ) {
342
+            if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
343
+                echo str_repeat( "\t", $depth );
344
+                echo "\tAdding sniff files from " . Util\Common::stripBasepath( $sniffDir, $this->config->basepath ) . ' directory' . PHP_EOL;
345 345
             }
346 346
 
347
-            $ownSniffs = $this->expandSniffDirectory($sniffDir, $depth);
347
+            $ownSniffs = $this->expandSniffDirectory( $sniffDir, $depth );
348 348
         }
349 349
 
350 350
         // Included custom autoloaders.
351
-        foreach ($ruleset->{'autoload'} as $autoload) {
352
-            if ($this->shouldProcessElement($autoload) === false) {
351
+        foreach ( $ruleset->{'autoload'} as $autoload ) {
352
+            if ( $this->shouldProcessElement( $autoload ) === false ) {
353 353
                 continue;
354 354
             }
355 355
 
356
-            $autoloadPath = (string) $autoload;
357
-            if (is_file($autoloadPath) === false) {
358
-                $autoloadPath = Util\Common::realPath(dirname($rulesetPath).DIRECTORY_SEPARATOR.$autoloadPath);
356
+            $autoloadPath = (string)$autoload;
357
+            if ( is_file( $autoloadPath ) === false ) {
358
+                $autoloadPath = Util\Common::realPath( dirname( $rulesetPath ) . DIRECTORY_SEPARATOR . $autoloadPath );
359 359
             }
360 360
 
361
-            if ($autoloadPath === false) {
362
-                throw new RuntimeException('The specified autoload file "'.$autoload.'" does not exist');
361
+            if ( $autoloadPath === false ) {
362
+                throw new RuntimeException( 'The specified autoload file "' . $autoload . '" does not exist' );
363 363
             }
364 364
 
365 365
             include_once $autoloadPath;
366 366
 
367
-            if (PHP_CODESNIFFER_VERBOSITY > 1) {
368
-                echo str_repeat("\t", $depth);
369
-                echo "\t=> included autoloader $autoloadPath".PHP_EOL;
367
+            if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
368
+                echo str_repeat( "\t", $depth );
369
+                echo "\t=> included autoloader $autoloadPath" . PHP_EOL;
370 370
             }
371 371
         }//end foreach
372 372
 
373 373
         // Process custom sniff config settings.
374
-        foreach ($ruleset->{'config'} as $config) {
375
-            if ($this->shouldProcessElement($config) === false) {
374
+        foreach ( $ruleset->{'config'} as $config ) {
375
+            if ( $this->shouldProcessElement( $config ) === false ) {
376 376
                 continue;
377 377
             }
378 378
 
379
-            Config::setConfigData((string) $config['name'], (string) $config['value'], true);
380
-            if (PHP_CODESNIFFER_VERBOSITY > 1) {
381
-                echo str_repeat("\t", $depth);
382
-                echo "\t=> set config value ".(string) $config['name'].': '.(string) $config['value'].PHP_EOL;
379
+            Config::setConfigData( (string)$config[ 'name' ], (string)$config[ 'value' ], true );
380
+            if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
381
+                echo str_repeat( "\t", $depth );
382
+                echo "\t=> set config value " . (string)$config[ 'name' ] . ': ' . (string)$config[ 'value' ] . PHP_EOL;
383 383
             }
384 384
         }
385 385
 
386
-        foreach ($ruleset->rule as $rule) {
387
-            if (isset($rule['ref']) === false
388
-                || $this->shouldProcessElement($rule) === false
386
+        foreach ( $ruleset->rule as $rule ) {
387
+            if ( isset( $rule[ 'ref' ] ) === false
388
+                || $this->shouldProcessElement( $rule ) === false
389 389
             ) {
390 390
                 continue;
391 391
             }
392 392
 
393
-            if (PHP_CODESNIFFER_VERBOSITY > 1) {
394
-                echo str_repeat("\t", $depth);
395
-                echo "\tProcessing rule \"".$rule['ref'].'"'.PHP_EOL;
393
+            if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
394
+                echo str_repeat( "\t", $depth );
395
+                echo "\tProcessing rule \"" . $rule[ 'ref' ] . '"' . PHP_EOL;
396 396
             }
397 397
 
398
-            $expandedSniffs = $this->expandRulesetReference((string) $rule['ref'], $rulesetDir, $depth);
399
-            $newSniffs      = array_diff($expandedSniffs, $includedSniffs);
400
-            $includedSniffs = array_merge($includedSniffs, $expandedSniffs);
398
+            $expandedSniffs = $this->expandRulesetReference( (string)$rule[ 'ref' ], $rulesetDir, $depth );
399
+            $newSniffs      = array_diff( $expandedSniffs, $includedSniffs );
400
+            $includedSniffs = array_merge( $includedSniffs, $expandedSniffs );
401 401
 
402
-            $parts = explode('.', $rule['ref']);
403
-            if (count($parts) === 4
404
-                && $parts[0] !== ''
405
-                && $parts[1] !== ''
406
-                && $parts[2] !== ''
402
+            $parts = explode( '.', $rule[ 'ref' ] );
403
+            if ( count( $parts ) === 4
404
+                && $parts[ 0 ] !== ''
405
+                && $parts[ 1 ] !== ''
406
+                && $parts[ 2 ] !== ''
407 407
             ) {
408
-                $sniffCode = $parts[0].'.'.$parts[1].'.'.$parts[2];
409
-                if (isset($this->ruleset[$sniffCode]['severity']) === true
410
-                    && $this->ruleset[$sniffCode]['severity'] === 0
408
+                $sniffCode = $parts[ 0 ] . '.' . $parts[ 1 ] . '.' . $parts[ 2 ];
409
+                if ( isset( $this->ruleset[ $sniffCode ][ 'severity' ] ) === true
410
+                    && $this->ruleset[ $sniffCode ][ 'severity' ] === 0
411 411
                 ) {
412 412
                     // This sniff code has already been turned off, but now
413 413
                     // it is being explicitly included again, so turn it back on.
414
-                    $this->ruleset[(string) $rule['ref']]['severity'] = 5;
415
-                    if (PHP_CODESNIFFER_VERBOSITY > 1) {
416
-                        echo str_repeat("\t", $depth);
417
-                        echo "\t\t* disabling sniff exclusion for specific message code *".PHP_EOL;
418
-                        echo str_repeat("\t", $depth);
419
-                        echo "\t\t=> severity set to 5".PHP_EOL;
414
+                    $this->ruleset[ (string)$rule[ 'ref' ] ][ 'severity' ] = 5;
415
+                    if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
416
+                        echo str_repeat( "\t", $depth );
417
+                        echo "\t\t* disabling sniff exclusion for specific message code *" . PHP_EOL;
418
+                        echo str_repeat( "\t", $depth );
419
+                        echo "\t\t=> severity set to 5" . PHP_EOL;
420 420
                     }
421
-                } else if (empty($newSniffs) === false) {
422
-                    $newSniff = $newSniffs[0];
423
-                    if (in_array($newSniff, $ownSniffs, true) === false) {
421
+                } else if ( empty( $newSniffs ) === false ) {
422
+                    $newSniff = $newSniffs[ 0 ];
423
+                    if ( in_array( $newSniff, $ownSniffs, true ) === false ) {
424 424
                         // Including a sniff that hasn't been included higher up, but
425 425
                         // only including a single message from it. So turn off all messages in
426 426
                         // the sniff, except this one.
427
-                        $this->ruleset[$sniffCode]['severity']            = 0;
428
-                        $this->ruleset[(string) $rule['ref']]['severity'] = 5;
429
-                        if (PHP_CODESNIFFER_VERBOSITY > 1) {
430
-                            echo str_repeat("\t", $depth);
431
-                            echo "\t\tExcluding sniff \"".$sniffCode.'" except for "'.$parts[3].'"'.PHP_EOL;
427
+                        $this->ruleset[ $sniffCode ][ 'severity' ]            = 0;
428
+                        $this->ruleset[ (string)$rule[ 'ref' ] ][ 'severity' ] = 5;
429
+                        if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
430
+                            echo str_repeat( "\t", $depth );
431
+                            echo "\t\tExcluding sniff \"" . $sniffCode . '" except for "' . $parts[ 3 ] . '"' . PHP_EOL;
432 432
                         }
433 433
                     }
434 434
                 }//end if
435 435
             }//end if
436 436
 
437
-            if (isset($rule->exclude) === true) {
438
-                foreach ($rule->exclude as $exclude) {
439
-                    if (isset($exclude['name']) === false) {
440
-                        if (PHP_CODESNIFFER_VERBOSITY > 1) {
441
-                            echo str_repeat("\t", $depth);
442
-                            echo "\t\t* ignoring empty exclude rule *".PHP_EOL;
443
-                            echo "\t\t\t=> ".$exclude->asXML().PHP_EOL;
437
+            if ( isset( $rule->exclude ) === true ) {
438
+                foreach ( $rule->exclude as $exclude ) {
439
+                    if ( isset( $exclude[ 'name' ] ) === false ) {
440
+                        if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
441
+                            echo str_repeat( "\t", $depth );
442
+                            echo "\t\t* ignoring empty exclude rule *" . PHP_EOL;
443
+                            echo "\t\t\t=> " . $exclude->asXML() . PHP_EOL;
444 444
                         }
445 445
 
446 446
                         continue;
447 447
                     }
448 448
 
449
-                    if ($this->shouldProcessElement($exclude) === false) {
449
+                    if ( $this->shouldProcessElement( $exclude ) === false ) {
450 450
                         continue;
451 451
                     }
452 452
 
453
-                    if (PHP_CODESNIFFER_VERBOSITY > 1) {
454
-                        echo str_repeat("\t", $depth);
455
-                        echo "\t\tExcluding rule \"".$exclude['name'].'"'.PHP_EOL;
453
+                    if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
454
+                        echo str_repeat( "\t", $depth );
455
+                        echo "\t\tExcluding rule \"" . $exclude[ 'name' ] . '"' . PHP_EOL;
456 456
                     }
457 457
 
458 458
                     // Check if a single code is being excluded, which is a shortcut
459 459
                     // for setting the severity of the message to 0.
460
-                    $parts = explode('.', $exclude['name']);
461
-                    if (count($parts) === 4) {
462
-                        $this->ruleset[(string) $exclude['name']]['severity'] = 0;
463
-                        if (PHP_CODESNIFFER_VERBOSITY > 1) {
464
-                            echo str_repeat("\t", $depth);
465
-                            echo "\t\t=> severity set to 0".PHP_EOL;
460
+                    $parts = explode( '.', $exclude[ 'name' ] );
461
+                    if ( count( $parts ) === 4 ) {
462
+                        $this->ruleset[ (string)$exclude[ 'name' ] ][ 'severity' ] = 0;
463
+                        if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
464
+                            echo str_repeat( "\t", $depth );
465
+                            echo "\t\t=> severity set to 0" . PHP_EOL;
466 466
                         }
467 467
                     } else {
468 468
                         $excludedSniffs = array_merge(
469 469
                             $excludedSniffs,
470
-                            $this->expandRulesetReference((string) $exclude['name'], $rulesetDir, ($depth + 1))
470
+                            $this->expandRulesetReference( (string)$exclude[ 'name' ], $rulesetDir, ( $depth + 1 ) )
471 471
                         );
472 472
                     }
473 473
                 }//end foreach
474 474
             }//end if
475 475
 
476
-            $this->processRule($rule, $newSniffs, $depth);
476
+            $this->processRule( $rule, $newSniffs, $depth );
477 477
         }//end foreach
478 478
 
479 479
         // Process custom command line arguments.
480
-        $cliArgs = [];
481
-        foreach ($ruleset->{'arg'} as $arg) {
482
-            if ($this->shouldProcessElement($arg) === false) {
480
+        $cliArgs = [ ];
481
+        foreach ( $ruleset->{'arg'} as $arg ) {
482
+            if ( $this->shouldProcessElement( $arg ) === false ) {
483 483
                 continue;
484 484
             }
485 485
 
486
-            if (isset($arg['name']) === true) {
487
-                $argString = '--'.(string) $arg['name'];
488
-                if (isset($arg['value']) === true) {
489
-                    $argString .= '='.(string) $arg['value'];
486
+            if ( isset( $arg[ 'name' ] ) === true ) {
487
+                $argString = '--' . (string)$arg[ 'name' ];
488
+                if ( isset( $arg[ 'value' ] ) === true ) {
489
+                    $argString .= '=' . (string)$arg[ 'value' ];
490 490
                 }
491 491
             } else {
492
-                $argString = '-'.(string) $arg['value'];
492
+                $argString = '-' . (string)$arg[ 'value' ];
493 493
             }
494 494
 
495
-            $cliArgs[] = $argString;
495
+            $cliArgs[ ] = $argString;
496 496
 
497
-            if (PHP_CODESNIFFER_VERBOSITY > 1) {
498
-                echo str_repeat("\t", $depth);
499
-                echo "\t=> set command line value $argString".PHP_EOL;
497
+            if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
498
+                echo str_repeat( "\t", $depth );
499
+                echo "\t=> set command line value $argString" . PHP_EOL;
500 500
             }
501 501
         }//end foreach
502 502
 
503 503
         // Set custom php ini values as CLI args.
504
-        foreach ($ruleset->{'ini'} as $arg) {
505
-            if ($this->shouldProcessElement($arg) === false) {
504
+        foreach ( $ruleset->{'ini'} as $arg ) {
505
+            if ( $this->shouldProcessElement( $arg ) === false ) {
506 506
                 continue;
507 507
             }
508 508
 
509
-            if (isset($arg['name']) === false) {
509
+            if ( isset( $arg[ 'name' ] ) === false ) {
510 510
                 continue;
511 511
             }
512 512
 
513
-            $name      = (string) $arg['name'];
513
+            $name      = (string)$arg[ 'name' ];
514 514
             $argString = $name;
515
-            if (isset($arg['value']) === true) {
516
-                $value      = (string) $arg['value'];
515
+            if ( isset( $arg[ 'value' ] ) === true ) {
516
+                $value      = (string)$arg[ 'value' ];
517 517
                 $argString .= "=$value";
518 518
             } else {
519 519
                 $value = 'true';
520 520
             }
521 521
 
522
-            $cliArgs[] = '-d';
523
-            $cliArgs[] = $argString;
522
+            $cliArgs[ ] = '-d';
523
+            $cliArgs[ ] = $argString;
524 524
 
525
-            if (PHP_CODESNIFFER_VERBOSITY > 1) {
526
-                echo str_repeat("\t", $depth);
527
-                echo "\t=> set PHP ini value $name to $value".PHP_EOL;
525
+            if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
526
+                echo str_repeat( "\t", $depth );
527
+                echo "\t=> set PHP ini value $name to $value" . PHP_EOL;
528 528
             }
529 529
         }//end foreach
530 530
 
531
-        if (empty($this->config->files) === true) {
531
+        if ( empty( $this->config->files ) === true ) {
532 532
             // Process hard-coded file paths.
533
-            foreach ($ruleset->{'file'} as $file) {
534
-                $file      = (string) $file;
535
-                $cliArgs[] = $file;
536
-                if (PHP_CODESNIFFER_VERBOSITY > 1) {
537
-                    echo str_repeat("\t", $depth);
538
-                    echo "\t=> added \"$file\" to the file list".PHP_EOL;
533
+            foreach ( $ruleset->{'file'} as $file ) {
534
+                $file      = (string)$file;
535
+                $cliArgs[ ] = $file;
536
+                if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
537
+                    echo str_repeat( "\t", $depth );
538
+                    echo "\t=> added \"$file\" to the file list" . PHP_EOL;
539 539
                 }
540 540
             }
541 541
         }
542 542
 
543
-        if (empty($cliArgs) === false) {
543
+        if ( empty( $cliArgs ) === false ) {
544 544
             // Change the directory so all relative paths are worked
545 545
             // out based on the location of the ruleset instead of
546 546
             // the location of the user.
547
-            $inPhar = Util\Common::isPharFile($rulesetDir);
548
-            if ($inPhar === false) {
547
+            $inPhar = Util\Common::isPharFile( $rulesetDir );
548
+            if ( $inPhar === false ) {
549 549
                 $currentDir = getcwd();
550
-                chdir($rulesetDir);
550
+                chdir( $rulesetDir );
551 551
             }
552 552
 
553
-            $this->config->setCommandLineValues($cliArgs);
553
+            $this->config->setCommandLineValues( $cliArgs );
554 554
 
555
-            if ($inPhar === false) {
556
-                chdir($currentDir);
555
+            if ( $inPhar === false ) {
556
+                chdir( $currentDir );
557 557
             }
558 558
         }
559 559
 
560 560
         // Process custom ignore pattern rules.
561
-        foreach ($ruleset->{'exclude-pattern'} as $pattern) {
562
-            if ($this->shouldProcessElement($pattern) === false) {
561
+        foreach ( $ruleset->{'exclude-pattern'} as $pattern ) {
562
+            if ( $this->shouldProcessElement( $pattern ) === false ) {
563 563
                 continue;
564 564
             }
565 565
 
566
-            if (isset($pattern['type']) === false) {
567
-                $pattern['type'] = 'absolute';
566
+            if ( isset( $pattern[ 'type' ] ) === false ) {
567
+                $pattern[ 'type' ] = 'absolute';
568 568
             }
569 569
 
570
-            $this->ignorePatterns[(string) $pattern] = (string) $pattern['type'];
571
-            if (PHP_CODESNIFFER_VERBOSITY > 1) {
572
-                echo str_repeat("\t", $depth);
573
-                echo "\t=> added global ".(string) $pattern['type'].' ignore pattern: '.(string) $pattern.PHP_EOL;
570
+            $this->ignorePatterns[ (string)$pattern ] = (string)$pattern[ 'type' ];
571
+            if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
572
+                echo str_repeat( "\t", $depth );
573
+                echo "\t=> added global " . (string)$pattern[ 'type' ] . ' ignore pattern: ' . (string)$pattern . PHP_EOL;
574 574
             }
575 575
         }
576 576
 
577
-        $includedSniffs = array_unique(array_merge($ownSniffs, $includedSniffs));
578
-        $excludedSniffs = array_unique($excludedSniffs);
577
+        $includedSniffs = array_unique( array_merge( $ownSniffs, $includedSniffs ) );
578
+        $excludedSniffs = array_unique( $excludedSniffs );
579 579
 
580
-        if (PHP_CODESNIFFER_VERBOSITY > 1) {
581
-            $included = count($includedSniffs);
582
-            $excluded = count($excludedSniffs);
583
-            echo str_repeat("\t", $depth);
584
-            echo "=> Ruleset processing complete; included $included sniffs and excluded $excluded".PHP_EOL;
580
+        if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
581
+            $included = count( $includedSniffs );
582
+            $excluded = count( $excludedSniffs );
583
+            echo str_repeat( "\t", $depth );
584
+            echo "=> Ruleset processing complete; included $included sniffs and excluded $excluded" . PHP_EOL;
585 585
         }
586 586
 
587 587
         // Merge our own sniff list with our externally included
588 588
         // sniff list, but filter out any excluded sniffs.
589
-        $files = [];
590
-        foreach ($includedSniffs as $sniff) {
591
-            if (in_array($sniff, $excludedSniffs, true) === true) {
589
+        $files = [ ];
590
+        foreach ( $includedSniffs as $sniff ) {
591
+            if ( in_array( $sniff, $excludedSniffs, true ) === true ) {
592 592
                 continue;
593 593
             } else {
594
-                $files[] = Util\Common::realpath($sniff);
594
+                $files[ ] = Util\Common::realpath( $sniff );
595 595
             }
596 596
         }
597 597
 
@@ -609,31 +609,31 @@  discard block
 block discarded – undo
609 609
      *
610 610
      * @return array
611 611
      */
612
-    private function expandSniffDirectory($directory, $depth=0)
612
+    private function expandSniffDirectory( $directory, $depth = 0 )
613 613
     {
614
-        $sniffs = [];
614
+        $sniffs = [ ];
615 615
 
616
-        $rdi = new \RecursiveDirectoryIterator($directory, \RecursiveDirectoryIterator::FOLLOW_SYMLINKS);
617
-        $di  = new \RecursiveIteratorIterator($rdi, 0, \RecursiveIteratorIterator::CATCH_GET_CHILD);
616
+        $rdi = new \RecursiveDirectoryIterator( $directory, \RecursiveDirectoryIterator::FOLLOW_SYMLINKS );
617
+        $di  = new \RecursiveIteratorIterator( $rdi, 0, \RecursiveIteratorIterator::CATCH_GET_CHILD );
618 618
 
619
-        $dirLen = strlen($directory);
619
+        $dirLen = strlen( $directory );
620 620
 
621
-        foreach ($di as $file) {
621
+        foreach ( $di as $file ) {
622 622
             $filename = $file->getFilename();
623 623
 
624 624
             // Skip hidden files.
625
-            if (substr($filename, 0, 1) === '.') {
625
+            if ( substr( $filename, 0, 1 ) === '.' ) {
626 626
                 continue;
627 627
             }
628 628
 
629 629
             // We are only interested in PHP and sniff files.
630
-            $fileParts = explode('.', $filename);
631
-            if (array_pop($fileParts) !== 'php') {
630
+            $fileParts = explode( '.', $filename );
631
+            if ( array_pop( $fileParts ) !== 'php' ) {
632 632
                 continue;
633 633
             }
634 634
 
635
-            $basename = basename($filename, '.php');
636
-            if (substr($basename, -5) !== 'Sniff') {
635
+            $basename = basename( $filename, '.php' );
636
+            if ( substr( $basename, -5 ) !== 'Sniff' ) {
637 637
                 continue;
638 638
             }
639 639
 
@@ -643,16 +643,16 @@  discard block
 block discarded – undo
643 643
             // standard. We use the offset with strpos() to allow hidden directories
644 644
             // before, valid example:
645 645
             // /home/foo/.composer/vendor/squiz/custom_tool/MyStandard/Sniffs/...
646
-            if (strpos($path, DIRECTORY_SEPARATOR.'.', $dirLen) !== false) {
646
+            if ( strpos( $path, DIRECTORY_SEPARATOR . '.', $dirLen ) !== false ) {
647 647
                 continue;
648 648
             }
649 649
 
650
-            if (PHP_CODESNIFFER_VERBOSITY > 1) {
651
-                echo str_repeat("\t", $depth);
652
-                echo "\t\t=> ".Util\Common::stripBasepath($path, $this->config->basepath).PHP_EOL;
650
+            if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
651
+                echo str_repeat( "\t", $depth );
652
+                echo "\t\t=> " . Util\Common::stripBasepath( $path, $this->config->basepath ) . PHP_EOL;
653 653
             }
654 654
 
655
-            $sniffs[] = $path;
655
+            $sniffs[ ] = $path;
656 656
         }//end foreach
657 657
 
658 658
         return $sniffs;
@@ -672,120 +672,120 @@  discard block
 block discarded – undo
672 672
      * @return array
673 673
      * @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the reference is invalid.
674 674
      */
675
-    private function expandRulesetReference($ref, $rulesetDir, $depth=0)
675
+    private function expandRulesetReference( $ref, $rulesetDir, $depth = 0 )
676 676
     {
677 677
         // Ignore internal sniffs codes as they are used to only
678 678
         // hide and change internal messages.
679
-        if (substr($ref, 0, 9) === 'Internal.') {
680
-            if (PHP_CODESNIFFER_VERBOSITY > 1) {
681
-                echo str_repeat("\t", $depth);
682
-                echo "\t\t* ignoring internal sniff code *".PHP_EOL;
679
+        if ( substr( $ref, 0, 9 ) === 'Internal.' ) {
680
+            if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
681
+                echo str_repeat( "\t", $depth );
682
+                echo "\t\t* ignoring internal sniff code *" . PHP_EOL;
683 683
             }
684 684
 
685
-            return [];
685
+            return [ ];
686 686
         }
687 687
 
688 688
         // As sniffs can't begin with a full stop, assume references in
689 689
         // this format are relative paths and attempt to convert them
690 690
         // to absolute paths. If this fails, let the reference run through
691 691
         // the normal checks and have it fail as normal.
692
-        if (substr($ref, 0, 1) === '.') {
693
-            $realpath = Util\Common::realpath($rulesetDir.'/'.$ref);
694
-            if ($realpath !== false) {
692
+        if ( substr( $ref, 0, 1 ) === '.' ) {
693
+            $realpath = Util\Common::realpath( $rulesetDir . '/' . $ref );
694
+            if ( $realpath !== false ) {
695 695
                 $ref = $realpath;
696
-                if (PHP_CODESNIFFER_VERBOSITY > 1) {
697
-                    echo str_repeat("\t", $depth);
698
-                    echo "\t\t=> ".Util\Common::stripBasepath($ref, $this->config->basepath).PHP_EOL;
696
+                if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
697
+                    echo str_repeat( "\t", $depth );
698
+                    echo "\t\t=> " . Util\Common::stripBasepath( $ref, $this->config->basepath ) . PHP_EOL;
699 699
                 }
700 700
             }
701 701
         }
702 702
 
703 703
         // As sniffs can't begin with a tilde, assume references in
704 704
         // this format are relative to the user's home directory.
705
-        if (substr($ref, 0, 2) === '~/') {
706
-            $realpath = Util\Common::realpath($ref);
707
-            if ($realpath !== false) {
705
+        if ( substr( $ref, 0, 2 ) === '~/' ) {
706
+            $realpath = Util\Common::realpath( $ref );
707
+            if ( $realpath !== false ) {
708 708
                 $ref = $realpath;
709
-                if (PHP_CODESNIFFER_VERBOSITY > 1) {
710
-                    echo str_repeat("\t", $depth);
711
-                    echo "\t\t=> ".Util\Common::stripBasepath($ref, $this->config->basepath).PHP_EOL;
709
+                if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
710
+                    echo str_repeat( "\t", $depth );
711
+                    echo "\t\t=> " . Util\Common::stripBasepath( $ref, $this->config->basepath ) . PHP_EOL;
712 712
                 }
713 713
             }
714 714
         }
715 715
 
716
-        if (is_file($ref) === true) {
717
-            if (substr($ref, -9) === 'Sniff.php') {
716
+        if ( is_file( $ref ) === true ) {
717
+            if ( substr( $ref, -9 ) === 'Sniff.php' ) {
718 718
                 // A single external sniff.
719
-                $this->rulesetDirs[] = dirname(dirname(dirname($ref)));
720
-                return [$ref];
719
+                $this->rulesetDirs[ ] = dirname( dirname( dirname( $ref ) ) );
720
+                return [ $ref ];
721 721
             }
722 722
         } else {
723 723
             // See if this is a whole standard being referenced.
724
-            $path = Util\Standards::getInstalledStandardPath($ref);
725
-            if (Util\Common::isPharFile($path) === true && strpos($path, 'ruleset.xml') === false) {
724
+            $path = Util\Standards::getInstalledStandardPath( $ref );
725
+            if ( Util\Common::isPharFile( $path ) === true && strpos( $path, 'ruleset.xml' ) === false ) {
726 726
                 // If the ruleset exists inside the phar file, use it.
727
-                if (file_exists($path.DIRECTORY_SEPARATOR.'ruleset.xml') === true) {
728
-                    $path .= DIRECTORY_SEPARATOR.'ruleset.xml';
727
+                if ( file_exists( $path . DIRECTORY_SEPARATOR . 'ruleset.xml' ) === true ) {
728
+                    $path .= DIRECTORY_SEPARATOR . 'ruleset.xml';
729 729
                 } else {
730 730
                     $path = null;
731 731
                 }
732 732
             }
733 733
 
734
-            if ($path !== null) {
734
+            if ( $path !== null ) {
735 735
                 $ref = $path;
736
-                if (PHP_CODESNIFFER_VERBOSITY > 1) {
737
-                    echo str_repeat("\t", $depth);
738
-                    echo "\t\t=> ".Util\Common::stripBasepath($ref, $this->config->basepath).PHP_EOL;
736
+                if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
737
+                    echo str_repeat( "\t", $depth );
738
+                    echo "\t\t=> " . Util\Common::stripBasepath( $ref, $this->config->basepath ) . PHP_EOL;
739 739
                 }
740
-            } else if (is_dir($ref) === false) {
740
+            } else if ( is_dir( $ref ) === false ) {
741 741
                 // Work out the sniff path.
742
-                $sepPos = strpos($ref, DIRECTORY_SEPARATOR);
743
-                if ($sepPos !== false) {
744
-                    $stdName = substr($ref, 0, $sepPos);
745
-                    $path    = substr($ref, $sepPos);
742
+                $sepPos = strpos( $ref, DIRECTORY_SEPARATOR );
743
+                if ( $sepPos !== false ) {
744
+                    $stdName = substr( $ref, 0, $sepPos );
745
+                    $path    = substr( $ref, $sepPos );
746 746
                 } else {
747
-                    $parts   = explode('.', $ref);
748
-                    $stdName = $parts[0];
749
-                    if (count($parts) === 1) {
747
+                    $parts   = explode( '.', $ref );
748
+                    $stdName = $parts[ 0 ];
749
+                    if ( count( $parts ) === 1 ) {
750 750
                         // A whole standard?
751 751
                         $path = '';
752
-                    } else if (count($parts) === 2) {
752
+                    } else if ( count( $parts ) === 2 ) {
753 753
                         // A directory of sniffs?
754
-                        $path = DIRECTORY_SEPARATOR.'Sniffs'.DIRECTORY_SEPARATOR.$parts[1];
754
+                        $path = DIRECTORY_SEPARATOR . 'Sniffs' . DIRECTORY_SEPARATOR . $parts[ 1 ];
755 755
                     } else {
756 756
                         // A single sniff?
757
-                        $path = DIRECTORY_SEPARATOR.'Sniffs'.DIRECTORY_SEPARATOR.$parts[1].DIRECTORY_SEPARATOR.$parts[2].'Sniff.php';
757
+                        $path = DIRECTORY_SEPARATOR . 'Sniffs' . DIRECTORY_SEPARATOR . $parts[ 1 ] . DIRECTORY_SEPARATOR . $parts[ 2 ] . 'Sniff.php';
758 758
                     }
759 759
                 }
760 760
 
761 761
                 $newRef  = false;
762
-                $stdPath = Util\Standards::getInstalledStandardPath($stdName);
763
-                if ($stdPath !== null && $path !== '') {
764
-                    if (Util\Common::isPharFile($stdPath) === true
765
-                        && strpos($stdPath, 'ruleset.xml') === false
762
+                $stdPath = Util\Standards::getInstalledStandardPath( $stdName );
763
+                if ( $stdPath !== null && $path !== '' ) {
764
+                    if ( Util\Common::isPharFile( $stdPath ) === true
765
+                        && strpos( $stdPath, 'ruleset.xml' ) === false
766 766
                     ) {
767 767
                         // Phar files can only return the directory,
768 768
                         // since ruleset can be omitted if building one standard.
769
-                        $newRef = Util\Common::realpath($stdPath.$path);
769
+                        $newRef = Util\Common::realpath( $stdPath . $path );
770 770
                     } else {
771
-                        $newRef = Util\Common::realpath(dirname($stdPath).$path);
771
+                        $newRef = Util\Common::realpath( dirname( $stdPath ) . $path );
772 772
                     }
773 773
                 }
774 774
 
775
-                if ($newRef === false) {
775
+                if ( $newRef === false ) {
776 776
                     // The sniff is not locally installed, so check if it is being
777 777
                     // referenced as a remote sniff outside the install. We do this
778 778
                     // by looking through all directories where we have found ruleset
779 779
                     // files before, looking for ones for this particular standard,
780 780
                     // and seeing if it is in there.
781
-                    foreach ($this->rulesetDirs as $dir) {
782
-                        if (strtolower(basename($dir)) !== strtolower($stdName)) {
781
+                    foreach ( $this->rulesetDirs as $dir ) {
782
+                        if ( strtolower( basename( $dir ) ) !== strtolower( $stdName ) ) {
783 783
                             continue;
784 784
                         }
785 785
 
786
-                        $newRef = Util\Common::realpath($dir.$path);
786
+                        $newRef = Util\Common::realpath( $dir . $path );
787 787
 
788
-                        if ($newRef !== false) {
788
+                        if ( $newRef !== false ) {
789 789
                             $ref = $newRef;
790 790
                         }
791 791
                     }
@@ -793,50 +793,50 @@  discard block
 block discarded – undo
793 793
                     $ref = $newRef;
794 794
                 }
795 795
 
796
-                if (PHP_CODESNIFFER_VERBOSITY > 1) {
797
-                    echo str_repeat("\t", $depth);
798
-                    echo "\t\t=> ".Util\Common::stripBasepath($ref, $this->config->basepath).PHP_EOL;
796
+                if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
797
+                    echo str_repeat( "\t", $depth );
798
+                    echo "\t\t=> " . Util\Common::stripBasepath( $ref, $this->config->basepath ) . PHP_EOL;
799 799
                 }
800 800
             }//end if
801 801
         }//end if
802 802
 
803
-        if (is_dir($ref) === true) {
804
-            if (is_file($ref.DIRECTORY_SEPARATOR.'ruleset.xml') === true) {
803
+        if ( is_dir( $ref ) === true ) {
804
+            if ( is_file( $ref . DIRECTORY_SEPARATOR . 'ruleset.xml' ) === true ) {
805 805
                 // We are referencing an external coding standard.
806
-                if (PHP_CODESNIFFER_VERBOSITY > 1) {
807
-                    echo str_repeat("\t", $depth);
808
-                    echo "\t\t* rule is referencing a standard using directory name; processing *".PHP_EOL;
806
+                if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
807
+                    echo str_repeat( "\t", $depth );
808
+                    echo "\t\t* rule is referencing a standard using directory name; processing *" . PHP_EOL;
809 809
                 }
810 810
 
811
-                return $this->processRuleset($ref.DIRECTORY_SEPARATOR.'ruleset.xml', ($depth + 2));
811
+                return $this->processRuleset( $ref . DIRECTORY_SEPARATOR . 'ruleset.xml', ( $depth + 2 ) );
812 812
             } else {
813 813
                 // We are referencing a whole directory of sniffs.
814
-                if (PHP_CODESNIFFER_VERBOSITY > 1) {
815
-                    echo str_repeat("\t", $depth);
816
-                    echo "\t\t* rule is referencing a directory of sniffs *".PHP_EOL;
817
-                    echo str_repeat("\t", $depth);
818
-                    echo "\t\tAdding sniff files from directory".PHP_EOL;
814
+                if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
815
+                    echo str_repeat( "\t", $depth );
816
+                    echo "\t\t* rule is referencing a directory of sniffs *" . PHP_EOL;
817
+                    echo str_repeat( "\t", $depth );
818
+                    echo "\t\tAdding sniff files from directory" . PHP_EOL;
819 819
                 }
820 820
 
821
-                return $this->expandSniffDirectory($ref, ($depth + 1));
821
+                return $this->expandSniffDirectory( $ref, ( $depth + 1 ) );
822 822
             }
823 823
         } else {
824
-            if (is_file($ref) === false) {
824
+            if ( is_file( $ref ) === false ) {
825 825
                 $error = "Referenced sniff \"$ref\" does not exist";
826
-                throw new RuntimeException($error);
826
+                throw new RuntimeException( $error );
827 827
             }
828 828
 
829
-            if (substr($ref, -9) === 'Sniff.php') {
829
+            if ( substr( $ref, -9 ) === 'Sniff.php' ) {
830 830
                 // A single sniff.
831
-                return [$ref];
831
+                return [ $ref ];
832 832
             } else {
833 833
                 // Assume an external ruleset.xml file.
834
-                if (PHP_CODESNIFFER_VERBOSITY > 1) {
835
-                    echo str_repeat("\t", $depth);
836
-                    echo "\t\t* rule is referencing a standard using ruleset path; processing *".PHP_EOL;
834
+                if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
835
+                    echo str_repeat( "\t", $depth );
836
+                    echo "\t\t* rule is referencing a standard using ruleset path; processing *" . PHP_EOL;
837 837
                 }
838 838
 
839
-                return $this->processRuleset($ref, ($depth + 2));
839
+                return $this->processRuleset( $ref, ( $depth + 2 ) );
840 840
             }
841 841
         }//end if
842 842
 
@@ -854,38 +854,38 @@  discard block
 block discarded – undo
854 854
      * @return void
855 855
      * @throws \PHP_CodeSniffer\Exceptions\RuntimeException If rule settings are invalid.
856 856
      */
857
-    private function processRule($rule, $newSniffs, $depth=0)
857
+    private function processRule( $rule, $newSniffs, $depth = 0 )
858 858
     {
859
-        $ref  = (string) $rule['ref'];
860
-        $todo = [$ref];
859
+        $ref  = (string)$rule[ 'ref' ];
860
+        $todo = [ $ref ];
861 861
 
862
-        $parts = explode('.', $ref);
863
-        if (count($parts) <= 2) {
862
+        $parts = explode( '.', $ref );
863
+        if ( count( $parts ) <= 2 ) {
864 864
             // We are processing a standard or a category of sniffs.
865
-            foreach ($newSniffs as $sniffFile) {
866
-                $parts         = explode(DIRECTORY_SEPARATOR, $sniffFile);
867
-                $sniffName     = array_pop($parts);
868
-                $sniffCategory = array_pop($parts);
869
-                array_pop($parts);
870
-                $sniffStandard = array_pop($parts);
871
-                $todo[]        = $sniffStandard.'.'.$sniffCategory.'.'.substr($sniffName, 0, -9);
865
+            foreach ( $newSniffs as $sniffFile ) {
866
+                $parts         = explode( DIRECTORY_SEPARATOR, $sniffFile );
867
+                $sniffName     = array_pop( $parts );
868
+                $sniffCategory = array_pop( $parts );
869
+                array_pop( $parts );
870
+                $sniffStandard = array_pop( $parts );
871
+                $todo[ ]        = $sniffStandard . '.' . $sniffCategory . '.' . substr( $sniffName, 0, -9 );
872 872
             }
873 873
         }
874 874
 
875
-        foreach ($todo as $code) {
875
+        foreach ( $todo as $code ) {
876 876
             // Custom severity.
877
-            if (isset($rule->severity) === true
878
-                && $this->shouldProcessElement($rule->severity) === true
877
+            if ( isset( $rule->severity ) === true
878
+                && $this->shouldProcessElement( $rule->severity ) === true
879 879
             ) {
880
-                if (isset($this->ruleset[$code]) === false) {
881
-                    $this->ruleset[$code] = [];
880
+                if ( isset( $this->ruleset[ $code ] ) === false ) {
881
+                    $this->ruleset[ $code ] = [ ];
882 882
                 }
883 883
 
884
-                $this->ruleset[$code]['severity'] = (int) $rule->severity;
885
-                if (PHP_CODESNIFFER_VERBOSITY > 1) {
886
-                    echo str_repeat("\t", $depth);
887
-                    echo "\t\t=> severity set to ".(int) $rule->severity;
888
-                    if ($code !== $ref) {
884
+                $this->ruleset[ $code ][ 'severity' ] = (int)$rule->severity;
885
+                if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
886
+                    echo str_repeat( "\t", $depth );
887
+                    echo "\t\t=> severity set to " . (int)$rule->severity;
888
+                    if ( $code !== $ref ) {
889 889
                         echo " for $code";
890 890
                     }
891 891
 
@@ -894,23 +894,23 @@  discard block
 block discarded – undo
894 894
             }
895 895
 
896 896
             // Custom message type.
897
-            if (isset($rule->type) === true
898
-                && $this->shouldProcessElement($rule->type) === true
897
+            if ( isset( $rule->type ) === true
898
+                && $this->shouldProcessElement( $rule->type ) === true
899 899
             ) {
900
-                if (isset($this->ruleset[$code]) === false) {
901
-                    $this->ruleset[$code] = [];
900
+                if ( isset( $this->ruleset[ $code ] ) === false ) {
901
+                    $this->ruleset[ $code ] = [ ];
902 902
                 }
903 903
 
904
-                $type = strtolower((string) $rule->type);
905
-                if ($type !== 'error' && $type !== 'warning') {
906
-                    throw new RuntimeException("Message type \"$type\" is invalid; must be \"error\" or \"warning\"");
904
+                $type = strtolower( (string)$rule->type );
905
+                if ( $type !== 'error' && $type !== 'warning' ) {
906
+                    throw new RuntimeException( "Message type \"$type\" is invalid; must be \"error\" or \"warning\"" );
907 907
                 }
908 908
 
909
-                $this->ruleset[$code]['type'] = $type;
910
-                if (PHP_CODESNIFFER_VERBOSITY > 1) {
911
-                    echo str_repeat("\t", $depth);
912
-                    echo "\t\t=> message type set to ".(string) $rule->type;
913
-                    if ($code !== $ref) {
909
+                $this->ruleset[ $code ][ 'type' ] = $type;
910
+                if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
911
+                    echo str_repeat( "\t", $depth );
912
+                    echo "\t\t=> message type set to " . (string)$rule->type;
913
+                    if ( $code !== $ref ) {
914 914
                         echo " for $code";
915 915
                     }
916 916
 
@@ -919,18 +919,18 @@  discard block
 block discarded – undo
919 919
             }//end if
920 920
 
921 921
             // Custom message.
922
-            if (isset($rule->message) === true
923
-                && $this->shouldProcessElement($rule->message) === true
922
+            if ( isset( $rule->message ) === true
923
+                && $this->shouldProcessElement( $rule->message ) === true
924 924
             ) {
925
-                if (isset($this->ruleset[$code]) === false) {
926
-                    $this->ruleset[$code] = [];
925
+                if ( isset( $this->ruleset[ $code ] ) === false ) {
926
+                    $this->ruleset[ $code ] = [ ];
927 927
                 }
928 928
 
929
-                $this->ruleset[$code]['message'] = (string) $rule->message;
930
-                if (PHP_CODESNIFFER_VERBOSITY > 1) {
931
-                    echo str_repeat("\t", $depth);
932
-                    echo "\t\t=> message set to ".(string) $rule->message;
933
-                    if ($code !== $ref) {
929
+                $this->ruleset[ $code ][ 'message' ] = (string)$rule->message;
930
+                if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
931
+                    echo str_repeat( "\t", $depth );
932
+                    echo "\t\t=> message set to " . (string)$rule->message;
933
+                    if ( $code !== $ref ) {
934 934
                         echo " for $code";
935 935
                     }
936 936
 
@@ -939,82 +939,82 @@  discard block
 block discarded – undo
939 939
             }
940 940
 
941 941
             // Custom properties.
942
-            if (isset($rule->properties) === true
943
-                && $this->shouldProcessElement($rule->properties) === true
942
+            if ( isset( $rule->properties ) === true
943
+                && $this->shouldProcessElement( $rule->properties ) === true
944 944
             ) {
945
-                foreach ($rule->properties->property as $prop) {
946
-                    if ($this->shouldProcessElement($prop) === false) {
945
+                foreach ( $rule->properties->property as $prop ) {
946
+                    if ( $this->shouldProcessElement( $prop ) === false ) {
947 947
                         continue;
948 948
                     }
949 949
 
950
-                    if (isset($this->ruleset[$code]) === false) {
951
-                        $this->ruleset[$code] = [
952
-                            'properties' => [],
950
+                    if ( isset( $this->ruleset[ $code ] ) === false ) {
951
+                        $this->ruleset[ $code ] = [
952
+                            'properties' => [ ],
953 953
                         ];
954
-                    } else if (isset($this->ruleset[$code]['properties']) === false) {
955
-                        $this->ruleset[$code]['properties'] = [];
954
+                    } else if ( isset( $this->ruleset[ $code ][ 'properties' ] ) === false ) {
955
+                        $this->ruleset[ $code ][ 'properties' ] = [ ];
956 956
                     }
957 957
 
958
-                    $name = (string) $prop['name'];
959
-                    if (isset($prop['type']) === true
960
-                        && (string) $prop['type'] === 'array'
958
+                    $name = (string)$prop[ 'name' ];
959
+                    if ( isset( $prop[ 'type' ] ) === true
960
+                        && (string)$prop[ 'type' ] === 'array'
961 961
                     ) {
962
-                        $values = [];
963
-                        if (isset($prop['extend']) === true
964
-                            && (string) $prop['extend'] === 'true'
965
-                            && isset($this->ruleset[$code]['properties'][$name]) === true
962
+                        $values = [ ];
963
+                        if ( isset( $prop[ 'extend' ] ) === true
964
+                            && (string)$prop[ 'extend' ] === 'true'
965
+                            && isset( $this->ruleset[ $code ][ 'properties' ][ $name ] ) === true
966 966
                         ) {
967
-                            $values = $this->ruleset[$code]['properties'][$name];
967
+                            $values = $this->ruleset[ $code ][ 'properties' ][ $name ];
968 968
                         }
969 969
 
970
-                        if (isset($prop->element) === true) {
970
+                        if ( isset( $prop->element ) === true ) {
971 971
                             $printValue = '';
972
-                            foreach ($prop->element as $element) {
973
-                                if ($this->shouldProcessElement($element) === false) {
972
+                            foreach ( $prop->element as $element ) {
973
+                                if ( $this->shouldProcessElement( $element ) === false ) {
974 974
                                     continue;
975 975
                                 }
976 976
 
977
-                                $value = (string) $element['value'];
978
-                                if (isset($element['key']) === true) {
979
-                                    $key          = (string) $element['key'];
980
-                                    $values[$key] = $value;
981
-                                    $printValue  .= $key.'=>'.$value.',';
977
+                                $value = (string)$element[ 'value' ];
978
+                                if ( isset( $element[ 'key' ] ) === true ) {
979
+                                    $key          = (string)$element[ 'key' ];
980
+                                    $values[ $key ] = $value;
981
+                                    $printValue  .= $key . '=>' . $value . ',';
982 982
                                 } else {
983
-                                    $values[]    = $value;
984
-                                    $printValue .= $value.',';
983
+                                    $values[ ]    = $value;
984
+                                    $printValue .= $value . ',';
985 985
                                 }
986 986
                             }
987 987
 
988
-                            $printValue = rtrim($printValue, ',');
988
+                            $printValue = rtrim( $printValue, ',' );
989 989
                         } else {
990
-                            $value      = (string) $prop['value'];
990
+                            $value      = (string)$prop[ 'value' ];
991 991
                             $printValue = $value;
992
-                            foreach (explode(',', $value) as $val) {
993
-                                list($k, $v) = explode('=>', $val.'=>');
994
-                                if ($v !== '') {
995
-                                    $values[trim($k)] = trim($v);
992
+                            foreach ( explode( ',', $value ) as $val ) {
993
+                                list( $k, $v ) = explode( '=>', $val . '=>' );
994
+                                if ( $v !== '' ) {
995
+                                    $values[ trim( $k ) ] = trim( $v );
996 996
                                 } else {
997
-                                    $values[] = trim($k);
997
+                                    $values[ ] = trim( $k );
998 998
                                 }
999 999
                             }
1000 1000
                         }//end if
1001 1001
 
1002
-                        $this->ruleset[$code]['properties'][$name] = $values;
1003
-                        if (PHP_CODESNIFFER_VERBOSITY > 1) {
1004
-                            echo str_repeat("\t", $depth);
1002
+                        $this->ruleset[ $code ][ 'properties' ][ $name ] = $values;
1003
+                        if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
1004
+                            echo str_repeat( "\t", $depth );
1005 1005
                             echo "\t\t=> array property \"$name\" set to \"$printValue\"";
1006
-                            if ($code !== $ref) {
1006
+                            if ( $code !== $ref ) {
1007 1007
                                 echo " for $code";
1008 1008
                             }
1009 1009
 
1010 1010
                             echo PHP_EOL;
1011 1011
                         }
1012 1012
                     } else {
1013
-                        $this->ruleset[$code]['properties'][$name] = (string) $prop['value'];
1014
-                        if (PHP_CODESNIFFER_VERBOSITY > 1) {
1015
-                            echo str_repeat("\t", $depth);
1016
-                            echo "\t\t=> property \"$name\" set to \"".(string) $prop['value'].'"';
1017
-                            if ($code !== $ref) {
1013
+                        $this->ruleset[ $code ][ 'properties' ][ $name ] = (string)$prop[ 'value' ];
1014
+                        if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
1015
+                            echo str_repeat( "\t", $depth );
1016
+                            echo "\t\t=> property \"$name\" set to \"" . (string)$prop[ 'value' ] . '"';
1017
+                            if ( $code !== $ref ) {
1018 1018
                                 echo " for $code";
1019 1019
                             }
1020 1020
 
@@ -1025,54 +1025,54 @@  discard block
 block discarded – undo
1025 1025
             }//end if
1026 1026
 
1027 1027
             // Ignore patterns.
1028
-            foreach ($rule->{'exclude-pattern'} as $pattern) {
1029
-                if ($this->shouldProcessElement($pattern) === false) {
1028
+            foreach ( $rule->{'exclude-pattern'} as $pattern ) {
1029
+                if ( $this->shouldProcessElement( $pattern ) === false ) {
1030 1030
                     continue;
1031 1031
                 }
1032 1032
 
1033
-                if (isset($this->ignorePatterns[$code]) === false) {
1034
-                    $this->ignorePatterns[$code] = [];
1033
+                if ( isset( $this->ignorePatterns[ $code ] ) === false ) {
1034
+                    $this->ignorePatterns[ $code ] = [ ];
1035 1035
                 }
1036 1036
 
1037
-                if (isset($pattern['type']) === false) {
1038
-                    $pattern['type'] = 'absolute';
1037
+                if ( isset( $pattern[ 'type' ] ) === false ) {
1038
+                    $pattern[ 'type' ] = 'absolute';
1039 1039
                 }
1040 1040
 
1041
-                $this->ignorePatterns[$code][(string) $pattern] = (string) $pattern['type'];
1042
-                if (PHP_CODESNIFFER_VERBOSITY > 1) {
1043
-                    echo str_repeat("\t", $depth);
1044
-                    echo "\t\t=> added rule-specific ".(string) $pattern['type'].' ignore pattern';
1045
-                    if ($code !== $ref) {
1041
+                $this->ignorePatterns[ $code ][ (string)$pattern ] = (string)$pattern[ 'type' ];
1042
+                if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
1043
+                    echo str_repeat( "\t", $depth );
1044
+                    echo "\t\t=> added rule-specific " . (string)$pattern[ 'type' ] . ' ignore pattern';
1045
+                    if ( $code !== $ref ) {
1046 1046
                         echo " for $code";
1047 1047
                     }
1048 1048
 
1049
-                    echo ': '.(string) $pattern.PHP_EOL;
1049
+                    echo ': ' . (string)$pattern . PHP_EOL;
1050 1050
                 }
1051 1051
             }//end foreach
1052 1052
 
1053 1053
             // Include patterns.
1054
-            foreach ($rule->{'include-pattern'} as $pattern) {
1055
-                if ($this->shouldProcessElement($pattern) === false) {
1054
+            foreach ( $rule->{'include-pattern'} as $pattern ) {
1055
+                if ( $this->shouldProcessElement( $pattern ) === false ) {
1056 1056
                     continue;
1057 1057
                 }
1058 1058
 
1059
-                if (isset($this->includePatterns[$code]) === false) {
1060
-                    $this->includePatterns[$code] = [];
1059
+                if ( isset( $this->includePatterns[ $code ] ) === false ) {
1060
+                    $this->includePatterns[ $code ] = [ ];
1061 1061
                 }
1062 1062
 
1063
-                if (isset($pattern['type']) === false) {
1064
-                    $pattern['type'] = 'absolute';
1063
+                if ( isset( $pattern[ 'type' ] ) === false ) {
1064
+                    $pattern[ 'type' ] = 'absolute';
1065 1065
                 }
1066 1066
 
1067
-                $this->includePatterns[$code][(string) $pattern] = (string) $pattern['type'];
1068
-                if (PHP_CODESNIFFER_VERBOSITY > 1) {
1069
-                    echo str_repeat("\t", $depth);
1070
-                    echo "\t\t=> added rule-specific ".(string) $pattern['type'].' include pattern';
1071
-                    if ($code !== $ref) {
1067
+                $this->includePatterns[ $code ][ (string)$pattern ] = (string)$pattern[ 'type' ];
1068
+                if ( PHP_CODESNIFFER_VERBOSITY > 1 ) {
1069
+                    echo str_repeat( "\t", $depth );
1070
+                    echo "\t\t=> added rule-specific " . (string)$pattern[ 'type' ] . ' include pattern';
1071
+                    if ( $code !== $ref ) {
1072 1072
                         echo " for $code";
1073 1073
                     }
1074 1074
 
1075
-                    echo ': '.(string) $pattern.PHP_EOL;
1075
+                    echo ': ' . (string)$pattern . PHP_EOL;
1076 1076
                 }
1077 1077
             }//end foreach
1078 1078
         }//end foreach
@@ -1087,25 +1087,25 @@  discard block
 block discarded – undo
1087 1087
      *
1088 1088
      * @return bool
1089 1089
      */
1090
-    private function shouldProcessElement($element)
1090
+    private function shouldProcessElement( $element )
1091 1091
     {
1092
-        if (isset($element['phpcbf-only']) === false
1093
-            && isset($element['phpcs-only']) === false
1092
+        if ( isset( $element[ 'phpcbf-only' ] ) === false
1093
+            && isset( $element[ 'phpcs-only' ] ) === false
1094 1094
         ) {
1095 1095
             // No exceptions are being made.
1096 1096
             return true;
1097 1097
         }
1098 1098
 
1099
-        if (PHP_CODESNIFFER_CBF === true
1100
-            && isset($element['phpcbf-only']) === true
1101
-            && (string) $element['phpcbf-only'] === 'true'
1099
+        if ( PHP_CODESNIFFER_CBF === true
1100
+            && isset( $element[ 'phpcbf-only' ] ) === true
1101
+            && (string)$element[ 'phpcbf-only' ] === 'true'
1102 1102
         ) {
1103 1103
             return true;
1104 1104
         }
1105 1105
 
1106
-        if (PHP_CODESNIFFER_CBF === false
1107
-            && isset($element['phpcs-only']) === true
1108
-            && (string) $element['phpcs-only'] === 'true'
1106
+        if ( PHP_CODESNIFFER_CBF === false
1107
+            && isset( $element[ 'phpcs-only' ] ) === true
1108
+            && (string)$element[ 'phpcs-only' ] === 'true'
1109 1109
         ) {
1110 1110
             return true;
1111 1111
         }
@@ -1126,52 +1126,52 @@  discard block
 block discarded – undo
1126 1126
      *
1127 1127
      * @return void
1128 1128
      */
1129
-    public function registerSniffs($files, $restrictions, $exclusions)
1129
+    public function registerSniffs( $files, $restrictions, $exclusions )
1130 1130
     {
1131
-        $listeners = [];
1131
+        $listeners = [ ];
1132 1132
 
1133
-        foreach ($files as $file) {
1133
+        foreach ( $files as $file ) {
1134 1134
             // Work out where the position of /StandardName/Sniffs/... is
1135 1135
             // so we can determine what the class will be called.
1136
-            $sniffPos = strrpos($file, DIRECTORY_SEPARATOR.'Sniffs'.DIRECTORY_SEPARATOR);
1137
-            if ($sniffPos === false) {
1136
+            $sniffPos = strrpos( $file, DIRECTORY_SEPARATOR . 'Sniffs' . DIRECTORY_SEPARATOR );
1137
+            if ( $sniffPos === false ) {
1138 1138
                 continue;
1139 1139
             }
1140 1140
 
1141
-            $slashPos = strrpos(substr($file, 0, $sniffPos), DIRECTORY_SEPARATOR);
1142
-            if ($slashPos === false) {
1141
+            $slashPos = strrpos( substr( $file, 0, $sniffPos ), DIRECTORY_SEPARATOR );
1142
+            if ( $slashPos === false ) {
1143 1143
                 continue;
1144 1144
             }
1145 1145
 
1146
-            $className   = Autoload::loadFile($file);
1147
-            $compareName = Util\Common::cleanSniffClass($className);
1146
+            $className   = Autoload::loadFile( $file );
1147
+            $compareName = Util\Common::cleanSniffClass( $className );
1148 1148
 
1149 1149
             // If they have specified a list of sniffs to restrict to, check
1150 1150
             // to see if this sniff is allowed.
1151
-            if (empty($restrictions) === false
1152
-                && isset($restrictions[$compareName]) === false
1151
+            if ( empty( $restrictions ) === false
1152
+                && isset( $restrictions[ $compareName ] ) === false
1153 1153
             ) {
1154 1154
                 continue;
1155 1155
             }
1156 1156
 
1157 1157
             // If they have specified a list of sniffs to exclude, check
1158 1158
             // to see if this sniff is allowed.
1159
-            if (empty($exclusions) === false
1160
-                && isset($exclusions[$compareName]) === true
1159
+            if ( empty( $exclusions ) === false
1160
+                && isset( $exclusions[ $compareName ] ) === true
1161 1161
             ) {
1162 1162
                 continue;
1163 1163
             }
1164 1164
 
1165 1165
             // Skip abstract classes.
1166
-            $reflection = new \ReflectionClass($className);
1167
-            if ($reflection->isAbstract() === true) {
1166
+            $reflection = new \ReflectionClass( $className );
1167
+            if ( $reflection->isAbstract() === true ) {
1168 1168
                 continue;
1169 1169
             }
1170 1170
 
1171
-            $listeners[$className] = $className;
1171
+            $listeners[ $className ] = $className;
1172 1172
 
1173
-            if (PHP_CODESNIFFER_VERBOSITY > 2) {
1174
-                echo "Registered $className".PHP_EOL;
1173
+            if ( PHP_CODESNIFFER_VERBOSITY > 2 ) {
1174
+                echo "Registered $className" . PHP_EOL;
1175 1175
             }
1176 1176
         }//end foreach
1177 1177
 
@@ -1189,67 +1189,67 @@  discard block
 block discarded – undo
1189 1189
     public function populateTokenListeners()
1190 1190
     {
1191 1191
         // Construct a list of listeners indexed by token being listened for.
1192
-        $this->tokenListeners = [];
1192
+        $this->tokenListeners = [ ];
1193 1193
 
1194
-        foreach ($this->sniffs as $sniffClass => $sniffObject) {
1195
-            $this->sniffs[$sniffClass] = null;
1196
-            $this->sniffs[$sniffClass] = new $sniffClass();
1194
+        foreach ( $this->sniffs as $sniffClass => $sniffObject ) {
1195
+            $this->sniffs[ $sniffClass ] = null;
1196
+            $this->sniffs[ $sniffClass ] = new $sniffClass();
1197 1197
 
1198
-            $sniffCode = Util\Common::getSniffCode($sniffClass);
1199
-            $this->sniffCodes[$sniffCode] = $sniffClass;
1198
+            $sniffCode = Util\Common::getSniffCode( $sniffClass );
1199
+            $this->sniffCodes[ $sniffCode ] = $sniffClass;
1200 1200
 
1201 1201
             // Set custom properties.
1202
-            if (isset($this->ruleset[$sniffCode]['properties']) === true) {
1203
-                foreach ($this->ruleset[$sniffCode]['properties'] as $name => $value) {
1204
-                    $this->setSniffProperty($sniffClass, $name, $value);
1202
+            if ( isset( $this->ruleset[ $sniffCode ][ 'properties' ] ) === true ) {
1203
+                foreach ( $this->ruleset[ $sniffCode ][ 'properties' ] as $name => $value ) {
1204
+                    $this->setSniffProperty( $sniffClass, $name, $value );
1205 1205
                 }
1206 1206
             }
1207 1207
 
1208
-            $tokenizers = [];
1209
-            $vars       = get_class_vars($sniffClass);
1210
-            if (isset($vars['supportedTokenizers']) === true) {
1211
-                foreach ($vars['supportedTokenizers'] as $tokenizer) {
1212
-                    $tokenizers[$tokenizer] = $tokenizer;
1208
+            $tokenizers = [ ];
1209
+            $vars       = get_class_vars( $sniffClass );
1210
+            if ( isset( $vars[ 'supportedTokenizers' ] ) === true ) {
1211
+                foreach ( $vars[ 'supportedTokenizers' ] as $tokenizer ) {
1212
+                    $tokenizers[ $tokenizer ] = $tokenizer;
1213 1213
                 }
1214 1214
             } else {
1215
-                $tokenizers = ['PHP' => 'PHP'];
1215
+                $tokenizers = [ 'PHP' => 'PHP' ];
1216 1216
             }
1217 1217
 
1218
-            $tokens = $this->sniffs[$sniffClass]->register();
1219
-            if (is_array($tokens) === false) {
1218
+            $tokens = $this->sniffs[ $sniffClass ]->register();
1219
+            if ( is_array( $tokens ) === false ) {
1220 1220
                 $msg = "Sniff $sniffClass register() method must return an array";
1221
-                throw new RuntimeException($msg);
1221
+                throw new RuntimeException( $msg );
1222 1222
             }
1223 1223
 
1224
-            $ignorePatterns = [];
1225
-            $patterns       = $this->getIgnorePatterns($sniffCode);
1226
-            foreach ($patterns as $pattern => $type) {
1224
+            $ignorePatterns = [ ];
1225
+            $patterns       = $this->getIgnorePatterns( $sniffCode );
1226
+            foreach ( $patterns as $pattern => $type ) {
1227 1227
                 $replacements = [
1228 1228
                     '\\,' => ',',
1229 1229
                     '*'   => '.*',
1230 1230
                 ];
1231 1231
 
1232
-                $ignorePatterns[] = strtr($pattern, $replacements);
1232
+                $ignorePatterns[ ] = strtr( $pattern, $replacements );
1233 1233
             }
1234 1234
 
1235
-            $includePatterns = [];
1236
-            $patterns        = $this->getIncludePatterns($sniffCode);
1237
-            foreach ($patterns as $pattern => $type) {
1235
+            $includePatterns = [ ];
1236
+            $patterns        = $this->getIncludePatterns( $sniffCode );
1237
+            foreach ( $patterns as $pattern => $type ) {
1238 1238
                 $replacements = [
1239 1239
                     '\\,' => ',',
1240 1240
                     '*'   => '.*',
1241 1241
                 ];
1242 1242
 
1243
-                $includePatterns[] = strtr($pattern, $replacements);
1243
+                $includePatterns[ ] = strtr( $pattern, $replacements );
1244 1244
             }
1245 1245
 
1246
-            foreach ($tokens as $token) {
1247
-                if (isset($this->tokenListeners[$token]) === false) {
1248
-                    $this->tokenListeners[$token] = [];
1246
+            foreach ( $tokens as $token ) {
1247
+                if ( isset( $this->tokenListeners[ $token ] ) === false ) {
1248
+                    $this->tokenListeners[ $token ] = [ ];
1249 1249
                 }
1250 1250
 
1251
-                if (isset($this->tokenListeners[$token][$sniffClass]) === false) {
1252
-                    $this->tokenListeners[$token][$sniffClass] = [
1251
+                if ( isset( $this->tokenListeners[ $token ][ $sniffClass ] ) === false ) {
1252
+                    $this->tokenListeners[ $token ][ $sniffClass ] = [
1253 1253
                         'class'      => $sniffClass,
1254 1254
                         'source'     => $sniffCode,
1255 1255
                         'tokenizers' => $tokenizers,
@@ -1272,37 +1272,37 @@  discard block
 block discarded – undo
1272 1272
      *
1273 1273
      * @return void
1274 1274
      */
1275
-    public function setSniffProperty($sniffClass, $name, $value)
1275
+    public function setSniffProperty( $sniffClass, $name, $value )
1276 1276
     {
1277 1277
         // Setting a property for a sniff we are not using.
1278
-        if (isset($this->sniffs[$sniffClass]) === false) {
1278
+        if ( isset( $this->sniffs[ $sniffClass ] ) === false ) {
1279 1279
             return;
1280 1280
         }
1281 1281
 
1282
-        $name = trim($name);
1283
-        if (is_string($value) === true) {
1284
-            $value = trim($value);
1282
+        $name = trim( $name );
1283
+        if ( is_string( $value ) === true ) {
1284
+            $value = trim( $value );
1285 1285
         }
1286 1286
 
1287
-        if ($value === '') {
1287
+        if ( $value === '' ) {
1288 1288
             $value = null;
1289 1289
         }
1290 1290
 
1291 1291
         // Special case for booleans.
1292
-        if ($value === 'true') {
1292
+        if ( $value === 'true' ) {
1293 1293
             $value = true;
1294
-        } else if ($value === 'false') {
1294
+        } else if ( $value === 'false' ) {
1295 1295
             $value = false;
1296
-        } else if (substr($name, -2) === '[]') {
1297
-            $name   = substr($name, 0, -2);
1298
-            $values = [];
1299
-            if ($value !== null) {
1300
-                foreach (explode(',', $value) as $val) {
1301
-                    list($k, $v) = explode('=>', $val.'=>');
1302
-                    if ($v !== '') {
1303
-                        $values[trim($k)] = trim($v);
1296
+        } else if ( substr( $name, -2 ) === '[]' ) {
1297
+            $name   = substr( $name, 0, -2 );
1298
+            $values = [ ];
1299
+            if ( $value !== null ) {
1300
+                foreach ( explode( ',', $value ) as $val ) {
1301
+                    list( $k, $v ) = explode( '=>', $val . '=>' );
1302
+                    if ( $v !== '' ) {
1303
+                        $values[ trim( $k ) ] = trim( $v );
1304 1304
                     } else {
1305
-                        $values[] = trim($k);
1305
+                        $values[ ] = trim( $k );
1306 1306
                     }
1307 1307
                 }
1308 1308
             }
@@ -1310,7 +1310,7 @@  discard block
 block discarded – undo
1310 1310
             $value = $values;
1311 1311
         }
1312 1312
 
1313
-        $this->sniffs[$sniffClass]->$name = $value;
1313
+        $this->sniffs[ $sniffClass ]->$name = $value;
1314 1314
 
1315 1315
     }//end setSniffProperty()
1316 1316
 
@@ -1326,17 +1326,17 @@  discard block
 block discarded – undo
1326 1326
      *
1327 1327
      * @return array
1328 1328
      */
1329
-    public function getIgnorePatterns($listener=null)
1329
+    public function getIgnorePatterns( $listener = null )
1330 1330
     {
1331
-        if ($listener === null) {
1331
+        if ( $listener === null ) {
1332 1332
             return $this->ignorePatterns;
1333 1333
         }
1334 1334
 
1335
-        if (isset($this->ignorePatterns[$listener]) === true) {
1336
-            return $this->ignorePatterns[$listener];
1335
+        if ( isset( $this->ignorePatterns[ $listener ] ) === true ) {
1336
+            return $this->ignorePatterns[ $listener ];
1337 1337
         }
1338 1338
 
1339
-        return [];
1339
+        return [ ];
1340 1340
 
1341 1341
     }//end getIgnorePatterns()
1342 1342
 
@@ -1352,17 +1352,17 @@  discard block
 block discarded – undo
1352 1352
      *
1353 1353
      * @return array
1354 1354
      */
1355
-    public function getIncludePatterns($listener=null)
1355
+    public function getIncludePatterns( $listener = null )
1356 1356
     {
1357
-        if ($listener === null) {
1357
+        if ( $listener === null ) {
1358 1358
             return $this->includePatterns;
1359 1359
         }
1360 1360
 
1361
-        if (isset($this->includePatterns[$listener]) === true) {
1362
-            return $this->includePatterns[$listener];
1361
+        if ( isset( $this->includePatterns[ $listener ] ) === true ) {
1362
+            return $this->includePatterns[ $listener ];
1363 1363
         }
1364 1364
 
1365
-        return [];
1365
+        return [ ];
1366 1366
 
1367 1367
     }//end getIncludePatterns()
1368 1368
 
Please login to merge, or discard this patch.
vendor/squizlabs/php_codesniffer/src/Config.php 1 patch
Spacing   +616 added lines, -616 removed lines patch added patch discarded remove patch
@@ -151,14 +151,14 @@  discard block
 block discarded – undo
151 151
      *
152 152
      * @var string[]
153 153
      */
154
-    private $cliArgs = [];
154
+    private $cliArgs = [ ];
155 155
 
156 156
     /**
157 157
      * Command line values that the user has supplied directly.
158 158
      *
159 159
      * @var array<string, TRUE>
160 160
      */
161
-    private static $overriddenDefaults = [];
161
+    private static $overriddenDefaults = [ ];
162 162
 
163 163
     /**
164 164
      * Config file data that has been loaded for the run.
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
      *
180 180
      * @var array<string, string>
181 181
      */
182
-    private static $executablePaths = [];
182
+    private static $executablePaths = [ ];
183 183
 
184 184
 
185 185
     /**
@@ -190,13 +190,13 @@  discard block
 block discarded – undo
190 190
      * @return mixed
191 191
      * @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the setting name is invalid.
192 192
      */
193
-    public function __get($name)
193
+    public function __get( $name )
194 194
     {
195
-        if (array_key_exists($name, $this->settings) === false) {
196
-            throw new RuntimeException("ERROR: unable to get value of property \"$name\"");
195
+        if ( array_key_exists( $name, $this->settings ) === false ) {
196
+            throw new RuntimeException( "ERROR: unable to get value of property \"$name\"" );
197 197
         }
198 198
 
199
-        return $this->settings[$name];
199
+        return $this->settings[ $name ];
200 200
 
201 201
     }//end __get()
202 202
 
@@ -210,35 +210,35 @@  discard block
 block discarded – undo
210 210
      * @return void
211 211
      * @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the setting name is invalid.
212 212
      */
213
-    public function __set($name, $value)
213
+    public function __set( $name, $value )
214 214
     {
215
-        if (array_key_exists($name, $this->settings) === false) {
216
-            throw new RuntimeException("Can't __set() $name; setting doesn't exist");
215
+        if ( array_key_exists( $name, $this->settings ) === false ) {
216
+            throw new RuntimeException( "Can't __set() $name; setting doesn't exist" );
217 217
         }
218 218
 
219
-        switch ($name) {
219
+        switch ( $name ) {
220 220
         case 'reportWidth' :
221 221
             // Support auto terminal width.
222
-            if ($value === 'auto' && preg_match('|\d+ (\d+)|', shell_exec('stty size 2>&1'), $matches) === 1) {
223
-                $value = (int) $matches[1];
222
+            if ( $value === 'auto' && preg_match( '|\d+ (\d+)|', shell_exec( 'stty size 2>&1' ), $matches ) === 1 ) {
223
+                $value = (int)$matches[ 1 ];
224 224
             } else {
225
-                $value = (int) $value;
225
+                $value = (int)$value;
226 226
             }
227 227
             break;
228 228
         case 'standards' :
229
-            $cleaned = [];
229
+            $cleaned = [ ];
230 230
 
231 231
             // Check if the standard name is valid, or if the case is invalid.
232 232
             $installedStandards = Util\Standards::getInstalledStandards();
233
-            foreach ($value as $standard) {
234
-                foreach ($installedStandards as $validStandard) {
235
-                    if (strtolower($standard) === strtolower($validStandard)) {
233
+            foreach ( $value as $standard ) {
234
+                foreach ( $installedStandards as $validStandard ) {
235
+                    if ( strtolower( $standard ) === strtolower( $validStandard ) ) {
236 236
                         $standard = $validStandard;
237 237
                         break;
238 238
                     }
239 239
                 }
240 240
 
241
-                $cleaned[] = $standard;
241
+                $cleaned[ ] = $standard;
242 242
             }
243 243
 
244 244
             $value = $cleaned;
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
             break;
249 249
         }//end switch
250 250
 
251
-        $this->settings[$name] = $value;
251
+        $this->settings[ $name ] = $value;
252 252
 
253 253
     }//end __set()
254 254
 
@@ -260,9 +260,9 @@  discard block
 block discarded – undo
260 260
      *
261 261
      * @return bool
262 262
      */
263
-    public function __isset($name)
263
+    public function __isset( $name )
264 264
     {
265
-        return isset($this->settings[$name]);
265
+        return isset( $this->settings[ $name ] );
266 266
 
267 267
     }//end __isset()
268 268
 
@@ -274,9 +274,9 @@  discard block
 block discarded – undo
274 274
      *
275 275
      * @return void
276 276
      */
277
-    public function __unset($name)
277
+    public function __unset( $name )
278 278
     {
279
-        $this->settings[$name] = null;
279
+        $this->settings[ $name ] = null;
280 280
 
281 281
     }//end __unset()
282 282
 
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
      *
301 301
      * @return void
302 302
      */
303
-    public function setSettings($settings)
303
+    public function setSettings( $settings )
304 304
     {
305 305
         return $this->settings = $settings;
306 306
 
@@ -316,9 +316,9 @@  discard block
 block discarded – undo
316 316
      *
317 317
      * @return void
318 318
      */
319
-    public function __construct(array $cliArgs=[], $dieOnUnknownArg=true)
319
+    public function __construct( array $cliArgs = [ ], $dieOnUnknownArg = true )
320 320
     {
321
-        if (defined('PHP_CODESNIFFER_IN_TESTS') === true) {
321
+        if ( defined( 'PHP_CODESNIFFER_IN_TESTS' ) === true ) {
322 322
             // Let everything through during testing so that we can
323 323
             // make use of PHPUnit command line arguments as well.
324 324
             $this->dieOnUnknownArg = false;
@@ -326,15 +326,15 @@  discard block
 block discarded – undo
326 326
             $this->dieOnUnknownArg = $dieOnUnknownArg;
327 327
         }
328 328
 
329
-        if (empty($cliArgs) === true) {
330
-            $cliArgs = $_SERVER['argv'];
331
-            array_shift($cliArgs);
329
+        if ( empty( $cliArgs ) === true ) {
330
+            $cliArgs = $_SERVER[ 'argv' ];
331
+            array_shift( $cliArgs );
332 332
         }
333 333
 
334 334
         $this->restoreDefaults();
335
-        $this->setCommandLineValues($cliArgs);
335
+        $this->setCommandLineValues( $cliArgs );
336 336
 
337
-        if (isset(self::$overriddenDefaults['standards']) === false) {
337
+        if ( isset( self::$overriddenDefaults[ 'standards' ] ) === false ) {
338 338
             // They did not supply a standard to use.
339 339
             // Look for a default ruleset in the current directory or higher.
340 340
             $currentDir = getcwd();
@@ -347,54 +347,54 @@  discard block
 block discarded – undo
347 347
             ];
348 348
 
349 349
             do {
350
-                foreach ($defaultFiles as $defaultFilename) {
351
-                    $default = $currentDir.DIRECTORY_SEPARATOR.$defaultFilename;
352
-                    if (is_file($default) === true) {
353
-                        $this->standards = [$default];
354
-                        break(2);
350
+                foreach ( $defaultFiles as $defaultFilename ) {
351
+                    $default = $currentDir . DIRECTORY_SEPARATOR . $defaultFilename;
352
+                    if ( is_file( $default ) === true ) {
353
+                        $this->standards = [ $default ];
354
+                        break( 2 );
355 355
                     }
356 356
                 }
357 357
 
358 358
                 $lastDir    = $currentDir;
359
-                $currentDir = dirname($currentDir);
360
-            } while ($currentDir !== '.' && $currentDir !== $lastDir);
359
+                $currentDir = dirname( $currentDir );
360
+            } while ( $currentDir !== '.' && $currentDir !== $lastDir );
361 361
         }//end if
362 362
 
363
-        if (defined('STDIN') === false
364
-            || strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'
363
+        if ( defined( 'STDIN' ) === false
364
+            || strtoupper( substr( PHP_OS, 0, 3 ) ) === 'WIN'
365 365
         ) {
366 366
             return;
367 367
         }
368 368
 
369
-        $handle = fopen('php://stdin', 'r');
369
+        $handle = fopen( 'php://stdin', 'r' );
370 370
 
371 371
         // Check for content on STDIN.
372
-        if ($this->stdin === true
373
-            || (Util\Common::isStdinATTY() === false
374
-            && feof($handle) === false)
372
+        if ( $this->stdin === true
373
+            || ( Util\Common::isStdinATTY() === false
374
+            && feof( $handle ) === false )
375 375
         ) {
376
-            $readStreams = [$handle];
376
+            $readStreams = [ $handle ];
377 377
             $writeSteams = null;
378 378
 
379 379
             $fileContents = '';
380
-            while (is_resource($handle) === true && feof($handle) === false) {
380
+            while ( is_resource( $handle ) === true && feof( $handle ) === false ) {
381 381
                 // Set a timeout of 200ms.
382
-                if (stream_select($readStreams, $writeSteams, $writeSteams, 0, 200000) === 0) {
382
+                if ( stream_select( $readStreams, $writeSteams, $writeSteams, 0, 200000 ) === 0 ) {
383 383
                     break;
384 384
                 }
385 385
 
386
-                $fileContents .= fgets($handle);
386
+                $fileContents .= fgets( $handle );
387 387
             }
388 388
 
389
-            if (trim($fileContents) !== '') {
389
+            if ( trim( $fileContents ) !== '' ) {
390 390
                 $this->stdin        = true;
391 391
                 $this->stdinContent = $fileContents;
392
-                self::$overriddenDefaults['stdin']        = true;
393
-                self::$overriddenDefaults['stdinContent'] = true;
392
+                self::$overriddenDefaults[ 'stdin' ]        = true;
393
+                self::$overriddenDefaults[ 'stdinContent' ] = true;
394 394
             }
395 395
         }//end if
396 396
 
397
-        fclose($handle);
397
+        fclose( $handle );
398 398
 
399 399
     }//end __construct()
400 400
 
@@ -406,44 +406,44 @@  discard block
 block discarded – undo
406 406
      *
407 407
      * @return void
408 408
      */
409
-    public function setCommandLineValues($args)
409
+    public function setCommandLineValues( $args )
410 410
     {
411 411
         $this->cliArgs = $args;
412
-        $numArgs       = count($args);
412
+        $numArgs       = count( $args );
413 413
 
414
-        for ($i = 0; $i < $numArgs; $i++) {
415
-            $arg = $this->cliArgs[$i];
416
-            if ($arg === '') {
414
+        for ( $i = 0; $i < $numArgs; $i++ ) {
415
+            $arg = $this->cliArgs[ $i ];
416
+            if ( $arg === '' ) {
417 417
                 continue;
418 418
             }
419 419
 
420
-            if ($arg{0} === '-') {
421
-                if ($arg === '-') {
420
+            if ( $arg{0} === '-' ) {
421
+                if ( $arg === '-' ) {
422 422
                     // Asking to read from STDIN.
423 423
                     $this->stdin = true;
424
-                    self::$overriddenDefaults['stdin'] = true;
424
+                    self::$overriddenDefaults[ 'stdin' ] = true;
425 425
                     continue;
426 426
                 }
427 427
 
428
-                if ($arg === '--') {
428
+                if ( $arg === '--' ) {
429 429
                     // Empty argument, ignore it.
430 430
                     continue;
431 431
                 }
432 432
 
433
-                if ($arg{1} === '-') {
434
-                    $this->processLongArgument(substr($arg, 2), $i);
433
+                if ( $arg{1} === '-' ) {
434
+                    $this->processLongArgument( substr( $arg, 2 ), $i );
435 435
                 } else {
436
-                    $switches = str_split($arg);
437
-                    foreach ($switches as $switch) {
438
-                        if ($switch === '-') {
436
+                    $switches = str_split( $arg );
437
+                    foreach ( $switches as $switch ) {
438
+                        if ( $switch === '-' ) {
439 439
                             continue;
440 440
                         }
441 441
 
442
-                        $this->processShortArgument($switch, $i);
442
+                        $this->processShortArgument( $switch, $i );
443 443
                     }
444 444
                 }
445 445
             } else {
446
-                $this->processUnknownArgument($arg, $i);
446
+                $this->processUnknownArgument( $arg, $i );
447 447
             }//end if
448 448
         }//end for
449 449
 
@@ -457,8 +457,8 @@  discard block
 block discarded – undo
457 457
      */
458 458
     public function restoreDefaults()
459 459
     {
460
-        $this->files           = [];
461
-        $this->standards       = ['PEAR'];
460
+        $this->files           = [ ];
461
+        $this->standards       = [ 'PEAR' ];
462 462
         $this->verbosity       = 0;
463 463
         $this->interactive     = false;
464 464
         $this->cache           = false;
@@ -479,15 +479,15 @@  discard block
 block discarded – undo
479 479
             'js'  => 'JS',
480 480
             'css' => 'CSS',
481 481
         ];
482
-        $this->sniffs          = [];
483
-        $this->exclude         = [];
484
-        $this->ignored         = [];
482
+        $this->sniffs          = [ ];
483
+        $this->exclude         = [ ];
484
+        $this->ignored         = [ ];
485 485
         $this->reportFile      = null;
486 486
         $this->generator       = null;
487 487
         $this->filter          = null;
488
-        $this->bootstrap       = [];
488
+        $this->bootstrap       = [ ];
489 489
         $this->basepath        = null;
490
-        $this->reports         = ['full' => null];
490
+        $this->reports         = [ 'full' => null ];
491 491
         $this->reportWidth     = 'auto';
492 492
         $this->errorSeverity   = 5;
493 493
         $this->warningSeverity = 5;
@@ -496,81 +496,81 @@  discard block
 block discarded – undo
496 496
         $this->stdin           = false;
497 497
         $this->stdinContent    = null;
498 498
         $this->stdinPath       = null;
499
-        $this->unknown         = [];
499
+        $this->unknown         = [ ];
500 500
 
501
-        $standard = self::getConfigData('default_standard');
502
-        if ($standard !== null) {
503
-            $this->standards = explode(',', $standard);
501
+        $standard = self::getConfigData( 'default_standard' );
502
+        if ( $standard !== null ) {
503
+            $this->standards = explode( ',', $standard );
504 504
         }
505 505
 
506
-        $reportFormat = self::getConfigData('report_format');
507
-        if ($reportFormat !== null) {
508
-            $this->reports = [$reportFormat => null];
506
+        $reportFormat = self::getConfigData( 'report_format' );
507
+        if ( $reportFormat !== null ) {
508
+            $this->reports = [ $reportFormat => null ];
509 509
         }
510 510
 
511
-        $tabWidth = self::getConfigData('tab_width');
512
-        if ($tabWidth !== null) {
513
-            $this->tabWidth = (int) $tabWidth;
511
+        $tabWidth = self::getConfigData( 'tab_width' );
512
+        if ( $tabWidth !== null ) {
513
+            $this->tabWidth = (int)$tabWidth;
514 514
         }
515 515
 
516
-        $encoding = self::getConfigData('encoding');
517
-        if ($encoding !== null) {
518
-            $this->encoding = strtolower($encoding);
516
+        $encoding = self::getConfigData( 'encoding' );
517
+        if ( $encoding !== null ) {
518
+            $this->encoding = strtolower( $encoding );
519 519
         }
520 520
 
521
-        $severity = self::getConfigData('severity');
522
-        if ($severity !== null) {
523
-            $this->errorSeverity   = (int) $severity;
524
-            $this->warningSeverity = (int) $severity;
521
+        $severity = self::getConfigData( 'severity' );
522
+        if ( $severity !== null ) {
523
+            $this->errorSeverity   = (int)$severity;
524
+            $this->warningSeverity = (int)$severity;
525 525
         }
526 526
 
527
-        $severity = self::getConfigData('error_severity');
528
-        if ($severity !== null) {
529
-            $this->errorSeverity = (int) $severity;
527
+        $severity = self::getConfigData( 'error_severity' );
528
+        if ( $severity !== null ) {
529
+            $this->errorSeverity = (int)$severity;
530 530
         }
531 531
 
532
-        $severity = self::getConfigData('warning_severity');
533
-        if ($severity !== null) {
534
-            $this->warningSeverity = (int) $severity;
532
+        $severity = self::getConfigData( 'warning_severity' );
533
+        if ( $severity !== null ) {
534
+            $this->warningSeverity = (int)$severity;
535 535
         }
536 536
 
537
-        $showWarnings = self::getConfigData('show_warnings');
538
-        if ($showWarnings !== null) {
539
-            $showWarnings = (bool) $showWarnings;
540
-            if ($showWarnings === false) {
537
+        $showWarnings = self::getConfigData( 'show_warnings' );
538
+        if ( $showWarnings !== null ) {
539
+            $showWarnings = (bool)$showWarnings;
540
+            if ( $showWarnings === false ) {
541 541
                 $this->warningSeverity = 0;
542 542
             }
543 543
         }
544 544
 
545
-        $reportWidth = self::getConfigData('report_width');
546
-        if ($reportWidth !== null) {
545
+        $reportWidth = self::getConfigData( 'report_width' );
546
+        if ( $reportWidth !== null ) {
547 547
             $this->reportWidth = $reportWidth;
548 548
         }
549 549
 
550
-        $showProgress = self::getConfigData('show_progress');
551
-        if ($showProgress !== null) {
552
-            $this->showProgress = (bool) $showProgress;
550
+        $showProgress = self::getConfigData( 'show_progress' );
551
+        if ( $showProgress !== null ) {
552
+            $this->showProgress = (bool)$showProgress;
553 553
         }
554 554
 
555
-        $quiet = self::getConfigData('quiet');
556
-        if ($quiet !== null) {
557
-            $this->quiet = (bool) $quiet;
555
+        $quiet = self::getConfigData( 'quiet' );
556
+        if ( $quiet !== null ) {
557
+            $this->quiet = (bool)$quiet;
558 558
         }
559 559
 
560
-        $colors = self::getConfigData('colors');
561
-        if ($colors !== null) {
562
-            $this->colors = (bool) $colors;
560
+        $colors = self::getConfigData( 'colors' );
561
+        if ( $colors !== null ) {
562
+            $this->colors = (bool)$colors;
563 563
         }
564 564
 
565
-        if (defined('PHP_CODESNIFFER_IN_TESTS') === false) {
566
-            $cache = self::getConfigData('cache');
567
-            if ($cache !== null) {
568
-                $this->cache = (bool) $cache;
565
+        if ( defined( 'PHP_CODESNIFFER_IN_TESTS' ) === false ) {
566
+            $cache = self::getConfigData( 'cache' );
567
+            if ( $cache !== null ) {
568
+                $this->cache = (bool)$cache;
569 569
             }
570 570
 
571
-            $parallel = self::getConfigData('parallel');
572
-            if ($parallel !== null) {
573
-                $this->parallel = max((int) $parallel, 1);
571
+            $parallel = self::getConfigData( 'parallel' );
572
+            if ( $parallel !== null ) {
573
+                $this->parallel = max( (int)$parallel, 1 );
574 574
             }
575 575
         }
576 576
 
@@ -585,55 +585,55 @@  discard block
 block discarded – undo
585 585
      *
586 586
      * @return void
587 587
      */
588
-    public function processShortArgument($arg, $pos)
588
+    public function processShortArgument( $arg, $pos )
589 589
     {
590
-        switch ($arg) {
590
+        switch ( $arg ) {
591 591
         case 'h':
592 592
         case '?':
593 593
             ob_start();
594 594
             $this->printUsage();
595 595
             $output = ob_get_contents();
596 596
             ob_end_clean();
597
-            throw new DeepExitException($output, 0);
597
+            throw new DeepExitException( $output, 0 );
598 598
         case 'i' :
599 599
             ob_start();
600 600
             Util\Standards::printInstalledStandards();
601 601
             $output = ob_get_contents();
602 602
             ob_end_clean();
603
-            throw new DeepExitException($output, 0);
603
+            throw new DeepExitException( $output, 0 );
604 604
         case 'v' :
605
-            if ($this->quiet === true) {
605
+            if ( $this->quiet === true ) {
606 606
                 // Ignore when quiet mode is enabled.
607 607
                 break;
608 608
             }
609 609
 
610 610
             $this->verbosity++;
611
-            self::$overriddenDefaults['verbosity'] = true;
611
+            self::$overriddenDefaults[ 'verbosity' ] = true;
612 612
             break;
613 613
         case 'l' :
614 614
             $this->local = true;
615
-            self::$overriddenDefaults['local'] = true;
615
+            self::$overriddenDefaults[ 'local' ] = true;
616 616
             break;
617 617
         case 's' :
618 618
             $this->showSources = true;
619
-            self::$overriddenDefaults['showSources'] = true;
619
+            self::$overriddenDefaults[ 'showSources' ] = true;
620 620
             break;
621 621
         case 'a' :
622 622
             $this->interactive = true;
623
-            self::$overriddenDefaults['interactive'] = true;
623
+            self::$overriddenDefaults[ 'interactive' ] = true;
624 624
             break;
625 625
         case 'e':
626 626
             $this->explain = true;
627
-            self::$overriddenDefaults['explain'] = true;
627
+            self::$overriddenDefaults[ 'explain' ] = true;
628 628
             break;
629 629
         case 'p' :
630
-            if ($this->quiet === true) {
630
+            if ( $this->quiet === true ) {
631 631
                 // Ignore when quiet mode is enabled.
632 632
                 break;
633 633
             }
634 634
 
635 635
             $this->showProgress = true;
636
-            self::$overriddenDefaults['showProgress'] = true;
636
+            self::$overriddenDefaults[ 'showProgress' ] = true;
637 637
             break;
638 638
         case 'q' :
639 639
             // Quiet mode disables a few other settings as well.
@@ -641,40 +641,40 @@  discard block
 block discarded – undo
641 641
             $this->showProgress = false;
642 642
             $this->verbosity    = 0;
643 643
 
644
-            self::$overriddenDefaults['quiet'] = true;
644
+            self::$overriddenDefaults[ 'quiet' ] = true;
645 645
             break;
646 646
         case 'm' :
647 647
             $this->recordErrors = false;
648
-            self::$overriddenDefaults['recordErrors'] = true;
648
+            self::$overriddenDefaults[ 'recordErrors' ] = true;
649 649
             break;
650 650
         case 'd' :
651
-            $ini = explode('=', $this->cliArgs[($pos + 1)]);
652
-            $this->cliArgs[($pos + 1)] = '';
653
-            if (isset($ini[1]) === true) {
654
-                ini_set($ini[0], $ini[1]);
651
+            $ini = explode( '=', $this->cliArgs[ ( $pos + 1 ) ] );
652
+            $this->cliArgs[ ( $pos + 1 ) ] = '';
653
+            if ( isset( $ini[ 1 ] ) === true ) {
654
+                ini_set( $ini[ 0 ], $ini[ 1 ] );
655 655
             } else {
656
-                ini_set($ini[0], true);
656
+                ini_set( $ini[ 0 ], true );
657 657
             }
658 658
             break;
659 659
         case 'n' :
660
-            if (isset(self::$overriddenDefaults['warningSeverity']) === false) {
660
+            if ( isset( self::$overriddenDefaults[ 'warningSeverity' ] ) === false ) {
661 661
                 $this->warningSeverity = 0;
662
-                self::$overriddenDefaults['warningSeverity'] = true;
662
+                self::$overriddenDefaults[ 'warningSeverity' ] = true;
663 663
             }
664 664
             break;
665 665
         case 'w' :
666
-            if (isset(self::$overriddenDefaults['warningSeverity']) === false) {
666
+            if ( isset( self::$overriddenDefaults[ 'warningSeverity' ] ) === false ) {
667 667
                 $this->warningSeverity = $this->errorSeverity;
668
-                self::$overriddenDefaults['warningSeverity'] = true;
668
+                self::$overriddenDefaults[ 'warningSeverity' ] = true;
669 669
             }
670 670
             break;
671 671
         default:
672
-            if ($this->dieOnUnknownArg === false) {
672
+            if ( $this->dieOnUnknownArg === false ) {
673 673
                 $unknown       = $this->unknown;
674
-                $unknown[]     = $arg;
674
+                $unknown[ ]     = $arg;
675 675
                 $this->unknown = $unknown;
676 676
             } else {
677
-                $this->processUnknownArgument('-'.$arg, $pos);
677
+                $this->processUnknownArgument( '-' . $arg, $pos );
678 678
             }
679 679
         }//end switch
680 680
 
@@ -689,488 +689,488 @@  discard block
 block discarded – undo
689 689
      *
690 690
      * @return void
691 691
      */
692
-    public function processLongArgument($arg, $pos)
692
+    public function processLongArgument( $arg, $pos )
693 693
     {
694
-        switch ($arg) {
694
+        switch ( $arg ) {
695 695
         case 'help':
696 696
             ob_start();
697 697
             $this->printUsage();
698 698
             $output = ob_get_contents();
699 699
             ob_end_clean();
700
-            throw new DeepExitException($output, 0);
700
+            throw new DeepExitException( $output, 0 );
701 701
         case 'version':
702
-            $output  = 'PHP_CodeSniffer version '.self::VERSION.' ('.self::STABILITY.') ';
703
-            $output .= 'by Squiz (http://www.squiz.net)'.PHP_EOL;
704
-            throw new DeepExitException($output, 0);
702
+            $output  = 'PHP_CodeSniffer version ' . self::VERSION . ' (' . self::STABILITY . ') ';
703
+            $output .= 'by Squiz (http://www.squiz.net)' . PHP_EOL;
704
+            throw new DeepExitException( $output, 0 );
705 705
         case 'colors':
706
-            if (isset(self::$overriddenDefaults['colors']) === true) {
706
+            if ( isset( self::$overriddenDefaults[ 'colors' ] ) === true ) {
707 707
                 break;
708 708
             }
709 709
 
710 710
             $this->colors = true;
711
-            self::$overriddenDefaults['colors'] = true;
711
+            self::$overriddenDefaults[ 'colors' ] = true;
712 712
             break;
713 713
         case 'no-colors':
714
-            if (isset(self::$overriddenDefaults['colors']) === true) {
714
+            if ( isset( self::$overriddenDefaults[ 'colors' ] ) === true ) {
715 715
                 break;
716 716
             }
717 717
 
718 718
             $this->colors = false;
719
-            self::$overriddenDefaults['colors'] = true;
719
+            self::$overriddenDefaults[ 'colors' ] = true;
720 720
             break;
721 721
         case 'cache':
722
-            if (isset(self::$overriddenDefaults['cache']) === true) {
722
+            if ( isset( self::$overriddenDefaults[ 'cache' ] ) === true ) {
723 723
                 break;
724 724
             }
725 725
 
726
-            if (defined('PHP_CODESNIFFER_IN_TESTS') === false) {
726
+            if ( defined( 'PHP_CODESNIFFER_IN_TESTS' ) === false ) {
727 727
                 $this->cache = true;
728
-                self::$overriddenDefaults['cache'] = true;
728
+                self::$overriddenDefaults[ 'cache' ] = true;
729 729
             }
730 730
             break;
731 731
         case 'no-cache':
732
-            if (isset(self::$overriddenDefaults['cache']) === true) {
732
+            if ( isset( self::$overriddenDefaults[ 'cache' ] ) === true ) {
733 733
                 break;
734 734
             }
735 735
 
736 736
             $this->cache = false;
737
-            self::$overriddenDefaults['cache'] = true;
737
+            self::$overriddenDefaults[ 'cache' ] = true;
738 738
             break;
739 739
         case 'ignore-annotations':
740
-            if (isset(self::$overriddenDefaults['annotations']) === true) {
740
+            if ( isset( self::$overriddenDefaults[ 'annotations' ] ) === true ) {
741 741
                 break;
742 742
             }
743 743
 
744 744
             $this->annotations = false;
745
-            self::$overriddenDefaults['annotations'] = true;
745
+            self::$overriddenDefaults[ 'annotations' ] = true;
746 746
             break;
747 747
         case 'config-set':
748
-            if (isset($this->cliArgs[($pos + 1)]) === false
749
-                || isset($this->cliArgs[($pos + 2)]) === false
748
+            if ( isset( $this->cliArgs[ ( $pos + 1 ) ] ) === false
749
+                || isset( $this->cliArgs[ ( $pos + 2 ) ] ) === false
750 750
             ) {
751
-                $error  = 'ERROR: Setting a config option requires a name and value'.PHP_EOL.PHP_EOL;
752
-                $error .= $this->printShortUsage(true);
753
-                throw new DeepExitException($error, 3);
751
+                $error  = 'ERROR: Setting a config option requires a name and value' . PHP_EOL . PHP_EOL;
752
+                $error .= $this->printShortUsage( true );
753
+                throw new DeepExitException( $error, 3 );
754 754
             }
755 755
 
756
-            $key     = $this->cliArgs[($pos + 1)];
757
-            $value   = $this->cliArgs[($pos + 2)];
758
-            $current = self::getConfigData($key);
756
+            $key     = $this->cliArgs[ ( $pos + 1 ) ];
757
+            $value   = $this->cliArgs[ ( $pos + 2 ) ];
758
+            $current = self::getConfigData( $key );
759 759
 
760 760
             try {
761
-                $this->setConfigData($key, $value);
762
-            } catch (\Exception $e) {
763
-                throw new DeepExitException($e->getMessage().PHP_EOL, 3);
761
+                $this->setConfigData( $key, $value );
762
+            } catch ( \Exception $e ) {
763
+                throw new DeepExitException( $e->getMessage() . PHP_EOL, 3 );
764 764
             }
765 765
 
766
-            $output = 'Using config file: '.self::$configDataFile.PHP_EOL.PHP_EOL;
766
+            $output = 'Using config file: ' . self::$configDataFile . PHP_EOL . PHP_EOL;
767 767
 
768
-            if ($current === null) {
769
-                $output .= "Config value \"$key\" added successfully".PHP_EOL;
768
+            if ( $current === null ) {
769
+                $output .= "Config value \"$key\" added successfully" . PHP_EOL;
770 770
             } else {
771
-                $output .= "Config value \"$key\" updated successfully; old value was \"$current\"".PHP_EOL;
771
+                $output .= "Config value \"$key\" updated successfully; old value was \"$current\"" . PHP_EOL;
772 772
             }
773
-            throw new DeepExitException($output, 0);
773
+            throw new DeepExitException( $output, 0 );
774 774
         case 'config-delete':
775
-            if (isset($this->cliArgs[($pos + 1)]) === false) {
776
-                $error  = 'ERROR: Deleting a config option requires the name of the option'.PHP_EOL.PHP_EOL;
777
-                $error .= $this->printShortUsage(true);
778
-                throw new DeepExitException($error, 3);
775
+            if ( isset( $this->cliArgs[ ( $pos + 1 ) ] ) === false ) {
776
+                $error  = 'ERROR: Deleting a config option requires the name of the option' . PHP_EOL . PHP_EOL;
777
+                $error .= $this->printShortUsage( true );
778
+                throw new DeepExitException( $error, 3 );
779 779
             }
780 780
 
781
-            $output = 'Using config file: '.self::$configDataFile.PHP_EOL.PHP_EOL;
781
+            $output = 'Using config file: ' . self::$configDataFile . PHP_EOL . PHP_EOL;
782 782
 
783
-            $key     = $this->cliArgs[($pos + 1)];
784
-            $current = self::getConfigData($key);
785
-            if ($current === null) {
786
-                $output .= "Config value \"$key\" has not been set".PHP_EOL;
783
+            $key     = $this->cliArgs[ ( $pos + 1 ) ];
784
+            $current = self::getConfigData( $key );
785
+            if ( $current === null ) {
786
+                $output .= "Config value \"$key\" has not been set" . PHP_EOL;
787 787
             } else {
788 788
                 try {
789
-                    $this->setConfigData($key, null);
790
-                } catch (\Exception $e) {
791
-                    throw new DeepExitException($e->getMessage().PHP_EOL, 3);
789
+                    $this->setConfigData( $key, null );
790
+                } catch ( \Exception $e ) {
791
+                    throw new DeepExitException( $e->getMessage() . PHP_EOL, 3 );
792 792
                 }
793 793
 
794
-                $output .= "Config value \"$key\" removed successfully; old value was \"$current\"".PHP_EOL;
794
+                $output .= "Config value \"$key\" removed successfully; old value was \"$current\"" . PHP_EOL;
795 795
             }
796
-            throw new DeepExitException($output, 0);
796
+            throw new DeepExitException( $output, 0 );
797 797
         case 'config-show':
798 798
             ob_start();
799 799
             $data = self::getAllConfigData();
800
-            echo 'Using config file: '.self::$configDataFile.PHP_EOL.PHP_EOL;
801
-            $this->printConfigData($data);
800
+            echo 'Using config file: ' . self::$configDataFile . PHP_EOL . PHP_EOL;
801
+            $this->printConfigData( $data );
802 802
             $output = ob_get_contents();
803 803
             ob_end_clean();
804
-            throw new DeepExitException($output, 0);
804
+            throw new DeepExitException( $output, 0 );
805 805
         case 'runtime-set':
806
-            if (isset($this->cliArgs[($pos + 1)]) === false
807
-                || isset($this->cliArgs[($pos + 2)]) === false
806
+            if ( isset( $this->cliArgs[ ( $pos + 1 ) ] ) === false
807
+                || isset( $this->cliArgs[ ( $pos + 2 ) ] ) === false
808 808
             ) {
809
-                $error  = 'ERROR: Setting a runtime config option requires a name and value'.PHP_EOL.PHP_EOL;
810
-                $error .= $this->printShortUsage(true);
811
-                throw new DeepExitException($error, 3);
809
+                $error  = 'ERROR: Setting a runtime config option requires a name and value' . PHP_EOL . PHP_EOL;
810
+                $error .= $this->printShortUsage( true );
811
+                throw new DeepExitException( $error, 3 );
812 812
             }
813 813
 
814
-            $key   = $this->cliArgs[($pos + 1)];
815
-            $value = $this->cliArgs[($pos + 2)];
816
-            $this->cliArgs[($pos + 1)] = '';
817
-            $this->cliArgs[($pos + 2)] = '';
818
-            self::setConfigData($key, $value, true);
819
-            if (isset(self::$overriddenDefaults['runtime-set']) === false) {
820
-                self::$overriddenDefaults['runtime-set'] = [];
814
+            $key   = $this->cliArgs[ ( $pos + 1 ) ];
815
+            $value = $this->cliArgs[ ( $pos + 2 ) ];
816
+            $this->cliArgs[ ( $pos + 1 ) ] = '';
817
+            $this->cliArgs[ ( $pos + 2 ) ] = '';
818
+            self::setConfigData( $key, $value, true );
819
+            if ( isset( self::$overriddenDefaults[ 'runtime-set' ] ) === false ) {
820
+                self::$overriddenDefaults[ 'runtime-set' ] = [ ];
821 821
             }
822 822
 
823
-            self::$overriddenDefaults['runtime-set'][$key] = true;
823
+            self::$overriddenDefaults[ 'runtime-set' ][ $key ] = true;
824 824
             break;
825 825
         default:
826
-            if (substr($arg, 0, 7) === 'sniffs=') {
827
-                if (isset(self::$overriddenDefaults['sniffs']) === true) {
826
+            if ( substr( $arg, 0, 7 ) === 'sniffs=' ) {
827
+                if ( isset( self::$overriddenDefaults[ 'sniffs' ] ) === true ) {
828 828
                     break;
829 829
                 }
830 830
 
831
-                $sniffs = explode(',', substr($arg, 7));
832
-                foreach ($sniffs as $sniff) {
833
-                    if (substr_count($sniff, '.') !== 2) {
834
-                        $error  = 'ERROR: The specified sniff code "'.$sniff.'" is invalid'.PHP_EOL.PHP_EOL;
835
-                        $error .= $this->printShortUsage(true);
836
-                        throw new DeepExitException($error, 3);
831
+                $sniffs = explode( ',', substr( $arg, 7 ) );
832
+                foreach ( $sniffs as $sniff ) {
833
+                    if ( substr_count( $sniff, '.' ) !== 2 ) {
834
+                        $error  = 'ERROR: The specified sniff code "' . $sniff . '" is invalid' . PHP_EOL . PHP_EOL;
835
+                        $error .= $this->printShortUsage( true );
836
+                        throw new DeepExitException( $error, 3 );
837 837
                     }
838 838
                 }
839 839
 
840 840
                 $this->sniffs = $sniffs;
841
-                self::$overriddenDefaults['sniffs'] = true;
842
-            } else if (substr($arg, 0, 8) === 'exclude=') {
843
-                if (isset(self::$overriddenDefaults['exclude']) === true) {
841
+                self::$overriddenDefaults[ 'sniffs' ] = true;
842
+            } else if ( substr( $arg, 0, 8 ) === 'exclude=' ) {
843
+                if ( isset( self::$overriddenDefaults[ 'exclude' ] ) === true ) {
844 844
                     break;
845 845
                 }
846 846
 
847
-                $sniffs = explode(',', substr($arg, 8));
848
-                foreach ($sniffs as $sniff) {
849
-                    if (substr_count($sniff, '.') !== 2) {
850
-                        $error  = 'ERROR: The specified sniff code "'.$sniff.'" is invalid'.PHP_EOL.PHP_EOL;
851
-                        $error .= $this->printShortUsage(true);
852
-                        throw new DeepExitException($error, 3);
847
+                $sniffs = explode( ',', substr( $arg, 8 ) );
848
+                foreach ( $sniffs as $sniff ) {
849
+                    if ( substr_count( $sniff, '.' ) !== 2 ) {
850
+                        $error  = 'ERROR: The specified sniff code "' . $sniff . '" is invalid' . PHP_EOL . PHP_EOL;
851
+                        $error .= $this->printShortUsage( true );
852
+                        throw new DeepExitException( $error, 3 );
853 853
                     }
854 854
                 }
855 855
 
856 856
                 $this->exclude = $sniffs;
857
-                self::$overriddenDefaults['exclude'] = true;
858
-            } else if (defined('PHP_CODESNIFFER_IN_TESTS') === false
859
-                && substr($arg, 0, 6) === 'cache='
857
+                self::$overriddenDefaults[ 'exclude' ] = true;
858
+            } else if ( defined( 'PHP_CODESNIFFER_IN_TESTS' ) === false
859
+                && substr( $arg, 0, 6 ) === 'cache='
860 860
             ) {
861
-                if ((isset(self::$overriddenDefaults['cache']) === true
862
-                    && $this->cache === false)
863
-                    || isset(self::$overriddenDefaults['cacheFile']) === true
861
+                if ( ( isset( self::$overriddenDefaults[ 'cache' ] ) === true
862
+                    && $this->cache === false )
863
+                    || isset( self::$overriddenDefaults[ 'cacheFile' ] ) === true
864 864
                 ) {
865 865
                     break;
866 866
                 }
867 867
 
868 868
                 // Turn caching on.
869 869
                 $this->cache = true;
870
-                self::$overriddenDefaults['cache'] = true;
870
+                self::$overriddenDefaults[ 'cache' ] = true;
871 871
 
872
-                $this->cacheFile = Util\Common::realpath(substr($arg, 6));
872
+                $this->cacheFile = Util\Common::realpath( substr( $arg, 6 ) );
873 873
 
874 874
                 // It may not exist and return false instead.
875
-                if ($this->cacheFile === false) {
876
-                    $this->cacheFile = substr($arg, 6);
877
-
878
-                    $dir = dirname($this->cacheFile);
879
-                    if (is_dir($dir) === false) {
880
-                        $error  = 'ERROR: The specified cache file path "'.$this->cacheFile.'" points to a non-existent directory'.PHP_EOL.PHP_EOL;
881
-                        $error .= $this->printShortUsage(true);
882
-                        throw new DeepExitException($error, 3);
875
+                if ( $this->cacheFile === false ) {
876
+                    $this->cacheFile = substr( $arg, 6 );
877
+
878
+                    $dir = dirname( $this->cacheFile );
879
+                    if ( is_dir( $dir ) === false ) {
880
+                        $error  = 'ERROR: The specified cache file path "' . $this->cacheFile . '" points to a non-existent directory' . PHP_EOL . PHP_EOL;
881
+                        $error .= $this->printShortUsage( true );
882
+                        throw new DeepExitException( $error, 3 );
883 883
                     }
884 884
 
885
-                    if ($dir === '.') {
885
+                    if ( $dir === '.' ) {
886 886
                         // Passed cache file is a file in the current directory.
887
-                        $this->cacheFile = getcwd().'/'.basename($this->cacheFile);
887
+                        $this->cacheFile = getcwd() . '/' . basename( $this->cacheFile );
888 888
                     } else {
889
-                        if ($dir{0} === '/') {
889
+                        if ( $dir{0} === '/' ) {
890 890
                             // An absolute path.
891
-                            $dir = Util\Common::realpath($dir);
891
+                            $dir = Util\Common::realpath( $dir );
892 892
                         } else {
893
-                            $dir = Util\Common::realpath(getcwd().'/'.$dir);
893
+                            $dir = Util\Common::realpath( getcwd() . '/' . $dir );
894 894
                         }
895 895
 
896
-                        if ($dir !== false) {
896
+                        if ( $dir !== false ) {
897 897
                             // Cache file path is relative.
898
-                            $this->cacheFile = $dir.'/'.basename($this->cacheFile);
898
+                            $this->cacheFile = $dir . '/' . basename( $this->cacheFile );
899 899
                         }
900 900
                     }
901 901
                 }//end if
902 902
 
903
-                self::$overriddenDefaults['cacheFile'] = true;
903
+                self::$overriddenDefaults[ 'cacheFile' ] = true;
904 904
 
905
-                if (is_dir($this->cacheFile) === true) {
906
-                    $error  = 'ERROR: The specified cache file path "'.$this->cacheFile.'" is a directory'.PHP_EOL.PHP_EOL;
907
-                    $error .= $this->printShortUsage(true);
908
-                    throw new DeepExitException($error, 3);
905
+                if ( is_dir( $this->cacheFile ) === true ) {
906
+                    $error  = 'ERROR: The specified cache file path "' . $this->cacheFile . '" is a directory' . PHP_EOL . PHP_EOL;
907
+                    $error .= $this->printShortUsage( true );
908
+                    throw new DeepExitException( $error, 3 );
909 909
                 }
910
-            } else if (substr($arg, 0, 10) === 'bootstrap=') {
911
-                $files     = explode(',', substr($arg, 10));
912
-                $bootstrap = [];
913
-                foreach ($files as $file) {
914
-                    $path = Util\Common::realpath($file);
915
-                    if ($path === false) {
916
-                        $error  = 'ERROR: The specified bootstrap file "'.$file.'" does not exist'.PHP_EOL.PHP_EOL;
917
-                        $error .= $this->printShortUsage(true);
918
-                        throw new DeepExitException($error, 3);
910
+            } else if ( substr( $arg, 0, 10 ) === 'bootstrap=' ) {
911
+                $files     = explode( ',', substr( $arg, 10 ) );
912
+                $bootstrap = [ ];
913
+                foreach ( $files as $file ) {
914
+                    $path = Util\Common::realpath( $file );
915
+                    if ( $path === false ) {
916
+                        $error  = 'ERROR: The specified bootstrap file "' . $file . '" does not exist' . PHP_EOL . PHP_EOL;
917
+                        $error .= $this->printShortUsage( true );
918
+                        throw new DeepExitException( $error, 3 );
919 919
                     }
920 920
 
921
-                    $bootstrap[] = $path;
921
+                    $bootstrap[ ] = $path;
922 922
                 }
923 923
 
924
-                $this->bootstrap = array_merge($this->bootstrap, $bootstrap);
925
-                self::$overriddenDefaults['bootstrap'] = true;
926
-            } else if (substr($arg, 0, 10) === 'file-list=') {
927
-                $fileList = substr($arg, 10);
928
-                $path     = Util\Common::realpath($fileList);
929
-                if ($path === false) {
930
-                    $error  = 'ERROR: The specified file list "'.$fileList.'" does not exist'.PHP_EOL.PHP_EOL;
931
-                    $error .= $this->printShortUsage(true);
932
-                    throw new DeepExitException($error, 3);
924
+                $this->bootstrap = array_merge( $this->bootstrap, $bootstrap );
925
+                self::$overriddenDefaults[ 'bootstrap' ] = true;
926
+            } else if ( substr( $arg, 0, 10 ) === 'file-list=' ) {
927
+                $fileList = substr( $arg, 10 );
928
+                $path     = Util\Common::realpath( $fileList );
929
+                if ( $path === false ) {
930
+                    $error  = 'ERROR: The specified file list "' . $fileList . '" does not exist' . PHP_EOL . PHP_EOL;
931
+                    $error .= $this->printShortUsage( true );
932
+                    throw new DeepExitException( $error, 3 );
933 933
                 }
934 934
 
935
-                $files = file($path);
936
-                foreach ($files as $inputFile) {
937
-                    $inputFile = trim($inputFile);
935
+                $files = file( $path );
936
+                foreach ( $files as $inputFile ) {
937
+                    $inputFile = trim( $inputFile );
938 938
 
939 939
                     // Skip empty lines.
940
-                    if ($inputFile === '') {
940
+                    if ( $inputFile === '' ) {
941 941
                         continue;
942 942
                     }
943 943
 
944
-                    $this->processFilePath($inputFile);
944
+                    $this->processFilePath( $inputFile );
945 945
                 }
946
-            } else if (substr($arg, 0, 11) === 'stdin-path=') {
947
-                if (isset(self::$overriddenDefaults['stdinPath']) === true) {
946
+            } else if ( substr( $arg, 0, 11 ) === 'stdin-path=' ) {
947
+                if ( isset( self::$overriddenDefaults[ 'stdinPath' ] ) === true ) {
948 948
                     break;
949 949
                 }
950 950
 
951
-                $this->stdinPath = Util\Common::realpath(substr($arg, 11));
951
+                $this->stdinPath = Util\Common::realpath( substr( $arg, 11 ) );
952 952
 
953 953
                 // It may not exist and return false instead, so use whatever they gave us.
954
-                if ($this->stdinPath === false) {
955
-                    $this->stdinPath = trim(substr($arg, 11));
954
+                if ( $this->stdinPath === false ) {
955
+                    $this->stdinPath = trim( substr( $arg, 11 ) );
956 956
                 }
957 957
 
958
-                self::$overriddenDefaults['stdinPath'] = true;
959
-            } else if (PHP_CODESNIFFER_CBF === false && substr($arg, 0, 12) === 'report-file=') {
960
-                if (isset(self::$overriddenDefaults['reportFile']) === true) {
958
+                self::$overriddenDefaults[ 'stdinPath' ] = true;
959
+            } else if ( PHP_CODESNIFFER_CBF === false && substr( $arg, 0, 12 ) === 'report-file=' ) {
960
+                if ( isset( self::$overriddenDefaults[ 'reportFile' ] ) === true ) {
961 961
                     break;
962 962
                 }
963 963
 
964
-                $this->reportFile = Util\Common::realpath(substr($arg, 12));
964
+                $this->reportFile = Util\Common::realpath( substr( $arg, 12 ) );
965 965
 
966 966
                 // It may not exist and return false instead.
967
-                if ($this->reportFile === false) {
968
-                    $this->reportFile = substr($arg, 12);
969
-
970
-                    $dir = dirname($this->reportFile);
971
-                    if (is_dir($dir) === false) {
972
-                        $error  = 'ERROR: The specified report file path "'.$this->reportFile.'" points to a non-existent directory'.PHP_EOL.PHP_EOL;
973
-                        $error .= $this->printShortUsage(true);
974
-                        throw new DeepExitException($error, 3);
967
+                if ( $this->reportFile === false ) {
968
+                    $this->reportFile = substr( $arg, 12 );
969
+
970
+                    $dir = dirname( $this->reportFile );
971
+                    if ( is_dir( $dir ) === false ) {
972
+                        $error  = 'ERROR: The specified report file path "' . $this->reportFile . '" points to a non-existent directory' . PHP_EOL . PHP_EOL;
973
+                        $error .= $this->printShortUsage( true );
974
+                        throw new DeepExitException( $error, 3 );
975 975
                     }
976 976
 
977
-                    if ($dir === '.') {
977
+                    if ( $dir === '.' ) {
978 978
                         // Passed report file is a file in the current directory.
979
-                        $this->reportFile = getcwd().'/'.basename($this->reportFile);
979
+                        $this->reportFile = getcwd() . '/' . basename( $this->reportFile );
980 980
                     } else {
981
-                        if ($dir{0} === '/') {
981
+                        if ( $dir{0} === '/' ) {
982 982
                             // An absolute path.
983
-                            $dir = Util\Common::realpath($dir);
983
+                            $dir = Util\Common::realpath( $dir );
984 984
                         } else {
985
-                            $dir = Util\Common::realpath(getcwd().'/'.$dir);
985
+                            $dir = Util\Common::realpath( getcwd() . '/' . $dir );
986 986
                         }
987 987
 
988
-                        if ($dir !== false) {
988
+                        if ( $dir !== false ) {
989 989
                             // Report file path is relative.
990
-                            $this->reportFile = $dir.'/'.basename($this->reportFile);
990
+                            $this->reportFile = $dir . '/' . basename( $this->reportFile );
991 991
                         }
992 992
                     }
993 993
                 }//end if
994 994
 
995
-                self::$overriddenDefaults['reportFile'] = true;
995
+                self::$overriddenDefaults[ 'reportFile' ] = true;
996 996
 
997
-                if (is_dir($this->reportFile) === true) {
998
-                    $error  = 'ERROR: The specified report file path "'.$this->reportFile.'" is a directory'.PHP_EOL.PHP_EOL;
999
-                    $error .= $this->printShortUsage(true);
1000
-                    throw new DeepExitException($error, 3);
997
+                if ( is_dir( $this->reportFile ) === true ) {
998
+                    $error  = 'ERROR: The specified report file path "' . $this->reportFile . '" is a directory' . PHP_EOL . PHP_EOL;
999
+                    $error .= $this->printShortUsage( true );
1000
+                    throw new DeepExitException( $error, 3 );
1001 1001
                 }
1002
-            } else if (substr($arg, 0, 13) === 'report-width=') {
1003
-                if (isset(self::$overriddenDefaults['reportWidth']) === true) {
1002
+            } else if ( substr( $arg, 0, 13 ) === 'report-width=' ) {
1003
+                if ( isset( self::$overriddenDefaults[ 'reportWidth' ] ) === true ) {
1004 1004
                     break;
1005 1005
                 }
1006 1006
 
1007
-                $this->reportWidth = substr($arg, 13);
1008
-                self::$overriddenDefaults['reportWidth'] = true;
1009
-            } else if (substr($arg, 0, 9) === 'basepath=') {
1010
-                if (isset(self::$overriddenDefaults['basepath']) === true) {
1007
+                $this->reportWidth = substr( $arg, 13 );
1008
+                self::$overriddenDefaults[ 'reportWidth' ] = true;
1009
+            } else if ( substr( $arg, 0, 9 ) === 'basepath=' ) {
1010
+                if ( isset( self::$overriddenDefaults[ 'basepath' ] ) === true ) {
1011 1011
                     break;
1012 1012
                 }
1013 1013
 
1014
-                self::$overriddenDefaults['basepath'] = true;
1014
+                self::$overriddenDefaults[ 'basepath' ] = true;
1015 1015
 
1016
-                if (substr($arg, 9) === '') {
1016
+                if ( substr( $arg, 9 ) === '' ) {
1017 1017
                     $this->basepath = null;
1018 1018
                     break;
1019 1019
                 }
1020 1020
 
1021
-                $this->basepath = Util\Common::realpath(substr($arg, 9));
1021
+                $this->basepath = Util\Common::realpath( substr( $arg, 9 ) );
1022 1022
 
1023 1023
                 // It may not exist and return false instead.
1024
-                if ($this->basepath === false) {
1025
-                    $this->basepath = substr($arg, 9);
1024
+                if ( $this->basepath === false ) {
1025
+                    $this->basepath = substr( $arg, 9 );
1026 1026
                 }
1027 1027
 
1028
-                if (is_dir($this->basepath) === false) {
1029
-                    $error  = 'ERROR: The specified basepath "'.$this->basepath.'" points to a non-existent directory'.PHP_EOL.PHP_EOL;
1030
-                    $error .= $this->printShortUsage(true);
1031
-                    throw new DeepExitException($error, 3);
1028
+                if ( is_dir( $this->basepath ) === false ) {
1029
+                    $error  = 'ERROR: The specified basepath "' . $this->basepath . '" points to a non-existent directory' . PHP_EOL . PHP_EOL;
1030
+                    $error .= $this->printShortUsage( true );
1031
+                    throw new DeepExitException( $error, 3 );
1032 1032
                 }
1033
-            } else if ((substr($arg, 0, 7) === 'report=' || substr($arg, 0, 7) === 'report-')) {
1034
-                $reports = [];
1033
+            } else if ( ( substr( $arg, 0, 7 ) === 'report=' || substr( $arg, 0, 7 ) === 'report-' ) ) {
1034
+                $reports = [ ];
1035 1035
 
1036
-                if ($arg[6] === '-') {
1036
+                if ( $arg[ 6 ] === '-' ) {
1037 1037
                     // This is a report with file output.
1038
-                    $split = strpos($arg, '=');
1039
-                    if ($split === false) {
1040
-                        $report = substr($arg, 7);
1038
+                    $split = strpos( $arg, '=' );
1039
+                    if ( $split === false ) {
1040
+                        $report = substr( $arg, 7 );
1041 1041
                         $output = null;
1042 1042
                     } else {
1043
-                        $report = substr($arg, 7, ($split - 7));
1044
-                        $output = substr($arg, ($split + 1));
1045
-                        if ($output === false) {
1043
+                        $report = substr( $arg, 7, ( $split - 7 ) );
1044
+                        $output = substr( $arg, ( $split + 1 ) );
1045
+                        if ( $output === false ) {
1046 1046
                             $output = null;
1047 1047
                         } else {
1048
-                            $dir = dirname($output);
1049
-                            if (is_dir($dir) === false) {
1050
-                                $error  = 'ERROR: The specified '.$report.' report file path "'.$output.'" points to a non-existent directory'.PHP_EOL.PHP_EOL;
1051
-                                $error .= $this->printShortUsage(true);
1052
-                                throw new DeepExitException($error, 3);
1048
+                            $dir = dirname( $output );
1049
+                            if ( is_dir( $dir ) === false ) {
1050
+                                $error  = 'ERROR: The specified ' . $report . ' report file path "' . $output . '" points to a non-existent directory' . PHP_EOL . PHP_EOL;
1051
+                                $error .= $this->printShortUsage( true );
1052
+                                throw new DeepExitException( $error, 3 );
1053 1053
                             }
1054 1054
 
1055
-                            if ($dir === '.') {
1055
+                            if ( $dir === '.' ) {
1056 1056
                                 // Passed report file is a filename in the current directory.
1057
-                                $output = getcwd().'/'.basename($output);
1057
+                                $output = getcwd() . '/' . basename( $output );
1058 1058
                             } else {
1059
-                                if ($dir{0} === '/') {
1059
+                                if ( $dir{0} === '/' ) {
1060 1060
                                     // An absolute path.
1061
-                                    $dir = Util\Common::realpath($dir);
1061
+                                    $dir = Util\Common::realpath( $dir );
1062 1062
                                 } else {
1063
-                                    $dir = Util\Common::realpath(getcwd().'/'.$dir);
1063
+                                    $dir = Util\Common::realpath( getcwd() . '/' . $dir );
1064 1064
                                 }
1065 1065
 
1066
-                                if ($dir !== false) {
1066
+                                if ( $dir !== false ) {
1067 1067
                                     // Report file path is relative.
1068
-                                    $output = $dir.'/'.basename($output);
1068
+                                    $output = $dir . '/' . basename( $output );
1069 1069
                                 }
1070 1070
                             }
1071 1071
                         }//end if
1072 1072
                     }//end if
1073 1073
 
1074
-                    $reports[$report] = $output;
1074
+                    $reports[ $report ] = $output;
1075 1075
                 } else {
1076 1076
                     // This is a single report.
1077
-                    if (isset(self::$overriddenDefaults['reports']) === true) {
1077
+                    if ( isset( self::$overriddenDefaults[ 'reports' ] ) === true ) {
1078 1078
                         break;
1079 1079
                     }
1080 1080
 
1081
-                    $reportNames = explode(',', substr($arg, 7));
1082
-                    foreach ($reportNames as $report) {
1083
-                        $reports[$report] = null;
1081
+                    $reportNames = explode( ',', substr( $arg, 7 ) );
1082
+                    foreach ( $reportNames as $report ) {
1083
+                        $reports[ $report ] = null;
1084 1084
                     }
1085 1085
                 }//end if
1086 1086
 
1087 1087
                 // Remove the default value so the CLI value overrides it.
1088
-                if (isset(self::$overriddenDefaults['reports']) === false) {
1088
+                if ( isset( self::$overriddenDefaults[ 'reports' ] ) === false ) {
1089 1089
                     $this->reports = $reports;
1090 1090
                 } else {
1091
-                    $this->reports = array_merge($this->reports, $reports);
1091
+                    $this->reports = array_merge( $this->reports, $reports );
1092 1092
                 }
1093 1093
 
1094
-                self::$overriddenDefaults['reports'] = true;
1095
-            } else if (substr($arg, 0, 7) === 'filter=') {
1096
-                if (isset(self::$overriddenDefaults['filter']) === true) {
1094
+                self::$overriddenDefaults[ 'reports' ] = true;
1095
+            } else if ( substr( $arg, 0, 7 ) === 'filter=' ) {
1096
+                if ( isset( self::$overriddenDefaults[ 'filter' ] ) === true ) {
1097 1097
                     break;
1098 1098
                 }
1099 1099
 
1100
-                $this->filter = substr($arg, 7);
1101
-                self::$overriddenDefaults['filter'] = true;
1102
-            } else if (substr($arg, 0, 9) === 'standard=') {
1103
-                $standards = trim(substr($arg, 9));
1104
-                if ($standards !== '') {
1105
-                    $this->standards = explode(',', $standards);
1100
+                $this->filter = substr( $arg, 7 );
1101
+                self::$overriddenDefaults[ 'filter' ] = true;
1102
+            } else if ( substr( $arg, 0, 9 ) === 'standard=' ) {
1103
+                $standards = trim( substr( $arg, 9 ) );
1104
+                if ( $standards !== '' ) {
1105
+                    $this->standards = explode( ',', $standards );
1106 1106
                 }
1107 1107
 
1108
-                self::$overriddenDefaults['standards'] = true;
1109
-            } else if (substr($arg, 0, 11) === 'extensions=') {
1110
-                if (isset(self::$overriddenDefaults['extensions']) === true) {
1108
+                self::$overriddenDefaults[ 'standards' ] = true;
1109
+            } else if ( substr( $arg, 0, 11 ) === 'extensions=' ) {
1110
+                if ( isset( self::$overriddenDefaults[ 'extensions' ] ) === true ) {
1111 1111
                     break;
1112 1112
                 }
1113 1113
 
1114
-                $extensions    = explode(',', substr($arg, 11));
1115
-                $newExtensions = [];
1116
-                foreach ($extensions as $ext) {
1117
-                    $slash = strpos($ext, '/');
1118
-                    if ($slash !== false) {
1114
+                $extensions    = explode( ',', substr( $arg, 11 ) );
1115
+                $newExtensions = [ ];
1116
+                foreach ( $extensions as $ext ) {
1117
+                    $slash = strpos( $ext, '/' );
1118
+                    if ( $slash !== false ) {
1119 1119
                         // They specified the tokenizer too.
1120
-                        list($ext, $tokenizer) = explode('/', $ext);
1121
-                        $newExtensions[$ext]   = strtoupper($tokenizer);
1120
+                        list( $ext, $tokenizer ) = explode( '/', $ext );
1121
+                        $newExtensions[ $ext ]   = strtoupper( $tokenizer );
1122 1122
                         continue;
1123 1123
                     }
1124 1124
 
1125
-                    if (isset($this->extensions[$ext]) === true) {
1126
-                        $newExtensions[$ext] = $this->extensions[$ext];
1125
+                    if ( isset( $this->extensions[ $ext ] ) === true ) {
1126
+                        $newExtensions[ $ext ] = $this->extensions[ $ext ];
1127 1127
                     } else {
1128
-                        $newExtensions[$ext] = 'PHP';
1128
+                        $newExtensions[ $ext ] = 'PHP';
1129 1129
                     }
1130 1130
                 }
1131 1131
 
1132 1132
                 $this->extensions = $newExtensions;
1133
-                self::$overriddenDefaults['extensions'] = true;
1134
-            } else if (substr($arg, 0, 7) === 'suffix=') {
1135
-                if (isset(self::$overriddenDefaults['suffix']) === true) {
1133
+                self::$overriddenDefaults[ 'extensions' ] = true;
1134
+            } else if ( substr( $arg, 0, 7 ) === 'suffix=' ) {
1135
+                if ( isset( self::$overriddenDefaults[ 'suffix' ] ) === true ) {
1136 1136
                     break;
1137 1137
                 }
1138 1138
 
1139
-                $this->suffix = substr($arg, 7);
1140
-                self::$overriddenDefaults['suffix'] = true;
1141
-            } else if (substr($arg, 0, 9) === 'parallel=') {
1142
-                if (isset(self::$overriddenDefaults['parallel']) === true) {
1139
+                $this->suffix = substr( $arg, 7 );
1140
+                self::$overriddenDefaults[ 'suffix' ] = true;
1141
+            } else if ( substr( $arg, 0, 9 ) === 'parallel=' ) {
1142
+                if ( isset( self::$overriddenDefaults[ 'parallel' ] ) === true ) {
1143 1143
                     break;
1144 1144
                 }
1145 1145
 
1146
-                $this->parallel = max((int) substr($arg, 9), 1);
1147
-                self::$overriddenDefaults['parallel'] = true;
1148
-            } else if (substr($arg, 0, 9) === 'severity=') {
1149
-                $this->errorSeverity   = (int) substr($arg, 9);
1146
+                $this->parallel = max( (int)substr( $arg, 9 ), 1 );
1147
+                self::$overriddenDefaults[ 'parallel' ] = true;
1148
+            } else if ( substr( $arg, 0, 9 ) === 'severity=' ) {
1149
+                $this->errorSeverity   = (int)substr( $arg, 9 );
1150 1150
                 $this->warningSeverity = $this->errorSeverity;
1151
-                if (isset(self::$overriddenDefaults['errorSeverity']) === false) {
1152
-                    self::$overriddenDefaults['errorSeverity'] = true;
1151
+                if ( isset( self::$overriddenDefaults[ 'errorSeverity' ] ) === false ) {
1152
+                    self::$overriddenDefaults[ 'errorSeverity' ] = true;
1153 1153
                 }
1154 1154
 
1155
-                if (isset(self::$overriddenDefaults['warningSeverity']) === false) {
1156
-                    self::$overriddenDefaults['warningSeverity'] = true;
1155
+                if ( isset( self::$overriddenDefaults[ 'warningSeverity' ] ) === false ) {
1156
+                    self::$overriddenDefaults[ 'warningSeverity' ] = true;
1157 1157
                 }
1158
-            } else if (substr($arg, 0, 15) === 'error-severity=') {
1159
-                if (isset(self::$overriddenDefaults['errorSeverity']) === true) {
1158
+            } else if ( substr( $arg, 0, 15 ) === 'error-severity=' ) {
1159
+                if ( isset( self::$overriddenDefaults[ 'errorSeverity' ] ) === true ) {
1160 1160
                     break;
1161 1161
                 }
1162 1162
 
1163
-                $this->errorSeverity = (int) substr($arg, 15);
1164
-                self::$overriddenDefaults['errorSeverity'] = true;
1165
-            } else if (substr($arg, 0, 17) === 'warning-severity=') {
1166
-                if (isset(self::$overriddenDefaults['warningSeverity']) === true) {
1163
+                $this->errorSeverity = (int)substr( $arg, 15 );
1164
+                self::$overriddenDefaults[ 'errorSeverity' ] = true;
1165
+            } else if ( substr( $arg, 0, 17 ) === 'warning-severity=' ) {
1166
+                if ( isset( self::$overriddenDefaults[ 'warningSeverity' ] ) === true ) {
1167 1167
                     break;
1168 1168
                 }
1169 1169
 
1170
-                $this->warningSeverity = (int) substr($arg, 17);
1171
-                self::$overriddenDefaults['warningSeverity'] = true;
1172
-            } else if (substr($arg, 0, 7) === 'ignore=') {
1173
-                if (isset(self::$overriddenDefaults['ignored']) === true) {
1170
+                $this->warningSeverity = (int)substr( $arg, 17 );
1171
+                self::$overriddenDefaults[ 'warningSeverity' ] = true;
1172
+            } else if ( substr( $arg, 0, 7 ) === 'ignore=' ) {
1173
+                if ( isset( self::$overriddenDefaults[ 'ignored' ] ) === true ) {
1174 1174
                     break;
1175 1175
                 }
1176 1176
 
@@ -1178,60 +1178,60 @@  discard block
 block discarded – undo
1178 1178
                 // using 1 or 3 slashes (\, or \\\,).
1179 1179
                 $patterns = preg_split(
1180 1180
                     '/(?<=(?<!\\\\)\\\\\\\\),|(?<!\\\\),/',
1181
-                    substr($arg, 7)
1181
+                    substr( $arg, 7 )
1182 1182
                 );
1183 1183
 
1184
-                $ignored = [];
1185
-                foreach ($patterns as $pattern) {
1186
-                    $pattern = trim($pattern);
1187
-                    if ($pattern === '') {
1184
+                $ignored = [ ];
1185
+                foreach ( $patterns as $pattern ) {
1186
+                    $pattern = trim( $pattern );
1187
+                    if ( $pattern === '' ) {
1188 1188
                         continue;
1189 1189
                     }
1190 1190
 
1191
-                    $ignored[$pattern] = 'absolute';
1191
+                    $ignored[ $pattern ] = 'absolute';
1192 1192
                 }
1193 1193
 
1194 1194
                 $this->ignored = $ignored;
1195
-                self::$overriddenDefaults['ignored'] = true;
1196
-            } else if (substr($arg, 0, 10) === 'generator='
1195
+                self::$overriddenDefaults[ 'ignored' ] = true;
1196
+            } else if ( substr( $arg, 0, 10 ) === 'generator='
1197 1197
                 && PHP_CODESNIFFER_CBF === false
1198 1198
             ) {
1199
-                if (isset(self::$overriddenDefaults['generator']) === true) {
1199
+                if ( isset( self::$overriddenDefaults[ 'generator' ] ) === true ) {
1200 1200
                     break;
1201 1201
                 }
1202 1202
 
1203
-                $this->generator = substr($arg, 10);
1204
-                self::$overriddenDefaults['generator'] = true;
1205
-            } else if (substr($arg, 0, 9) === 'encoding=') {
1206
-                if (isset(self::$overriddenDefaults['encoding']) === true) {
1203
+                $this->generator = substr( $arg, 10 );
1204
+                self::$overriddenDefaults[ 'generator' ] = true;
1205
+            } else if ( substr( $arg, 0, 9 ) === 'encoding=' ) {
1206
+                if ( isset( self::$overriddenDefaults[ 'encoding' ] ) === true ) {
1207 1207
                     break;
1208 1208
                 }
1209 1209
 
1210
-                $this->encoding = strtolower(substr($arg, 9));
1211
-                self::$overriddenDefaults['encoding'] = true;
1212
-            } else if (substr($arg, 0, 10) === 'tab-width=') {
1213
-                if (isset(self::$overriddenDefaults['tabWidth']) === true) {
1210
+                $this->encoding = strtolower( substr( $arg, 9 ) );
1211
+                self::$overriddenDefaults[ 'encoding' ] = true;
1212
+            } else if ( substr( $arg, 0, 10 ) === 'tab-width=' ) {
1213
+                if ( isset( self::$overriddenDefaults[ 'tabWidth' ] ) === true ) {
1214 1214
                     break;
1215 1215
                 }
1216 1216
 
1217
-                $this->tabWidth = (int) substr($arg, 10);
1218
-                self::$overriddenDefaults['tabWidth'] = true;
1217
+                $this->tabWidth = (int)substr( $arg, 10 );
1218
+                self::$overriddenDefaults[ 'tabWidth' ] = true;
1219 1219
             } else {
1220
-                if ($this->dieOnUnknownArg === false) {
1221
-                    $eqPos = strpos($arg, '=');
1220
+                if ( $this->dieOnUnknownArg === false ) {
1221
+                    $eqPos = strpos( $arg, '=' );
1222 1222
                     try {
1223
-                        if ($eqPos === false) {
1224
-                            $this->values[$arg] = $arg;
1223
+                        if ( $eqPos === false ) {
1224
+                            $this->values[ $arg ] = $arg;
1225 1225
                         } else {
1226
-                            $value = substr($arg, ($eqPos + 1));
1227
-                            $arg   = substr($arg, 0, $eqPos);
1228
-                            $this->values[$arg] = $value;
1226
+                            $value = substr( $arg, ( $eqPos + 1 ) );
1227
+                            $arg   = substr( $arg, 0, $eqPos );
1228
+                            $this->values[ $arg ] = $value;
1229 1229
                         }
1230
-                    } catch (RuntimeException $e) {
1230
+                    } catch ( RuntimeException $e ) {
1231 1231
                         // Value is not valid, so just ignore it.
1232 1232
                     }
1233 1233
                 } else {
1234
-                    $this->processUnknownArgument('--'.$arg, $pos);
1234
+                    $this->processUnknownArgument( '--' . $arg, $pos );
1235 1235
                 }
1236 1236
             }//end if
1237 1237
             break;
@@ -1250,20 +1250,20 @@  discard block
 block discarded – undo
1250 1250
      *
1251 1251
      * @return void
1252 1252
      */
1253
-    public function processUnknownArgument($arg, $pos)
1253
+    public function processUnknownArgument( $arg, $pos )
1254 1254
     {
1255 1255
         // We don't know about any additional switches; just files.
1256
-        if ($arg{0} === '-') {
1257
-            if ($this->dieOnUnknownArg === false) {
1256
+        if ( $arg{0} === '-' ) {
1257
+            if ( $this->dieOnUnknownArg === false ) {
1258 1258
                 return;
1259 1259
             }
1260 1260
 
1261
-            $error  = "ERROR: option \"$arg\" not known".PHP_EOL.PHP_EOL;
1262
-            $error .= $this->printShortUsage(true);
1263
-            throw new DeepExitException($error, 3);
1261
+            $error  = "ERROR: option \"$arg\" not known" . PHP_EOL . PHP_EOL;
1262
+            $error .= $this->printShortUsage( true );
1263
+            throw new DeepExitException( $error, 3 );
1264 1264
         }
1265 1265
 
1266
-        $this->processFilePath($arg);
1266
+        $this->processFilePath( $arg );
1267 1267
 
1268 1268
     }//end processUnknownArgument()
1269 1269
 
@@ -1275,29 +1275,29 @@  discard block
 block discarded – undo
1275 1275
      *
1276 1276
      * @return void
1277 1277
      */
1278
-    public function processFilePath($path)
1278
+    public function processFilePath( $path )
1279 1279
     {
1280 1280
         // If we are processing STDIN, don't record any files to check.
1281
-        if ($this->stdin === true) {
1281
+        if ( $this->stdin === true ) {
1282 1282
             return;
1283 1283
         }
1284 1284
 
1285
-        $file = Util\Common::realpath($path);
1286
-        if (file_exists($file) === false) {
1287
-            if ($this->dieOnUnknownArg === false) {
1285
+        $file = Util\Common::realpath( $path );
1286
+        if ( file_exists( $file ) === false ) {
1287
+            if ( $this->dieOnUnknownArg === false ) {
1288 1288
                 return;
1289 1289
             }
1290 1290
 
1291
-            $error  = 'ERROR: The file "'.$path.'" does not exist.'.PHP_EOL.PHP_EOL;
1292
-            $error .= $this->printShortUsage(true);
1293
-            throw new DeepExitException($error, 3);
1291
+            $error  = 'ERROR: The file "' . $path . '" does not exist.' . PHP_EOL . PHP_EOL;
1292
+            $error .= $this->printShortUsage( true );
1293
+            throw new DeepExitException( $error, 3 );
1294 1294
         } else {
1295 1295
             // Can't modify the files array directly because it's not a real
1296 1296
             // class member, so need to use this little get/modify/set trick.
1297 1297
             $files       = $this->files;
1298
-            $files[]     = $file;
1298
+            $files[ ]     = $file;
1299 1299
             $this->files = $files;
1300
-            self::$overriddenDefaults['files'] = true;
1300
+            self::$overriddenDefaults[ 'files' ] = true;
1301 1301
         }
1302 1302
 
1303 1303
     }//end processFilePath()
@@ -1312,7 +1312,7 @@  discard block
 block discarded – undo
1312 1312
     {
1313 1313
         echo PHP_EOL;
1314 1314
 
1315
-        if (PHP_CODESNIFFER_CBF === true) {
1315
+        if ( PHP_CODESNIFFER_CBF === true ) {
1316 1316
             $this->printPHPCBFUsage();
1317 1317
         } else {
1318 1318
             $this->printPHPCSUsage();
@@ -1331,17 +1331,17 @@  discard block
 block discarded – undo
1331 1331
      *
1332 1332
      * @return string|void
1333 1333
      */
1334
-    public function printShortUsage($return=false)
1334
+    public function printShortUsage( $return = false )
1335 1335
     {
1336
-        if (PHP_CODESNIFFER_CBF === true) {
1336
+        if ( PHP_CODESNIFFER_CBF === true ) {
1337 1337
             $usage = 'Run "phpcbf --help" for usage information';
1338 1338
         } else {
1339 1339
             $usage = 'Run "phpcs --help" for usage information';
1340 1340
         }
1341 1341
 
1342
-        $usage .= PHP_EOL.PHP_EOL;
1342
+        $usage .= PHP_EOL . PHP_EOL;
1343 1343
 
1344
-        if ($return === true) {
1344
+        if ( $return === true ) {
1345 1345
             return $usage;
1346 1346
         }
1347 1347
 
@@ -1357,70 +1357,70 @@  discard block
 block discarded – undo
1357 1357
      */
1358 1358
     public function printPHPCSUsage()
1359 1359
     {
1360
-        echo 'Usage: phpcs [-nwlsaepqvi] [-d key[=value]] [--colors] [--no-colors]'.PHP_EOL;
1361
-        echo '  [--cache[=<cacheFile>]] [--no-cache] [--tab-width=<tabWidth>]'.PHP_EOL;
1362
-        echo '  [--report=<report>] [--report-file=<reportFile>] [--report-<report>=<reportFile>]'.PHP_EOL;
1363
-        echo '  [--report-width=<reportWidth>] [--basepath=<basepath>] [--bootstrap=<bootstrap>]'.PHP_EOL;
1364
-        echo '  [--severity=<severity>] [--error-severity=<severity>] [--warning-severity=<severity>]'.PHP_EOL;
1365
-        echo '  [--runtime-set key value] [--config-set key value] [--config-delete key] [--config-show]'.PHP_EOL;
1366
-        echo '  [--standard=<standard>] [--sniffs=<sniffs>] [--exclude=<sniffs>]'.PHP_EOL;
1367
-        echo '  [--encoding=<encoding>] [--parallel=<processes>] [--generator=<generator>]'.PHP_EOL;
1368
-        echo '  [--extensions=<extensions>] [--ignore=<patterns>] [--ignore-annotations]'.PHP_EOL;
1369
-        echo '  [--stdin-path=<stdinPath>] [--file-list=<fileList>] [--filter=<filter>] <file> - ...'.PHP_EOL;
1360
+        echo 'Usage: phpcs [-nwlsaepqvi] [-d key[=value]] [--colors] [--no-colors]' . PHP_EOL;
1361
+        echo '  [--cache[=<cacheFile>]] [--no-cache] [--tab-width=<tabWidth>]' . PHP_EOL;
1362
+        echo '  [--report=<report>] [--report-file=<reportFile>] [--report-<report>=<reportFile>]' . PHP_EOL;
1363
+        echo '  [--report-width=<reportWidth>] [--basepath=<basepath>] [--bootstrap=<bootstrap>]' . PHP_EOL;
1364
+        echo '  [--severity=<severity>] [--error-severity=<severity>] [--warning-severity=<severity>]' . PHP_EOL;
1365
+        echo '  [--runtime-set key value] [--config-set key value] [--config-delete key] [--config-show]' . PHP_EOL;
1366
+        echo '  [--standard=<standard>] [--sniffs=<sniffs>] [--exclude=<sniffs>]' . PHP_EOL;
1367
+        echo '  [--encoding=<encoding>] [--parallel=<processes>] [--generator=<generator>]' . PHP_EOL;
1368
+        echo '  [--extensions=<extensions>] [--ignore=<patterns>] [--ignore-annotations]' . PHP_EOL;
1369
+        echo '  [--stdin-path=<stdinPath>] [--file-list=<fileList>] [--filter=<filter>] <file> - ...' . PHP_EOL;
1370 1370
         echo PHP_EOL;
1371
-        echo ' -     Check STDIN instead of local files and directories'.PHP_EOL;
1372
-        echo ' -n    Do not print warnings (shortcut for --warning-severity=0)'.PHP_EOL;
1373
-        echo ' -w    Print both warnings and errors (this is the default)'.PHP_EOL;
1374
-        echo ' -l    Local directory only, no recursion'.PHP_EOL;
1375
-        echo ' -s    Show sniff codes in all reports'.PHP_EOL;
1376
-        echo ' -a    Run interactively'.PHP_EOL;
1377
-        echo ' -e    Explain a standard by showing the sniffs it includes'.PHP_EOL;
1378
-        echo ' -p    Show progress of the run'.PHP_EOL;
1379
-        echo ' -q    Quiet mode; disables progress and verbose output'.PHP_EOL;
1380
-        echo ' -m    Stop error messages from being recorded'.PHP_EOL;
1381
-        echo '       (saves a lot of memory, but stops many reports from being used)'.PHP_EOL;
1382
-        echo ' -v    Print processed files'.PHP_EOL;
1383
-        echo ' -vv   Print ruleset and token output'.PHP_EOL;
1384
-        echo ' -vvv  Print sniff processing information'.PHP_EOL;
1385
-        echo ' -i    Show a list of installed coding standards'.PHP_EOL;
1386
-        echo ' -d    Set the [key] php.ini value to [value] or [true] if value is omitted'.PHP_EOL;
1371
+        echo ' -     Check STDIN instead of local files and directories' . PHP_EOL;
1372
+        echo ' -n    Do not print warnings (shortcut for --warning-severity=0)' . PHP_EOL;
1373
+        echo ' -w    Print both warnings and errors (this is the default)' . PHP_EOL;
1374
+        echo ' -l    Local directory only, no recursion' . PHP_EOL;
1375
+        echo ' -s    Show sniff codes in all reports' . PHP_EOL;
1376
+        echo ' -a    Run interactively' . PHP_EOL;
1377
+        echo ' -e    Explain a standard by showing the sniffs it includes' . PHP_EOL;
1378
+        echo ' -p    Show progress of the run' . PHP_EOL;
1379
+        echo ' -q    Quiet mode; disables progress and verbose output' . PHP_EOL;
1380
+        echo ' -m    Stop error messages from being recorded' . PHP_EOL;
1381
+        echo '       (saves a lot of memory, but stops many reports from being used)' . PHP_EOL;
1382
+        echo ' -v    Print processed files' . PHP_EOL;
1383
+        echo ' -vv   Print ruleset and token output' . PHP_EOL;
1384
+        echo ' -vvv  Print sniff processing information' . PHP_EOL;
1385
+        echo ' -i    Show a list of installed coding standards' . PHP_EOL;
1386
+        echo ' -d    Set the [key] php.ini value to [value] or [true] if value is omitted' . PHP_EOL;
1387 1387
         echo PHP_EOL;
1388
-        echo ' --help                Print this help message'.PHP_EOL;
1389
-        echo ' --version             Print version information'.PHP_EOL;
1390
-        echo ' --colors              Use colors in output'.PHP_EOL;
1391
-        echo ' --no-colors           Do not use colors in output (this is the default)'.PHP_EOL;
1392
-        echo ' --cache               Cache results between runs'.PHP_EOL;
1393
-        echo ' --no-cache            Do not cache results between runs (this is the default)'.PHP_EOL;
1394
-        echo ' --ignore-annotations  Ignore all phpcs: annotations in code comments'.PHP_EOL;
1388
+        echo ' --help                Print this help message' . PHP_EOL;
1389
+        echo ' --version             Print version information' . PHP_EOL;
1390
+        echo ' --colors              Use colors in output' . PHP_EOL;
1391
+        echo ' --no-colors           Do not use colors in output (this is the default)' . PHP_EOL;
1392
+        echo ' --cache               Cache results between runs' . PHP_EOL;
1393
+        echo ' --no-cache            Do not cache results between runs (this is the default)' . PHP_EOL;
1394
+        echo ' --ignore-annotations  Ignore all phpcs: annotations in code comments' . PHP_EOL;
1395 1395
         echo PHP_EOL;
1396
-        echo ' <cacheFile>    Use a specific file for caching (uses a temporary file by default)'.PHP_EOL;
1397
-        echo ' <basepath>     A path to strip from the front of file paths inside reports'.PHP_EOL;
1398
-        echo ' <bootstrap>    A comma separated list of files to run before processing begins'.PHP_EOL;
1399
-        echo ' <encoding>     The encoding of the files being checked (default is utf-8)'.PHP_EOL;
1400
-        echo ' <extensions>   A comma separated list of file extensions to check'.PHP_EOL;
1401
-        echo '                The type of the file can be specified using: ext/type'.PHP_EOL;
1402
-        echo '                e.g., module/php,es/js'.PHP_EOL;
1403
-        echo ' <file>         One or more files and/or directories to check'.PHP_EOL;
1404
-        echo ' <fileList>     A file containing a list of files and/or directories to check (one per line)'.PHP_EOL;
1405
-        echo ' <filter>       Use the "gitmodified" filter, or specify the path to a custom filter class'.PHP_EOL;
1406
-        echo ' <generator>    Uses either the "HTML", "Markdown" or "Text" generator'.PHP_EOL;
1407
-        echo '                (forces documentation generation instead of checking)'.PHP_EOL;
1408
-        echo ' <patterns>     A comma separated list of patterns to ignore files and directories'.PHP_EOL;
1409
-        echo ' <processes>    How many files should be checked simultaneously (default is 1)'.PHP_EOL;
1410
-        echo ' <report>       Print either the "full", "xml", "checkstyle", "csv"'.PHP_EOL;
1411
-        echo '                "json", "junit", "emacs", "source", "summary", "diff"'.PHP_EOL;
1412
-        echo '                "svnblame", "gitblame", "hgblame" or "notifysend" report,'.PHP_EOL;
1413
-        echo '                or specify the path to a custom report class'.PHP_EOL;
1414
-        echo '                (the "full" report is printed by default)'.PHP_EOL;
1415
-        echo ' <reportFile>   Write the report to the specified file path'.PHP_EOL;
1416
-        echo ' <reportWidth>  How many columns wide screen reports should be printed'.PHP_EOL;
1417
-        echo '                or set to "auto" to use current screen width, where supported'.PHP_EOL;
1418
-        echo ' <severity>     The minimum severity required to display an error or warning'.PHP_EOL;
1419
-        echo ' <sniffs>       A comma separated list of sniff codes to include or exclude from checking'.PHP_EOL;
1420
-        echo '                (all sniffs must be part of the specified standard)'.PHP_EOL;
1421
-        echo ' <standard>     The name or path of the coding standard to use'.PHP_EOL;
1422
-        echo ' <stdinPath>    If processing STDIN, the file path that STDIN will be processed as'.PHP_EOL;
1423
-        echo ' <tabWidth>     The number of spaces each tab represents'.PHP_EOL;
1396
+        echo ' <cacheFile>    Use a specific file for caching (uses a temporary file by default)' . PHP_EOL;
1397
+        echo ' <basepath>     A path to strip from the front of file paths inside reports' . PHP_EOL;
1398
+        echo ' <bootstrap>    A comma separated list of files to run before processing begins' . PHP_EOL;
1399
+        echo ' <encoding>     The encoding of the files being checked (default is utf-8)' . PHP_EOL;
1400
+        echo ' <extensions>   A comma separated list of file extensions to check' . PHP_EOL;
1401
+        echo '                The type of the file can be specified using: ext/type' . PHP_EOL;
1402
+        echo '                e.g., module/php,es/js' . PHP_EOL;
1403
+        echo ' <file>         One or more files and/or directories to check' . PHP_EOL;
1404
+        echo ' <fileList>     A file containing a list of files and/or directories to check (one per line)' . PHP_EOL;
1405
+        echo ' <filter>       Use the "gitmodified" filter, or specify the path to a custom filter class' . PHP_EOL;
1406
+        echo ' <generator>    Uses either the "HTML", "Markdown" or "Text" generator' . PHP_EOL;
1407
+        echo '                (forces documentation generation instead of checking)' . PHP_EOL;
1408
+        echo ' <patterns>     A comma separated list of patterns to ignore files and directories' . PHP_EOL;
1409
+        echo ' <processes>    How many files should be checked simultaneously (default is 1)' . PHP_EOL;
1410
+        echo ' <report>       Print either the "full", "xml", "checkstyle", "csv"' . PHP_EOL;
1411
+        echo '                "json", "junit", "emacs", "source", "summary", "diff"' . PHP_EOL;
1412
+        echo '                "svnblame", "gitblame", "hgblame" or "notifysend" report,' . PHP_EOL;
1413
+        echo '                or specify the path to a custom report class' . PHP_EOL;
1414
+        echo '                (the "full" report is printed by default)' . PHP_EOL;
1415
+        echo ' <reportFile>   Write the report to the specified file path' . PHP_EOL;
1416
+        echo ' <reportWidth>  How many columns wide screen reports should be printed' . PHP_EOL;
1417
+        echo '                or set to "auto" to use current screen width, where supported' . PHP_EOL;
1418
+        echo ' <severity>     The minimum severity required to display an error or warning' . PHP_EOL;
1419
+        echo ' <sniffs>       A comma separated list of sniff codes to include or exclude from checking' . PHP_EOL;
1420
+        echo '                (all sniffs must be part of the specified standard)' . PHP_EOL;
1421
+        echo ' <standard>     The name or path of the coding standard to use' . PHP_EOL;
1422
+        echo ' <stdinPath>    If processing STDIN, the file path that STDIN will be processed as' . PHP_EOL;
1423
+        echo ' <tabWidth>     The number of spaces each tab represents' . PHP_EOL;
1424 1424
 
1425 1425
     }//end printPHPCSUsage()
1426 1426
 
@@ -1432,48 +1432,48 @@  discard block
 block discarded – undo
1432 1432
      */
1433 1433
     public function printPHPCBFUsage()
1434 1434
     {
1435
-        echo 'Usage: phpcbf [-nwli] [-d key[=value]] [--ignore-annotations] [--bootstrap=<bootstrap>]'.PHP_EOL;
1436
-        echo '  [--standard=<standard>] [--sniffs=<sniffs>] [--exclude=<sniffs>] [--suffix=<suffix>]'.PHP_EOL;
1437
-        echo '  [--severity=<severity>] [--error-severity=<severity>] [--warning-severity=<severity>]'.PHP_EOL;
1438
-        echo '  [--tab-width=<tabWidth>] [--encoding=<encoding>] [--parallel=<processes>]'.PHP_EOL;
1439
-        echo '  [--basepath=<basepath>] [--extensions=<extensions>] [--ignore=<patterns>]'.PHP_EOL;
1440
-        echo '  [--stdin-path=<stdinPath>] [--file-list=<fileList>] [--filter=<filter>] <file> - ...'.PHP_EOL;
1435
+        echo 'Usage: phpcbf [-nwli] [-d key[=value]] [--ignore-annotations] [--bootstrap=<bootstrap>]' . PHP_EOL;
1436
+        echo '  [--standard=<standard>] [--sniffs=<sniffs>] [--exclude=<sniffs>] [--suffix=<suffix>]' . PHP_EOL;
1437
+        echo '  [--severity=<severity>] [--error-severity=<severity>] [--warning-severity=<severity>]' . PHP_EOL;
1438
+        echo '  [--tab-width=<tabWidth>] [--encoding=<encoding>] [--parallel=<processes>]' . PHP_EOL;
1439
+        echo '  [--basepath=<basepath>] [--extensions=<extensions>] [--ignore=<patterns>]' . PHP_EOL;
1440
+        echo '  [--stdin-path=<stdinPath>] [--file-list=<fileList>] [--filter=<filter>] <file> - ...' . PHP_EOL;
1441 1441
         echo PHP_EOL;
1442
-        echo ' -     Fix STDIN instead of local files and directories'.PHP_EOL;
1443
-        echo ' -n    Do not fix warnings (shortcut for --warning-severity=0)'.PHP_EOL;
1444
-        echo ' -w    Fix both warnings and errors (on by default)'.PHP_EOL;
1445
-        echo ' -l    Local directory only, no recursion'.PHP_EOL;
1446
-        echo ' -p    Show progress of the run'.PHP_EOL;
1447
-        echo ' -q    Quiet mode; disables progress and verbose output'.PHP_EOL;
1448
-        echo ' -v    Print processed files'.PHP_EOL;
1449
-        echo ' -vv   Print ruleset and token output'.PHP_EOL;
1450
-        echo ' -vvv  Print sniff processing information'.PHP_EOL;
1451
-        echo ' -i    Show a list of installed coding standards'.PHP_EOL;
1452
-        echo ' -d    Set the [key] php.ini value to [value] or [true] if value is omitted'.PHP_EOL;
1442
+        echo ' -     Fix STDIN instead of local files and directories' . PHP_EOL;
1443
+        echo ' -n    Do not fix warnings (shortcut for --warning-severity=0)' . PHP_EOL;
1444
+        echo ' -w    Fix both warnings and errors (on by default)' . PHP_EOL;
1445
+        echo ' -l    Local directory only, no recursion' . PHP_EOL;
1446
+        echo ' -p    Show progress of the run' . PHP_EOL;
1447
+        echo ' -q    Quiet mode; disables progress and verbose output' . PHP_EOL;
1448
+        echo ' -v    Print processed files' . PHP_EOL;
1449
+        echo ' -vv   Print ruleset and token output' . PHP_EOL;
1450
+        echo ' -vvv  Print sniff processing information' . PHP_EOL;
1451
+        echo ' -i    Show a list of installed coding standards' . PHP_EOL;
1452
+        echo ' -d    Set the [key] php.ini value to [value] or [true] if value is omitted' . PHP_EOL;
1453 1453
         echo PHP_EOL;
1454
-        echo ' --help                Print this help message'.PHP_EOL;
1455
-        echo ' --version             Print version information'.PHP_EOL;
1456
-        echo ' --ignore-annotations  Ignore all phpcs: annotations in code comments'.PHP_EOL;
1454
+        echo ' --help                Print this help message' . PHP_EOL;
1455
+        echo ' --version             Print version information' . PHP_EOL;
1456
+        echo ' --ignore-annotations  Ignore all phpcs: annotations in code comments' . PHP_EOL;
1457 1457
         echo PHP_EOL;
1458
-        echo ' <basepath>    A path to strip from the front of file paths inside reports'.PHP_EOL;
1459
-        echo ' <bootstrap>   A comma separated list of files to run before processing begins'.PHP_EOL;
1460
-        echo ' <encoding>    The encoding of the files being fixed (default is utf-8)'.PHP_EOL;
1461
-        echo ' <extensions>  A comma separated list of file extensions to fix'.PHP_EOL;
1462
-        echo '               The type of the file can be specified using: ext/type'.PHP_EOL;
1463
-        echo '               e.g., module/php,es/js'.PHP_EOL;
1464
-        echo ' <file>        One or more files and/or directories to fix'.PHP_EOL;
1465
-        echo ' <fileList>    A file containing a list of files and/or directories to fix (one per line)'.PHP_EOL;
1466
-        echo ' <filter>      Use the "gitmodified" filter, or specify the path to a custom filter class'.PHP_EOL;
1467
-        echo ' <patterns>    A comma separated list of patterns to ignore files and directories'.PHP_EOL;
1468
-        echo ' <processes>   How many files should be fixed simultaneously (default is 1)'.PHP_EOL;
1469
-        echo ' <severity>    The minimum severity required to fix an error or warning'.PHP_EOL;
1470
-        echo ' <sniffs>      A comma separated list of sniff codes to include or exclude from fixing'.PHP_EOL;
1471
-        echo '               (all sniffs must be part of the specified standard)'.PHP_EOL;
1472
-        echo ' <standard>    The name or path of the coding standard to use'.PHP_EOL;
1473
-        echo ' <stdinPath>   If processing STDIN, the file path that STDIN will be processed as'.PHP_EOL;
1474
-        echo ' <suffix>      Write modified files to a filename using this suffix'.PHP_EOL;
1475
-        echo '               ("diff" and "patch" are not used in this mode)'.PHP_EOL;
1476
-        echo ' <tabWidth>    The number of spaces each tab represents'.PHP_EOL;
1458
+        echo ' <basepath>    A path to strip from the front of file paths inside reports' . PHP_EOL;
1459
+        echo ' <bootstrap>   A comma separated list of files to run before processing begins' . PHP_EOL;
1460
+        echo ' <encoding>    The encoding of the files being fixed (default is utf-8)' . PHP_EOL;
1461
+        echo ' <extensions>  A comma separated list of file extensions to fix' . PHP_EOL;
1462
+        echo '               The type of the file can be specified using: ext/type' . PHP_EOL;
1463
+        echo '               e.g., module/php,es/js' . PHP_EOL;
1464
+        echo ' <file>        One or more files and/or directories to fix' . PHP_EOL;
1465
+        echo ' <fileList>    A file containing a list of files and/or directories to fix (one per line)' . PHP_EOL;
1466
+        echo ' <filter>      Use the "gitmodified" filter, or specify the path to a custom filter class' . PHP_EOL;
1467
+        echo ' <patterns>    A comma separated list of patterns to ignore files and directories' . PHP_EOL;
1468
+        echo ' <processes>   How many files should be fixed simultaneously (default is 1)' . PHP_EOL;
1469
+        echo ' <severity>    The minimum severity required to fix an error or warning' . PHP_EOL;
1470
+        echo ' <sniffs>      A comma separated list of sniff codes to include or exclude from fixing' . PHP_EOL;
1471
+        echo '               (all sniffs must be part of the specified standard)' . PHP_EOL;
1472
+        echo ' <standard>    The name or path of the coding standard to use' . PHP_EOL;
1473
+        echo ' <stdinPath>   If processing STDIN, the file path that STDIN will be processed as' . PHP_EOL;
1474
+        echo ' <suffix>      Write modified files to a filename using this suffix' . PHP_EOL;
1475
+        echo '               ("diff" and "patch" are not used in this mode)' . PHP_EOL;
1476
+        echo ' <tabWidth>    The number of spaces each tab represents' . PHP_EOL;
1477 1477
 
1478 1478
     }//end printPHPCBFUsage()
1479 1479
 
@@ -1487,19 +1487,19 @@  discard block
 block discarded – undo
1487 1487
      * @see    setConfigData()
1488 1488
      * @see    getAllConfigData()
1489 1489
      */
1490
-    public static function getConfigData($key)
1490
+    public static function getConfigData( $key )
1491 1491
     {
1492 1492
         $phpCodeSnifferConfig = self::getAllConfigData();
1493 1493
 
1494
-        if ($phpCodeSnifferConfig === null) {
1494
+        if ( $phpCodeSnifferConfig === null ) {
1495 1495
             return null;
1496 1496
         }
1497 1497
 
1498
-        if (isset($phpCodeSnifferConfig[$key]) === false) {
1498
+        if ( isset( $phpCodeSnifferConfig[ $key ] ) === false ) {
1499 1499
             return null;
1500 1500
         }
1501 1501
 
1502
-        return $phpCodeSnifferConfig[$key];
1502
+        return $phpCodeSnifferConfig[ $key ];
1503 1503
 
1504 1504
     }//end getConfigData()
1505 1505
 
@@ -1512,34 +1512,34 @@  discard block
 block discarded – undo
1512 1512
      * @return string|null
1513 1513
      * @see    getConfigData()
1514 1514
      */
1515
-    public static function getExecutablePath($name)
1515
+    public static function getExecutablePath( $name )
1516 1516
     {
1517
-        $data = self::getConfigData($name.'_path');
1518
-        if ($data !== null) {
1517
+        $data = self::getConfigData( $name . '_path' );
1518
+        if ( $data !== null ) {
1519 1519
             return $data;
1520 1520
         }
1521 1521
 
1522
-        if ($name === "php") {
1522
+        if ( $name === "php" ) {
1523 1523
             // For php, we know the executable path. There's no need to look it up.
1524 1524
             return PHP_BINARY;
1525 1525
         }
1526 1526
 
1527
-        if (array_key_exists($name, self::$executablePaths) === true) {
1528
-            return self::$executablePaths[$name];
1527
+        if ( array_key_exists( $name, self::$executablePaths ) === true ) {
1528
+            return self::$executablePaths[ $name ];
1529 1529
         }
1530 1530
 
1531
-        if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
1532
-            $cmd = 'where '.escapeshellarg($name).' 2> nul';
1531
+        if ( strtoupper( substr( PHP_OS, 0, 3 ) ) === 'WIN' ) {
1532
+            $cmd = 'where ' . escapeshellarg( $name ) . ' 2> nul';
1533 1533
         } else {
1534
-            $cmd = 'which '.escapeshellarg($name).' 2> /dev/null';
1534
+            $cmd = 'which ' . escapeshellarg( $name ) . ' 2> /dev/null';
1535 1535
         }
1536 1536
 
1537
-        $result = exec($cmd, $output, $retVal);
1538
-        if ($retVal !== 0) {
1537
+        $result = exec( $cmd, $output, $retVal );
1538
+        if ( $retVal !== 0 ) {
1539 1539
             $result = null;
1540 1540
         }
1541 1541
 
1542
-        self::$executablePaths[$name] = $result;
1542
+        self::$executablePaths[ $name ] = $result;
1543 1543
         return $result;
1544 1544
 
1545 1545
     }//end getExecutablePath()
@@ -1560,26 +1560,26 @@  discard block
 block discarded – undo
1560 1560
      * @see    getConfigData()
1561 1561
      * @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the config file can not be written.
1562 1562
      */
1563
-    public static function setConfigData($key, $value, $temp=false)
1563
+    public static function setConfigData( $key, $value, $temp = false )
1564 1564
     {
1565
-        if (isset(self::$overriddenDefaults['runtime-set']) === true
1566
-            && isset(self::$overriddenDefaults['runtime-set'][$key]) === true
1565
+        if ( isset( self::$overriddenDefaults[ 'runtime-set' ] ) === true
1566
+            && isset( self::$overriddenDefaults[ 'runtime-set' ][ $key ] ) === true
1567 1567
         ) {
1568 1568
             return false;
1569 1569
         }
1570 1570
 
1571
-        if ($temp === false) {
1571
+        if ( $temp === false ) {
1572 1572
             $path = '';
1573
-            if (is_callable('\Phar::running') === true) {
1574
-                $path = \Phar::running(false);
1573
+            if ( is_callable( '\Phar::running' ) === true ) {
1574
+                $path = \Phar::running( false );
1575 1575
             }
1576 1576
 
1577
-            if ($path !== '') {
1578
-                $configFile = dirname($path).DIRECTORY_SEPARATOR.'CodeSniffer.conf';
1577
+            if ( $path !== '' ) {
1578
+                $configFile = dirname( $path ) . DIRECTORY_SEPARATOR . 'CodeSniffer.conf';
1579 1579
             } else {
1580
-                $configFile = dirname(__DIR__).DIRECTORY_SEPARATOR.'CodeSniffer.conf';
1581
-                if (is_file($configFile) === false
1582
-                    && strpos('@data_dir@', '@data_dir') === false
1580
+                $configFile = dirname( __DIR__ ) . DIRECTORY_SEPARATOR . 'CodeSniffer.conf';
1581
+                if ( is_file( $configFile ) === false
1582
+                    && strpos( '@data_dir@', '@data_dir' ) === false
1583 1583
                 ) {
1584 1584
                     // If data_dir was replaced, this is a PEAR install and we can
1585 1585
                     // use the PEAR data dir to store the conf file.
@@ -1587,32 +1587,32 @@  discard block
 block discarded – undo
1587 1587
                 }
1588 1588
             }
1589 1589
 
1590
-            if (is_file($configFile) === true
1591
-                && is_writable($configFile) === false
1590
+            if ( is_file( $configFile ) === true
1591
+                && is_writable( $configFile ) === false
1592 1592
             ) {
1593
-                $error = 'ERROR: Config file '.$configFile.' is not writable'.PHP_EOL.PHP_EOL;
1594
-                throw new DeepExitException($error, 3);
1593
+                $error = 'ERROR: Config file ' . $configFile . ' is not writable' . PHP_EOL . PHP_EOL;
1594
+                throw new DeepExitException( $error, 3 );
1595 1595
             }
1596 1596
         }//end if
1597 1597
 
1598 1598
         $phpCodeSnifferConfig = self::getAllConfigData();
1599 1599
 
1600
-        if ($value === null) {
1601
-            if (isset($phpCodeSnifferConfig[$key]) === true) {
1602
-                unset($phpCodeSnifferConfig[$key]);
1600
+        if ( $value === null ) {
1601
+            if ( isset( $phpCodeSnifferConfig[ $key ] ) === true ) {
1602
+                unset( $phpCodeSnifferConfig[ $key ] );
1603 1603
             }
1604 1604
         } else {
1605
-            $phpCodeSnifferConfig[$key] = $value;
1605
+            $phpCodeSnifferConfig[ $key ] = $value;
1606 1606
         }
1607 1607
 
1608
-        if ($temp === false) {
1609
-            $output  = '<'.'?php'."\n".' $phpCodeSnifferConfig = ';
1610
-            $output .= var_export($phpCodeSnifferConfig, true);
1611
-            $output .= "\n?".'>';
1608
+        if ( $temp === false ) {
1609
+            $output  = '<' . '?php' . "\n" . ' $phpCodeSnifferConfig = ';
1610
+            $output .= var_export( $phpCodeSnifferConfig, true );
1611
+            $output .= "\n?" . '>';
1612 1612
 
1613
-            if (file_put_contents($configFile, $output) === false) {
1614
-                $error = 'ERROR: Config file '.$configFile.' could not be written'.PHP_EOL.PHP_EOL;
1615
-                throw new DeepExitException($error, 3);
1613
+            if ( file_put_contents( $configFile, $output ) === false ) {
1614
+                $error = 'ERROR: Config file ' . $configFile . ' could not be written' . PHP_EOL . PHP_EOL;
1615
+                throw new DeepExitException( $error, 3 );
1616 1616
             }
1617 1617
 
1618 1618
             self::$configDataFile = $configFile;
@@ -1622,10 +1622,10 @@  discard block
 block discarded – undo
1622 1622
 
1623 1623
         // If the installed paths are being set, make sure all known
1624 1624
         // standards paths are added to the autoloader.
1625
-        if ($key === 'installed_paths') {
1625
+        if ( $key === 'installed_paths' ) {
1626 1626
             $installedStandards = Util\Standards::getInstalledStandardDetails();
1627
-            foreach ($installedStandards as $name => $details) {
1628
-                Autoload::addSearchPath($details['path'], $details['namespace']);
1627
+            foreach ( $installedStandards as $name => $details ) {
1628
+                Autoload::addSearchPath( $details[ 'path' ], $details[ 'namespace' ] );
1629 1629
             }
1630 1630
         }
1631 1631
 
@@ -1642,34 +1642,34 @@  discard block
 block discarded – undo
1642 1642
      */
1643 1643
     public static function getAllConfigData()
1644 1644
     {
1645
-        if (self::$configData !== null) {
1645
+        if ( self::$configData !== null ) {
1646 1646
             return self::$configData;
1647 1647
         }
1648 1648
 
1649 1649
         $path = '';
1650
-        if (is_callable('\Phar::running') === true) {
1651
-            $path = \Phar::running(false);
1650
+        if ( is_callable( '\Phar::running' ) === true ) {
1651
+            $path = \Phar::running( false );
1652 1652
         }
1653 1653
 
1654
-        if ($path !== '') {
1655
-            $configFile = dirname($path).DIRECTORY_SEPARATOR.'CodeSniffer.conf';
1654
+        if ( $path !== '' ) {
1655
+            $configFile = dirname( $path ) . DIRECTORY_SEPARATOR . 'CodeSniffer.conf';
1656 1656
         } else {
1657
-            $configFile = dirname(__DIR__).DIRECTORY_SEPARATOR.'CodeSniffer.conf';
1658
-            if (is_file($configFile) === false
1659
-                && strpos('@data_dir@', '@data_dir') === false
1657
+            $configFile = dirname( __DIR__ ) . DIRECTORY_SEPARATOR . 'CodeSniffer.conf';
1658
+            if ( is_file( $configFile ) === false
1659
+                && strpos( '@data_dir@', '@data_dir' ) === false
1660 1660
             ) {
1661 1661
                 $configFile = '@data_dir@/PHP_CodeSniffer/CodeSniffer.conf';
1662 1662
             }
1663 1663
         }
1664 1664
 
1665
-        if (is_file($configFile) === false) {
1666
-            self::$configData = [];
1667
-            return [];
1665
+        if ( is_file( $configFile ) === false ) {
1666
+            self::$configData = [ ];
1667
+            return [ ];
1668 1668
         }
1669 1669
 
1670
-        if (is_readable($configFile) === false) {
1671
-            $error = 'ERROR: Config file '.$configFile.' is not readable'.PHP_EOL.PHP_EOL;
1672
-            throw new DeepExitException($error, 3);
1670
+        if ( is_readable( $configFile ) === false ) {
1671
+            $error = 'ERROR: Config file ' . $configFile . ' is not readable' . PHP_EOL . PHP_EOL;
1672
+            throw new DeepExitException( $error, 3 );
1673 1673
         }
1674 1674
 
1675 1675
         include $configFile;
@@ -1687,25 +1687,25 @@  discard block
 block discarded – undo
1687 1687
      *
1688 1688
      * @return void
1689 1689
      */
1690
-    public function printConfigData($data)
1690
+    public function printConfigData( $data )
1691 1691
     {
1692 1692
         $max  = 0;
1693
-        $keys = array_keys($data);
1694
-        foreach ($keys as $key) {
1695
-            $len = strlen($key);
1696
-            if (strlen($key) > $max) {
1693
+        $keys = array_keys( $data );
1694
+        foreach ( $keys as $key ) {
1695
+            $len = strlen( $key );
1696
+            if ( strlen( $key ) > $max ) {
1697 1697
                 $max = $len;
1698 1698
             }
1699 1699
         }
1700 1700
 
1701
-        if ($max === 0) {
1701
+        if ( $max === 0 ) {
1702 1702
             return;
1703 1703
         }
1704 1704
 
1705 1705
         $max += 2;
1706
-        ksort($data);
1707
-        foreach ($data as $name => $value) {
1708
-            echo str_pad($name.': ', $max).$value.PHP_EOL;
1706
+        ksort( $data );
1707
+        foreach ( $data as $name => $value ) {
1708
+            echo str_pad( $name . ': ', $max ) . $value . PHP_EOL;
1709 1709
         }
1710 1710
 
1711 1711
     }//end printConfigData()
Please login to merge, or discard this patch.
vendor/squizlabs/php_codesniffer/src/Sniffs/Sniff.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@
 block discarded – undo
74 74
      *                  pointer is reached. Return (count($tokens) + 1) to skip
75 75
      *                  the rest of the file.
76 76
      */
77
-    public function process(File $phpcsFile, $stackPtr);
77
+    public function process( File $phpcsFile, $stackPtr );
78 78
 
79 79
 
80 80
 }//end interface
Please login to merge, or discard this patch.