Completed
Pull Request — master (#49)
by Bill
01:55
created
src/Codor/Sniffs/Files/IndentationLevelSniff.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
      */
26 26
     public function register()
27 27
     {
28
-        return [T_FUNCTION, T_CLOSURE, T_SWITCH, T_TRY, T_CATCH];
28
+        return [ T_FUNCTION, T_CLOSURE, T_SWITCH, T_TRY, T_CATCH ];
29 29
     }
30 30
 
31 31
     /**
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
     public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
40 40
     {
41 41
         $tokens = $phpcsFile->getTokens();
42
-        $token = $tokens[$stackPtr];
42
+        $token = $tokens[ $stackPtr ];
43 43
         $this->maxIndentationFound = 0;
44 44
 
45 45
         // Ignore functions with no body
46
-        if (isset($token['scope_opener']) === false) {
46
+        if (isset($token[ 'scope_opener' ]) === false) {
47 47
             return;
48 48
         }
49 49
 
@@ -65,12 +65,12 @@  discard block
 block discarded – undo
65 65
      */
66 66
     protected function inspectScope(array $token, array $tokens)
67 67
     {
68
-        $start = $token['scope_opener'];
69
-        $end = $token['scope_closer'];
70
-        $this->relativeScopeLevel = $tokens[$start]['level'];
71
-        for ($index=$start; $index <= $end; $index++) {
72
-            $nestedToken = $tokens[$index];
73
-            if ($nestedToken['type'] === "T_SWITCH") {
68
+        $start = $token[ 'scope_opener' ];
69
+        $end = $token[ 'scope_closer' ];
70
+        $this->relativeScopeLevel = $tokens[ $start ][ 'level' ];
71
+        for ($index = $start; $index <= $end; $index++) {
72
+            $nestedToken = $tokens[ $index ];
73
+            if ($nestedToken[ 'type' ] === "T_SWITCH") {
74 74
                 return;
75 75
             }
76 76
             $this->adjustMaxIndentationFound($nestedToken);
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
      */
86 86
     protected function adjustMaxIndentationFound(array $nestedToken)
87 87
     {
88
-        $tokenNestedLevel = $nestedToken['level'];
88
+        $tokenNestedLevel = $nestedToken[ 'level' ];
89 89
         $nestedLevel = $tokenNestedLevel - $this->relativeScopeLevel;
90 90
         $nestedLevel > $this->maxIndentationFound ? $this->maxIndentationFound = $nestedLevel : null;
91 91
     }
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
         // indentation limit.
102 102
         $indentationFound = $this->maxIndentationFound - 1;
103 103
         $indentationLimit = $this->indentationLimit - 1;
104
-        return "{$indentationFound} indenation levels found. " .
104
+        return "{$indentationFound} indenation levels found. ".
105 105
         "Maximum of {$indentationLimit} indenation levels allowed.";
106 106
     }
107 107
 }
Please login to merge, or discard this patch.