Passed
Pull Request — master (#37)
by
unknown
02:35
created
src/Standards/BestIt/Sniffs/Formatting/ClassSortingSniff.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -150,19 +150,19 @@  discard block
 block discarded – undo
150 150
         $lastVisibility = null;
151 151
         $lastVisibilityEnd = -1;
152 152
 
153
-        for ($i = $position; $i < $endPosition; $i++){
153
+        for ($i = $position; $i < $endPosition; $i++) {
154 154
             if ($tokens[$i]['type'] === 'T_CONST') {
155 155
                 $classElements[] = [
156 156
                     'type' => 'T_CONST',
157 157
                     'visibility' => $i <= $lastVisibilityEnd ? $lastVisibility : 'T_PUBLIC',
158 158
                     'name' => $tokens[$file->findNext(T_STRING, $i)]['content']
159 159
                 ];
160
-            } elseif($tokens[$i]['type'] === 'T_FUNCTION'){
160
+            } elseif ($tokens[$i]['type'] === 'T_FUNCTION') {
161 161
                 $type = 'T_FUNCTION';
162 162
                 $name = $tokens[$file->findNext(T_STRING, $i)]['content'];
163
-                if (strcasecmp($name, '__destruct') === 0){
163
+                if (strcasecmp($name, '__destruct') === 0) {
164 164
                     $type .= '-DESTRUCT';
165
-                } elseif (strcasecmp($name, '__construct') === 0){
165
+                } elseif (strcasecmp($name, '__construct') === 0) {
166 166
                     $type .= '-CONSTRUCT';
167 167
                 }
168 168
 
@@ -173,13 +173,13 @@  discard block
 block discarded – undo
173 173
                 ];
174 174
                 $functionStart = $i;
175 175
                 $functionEnd = $file->findEndOfStatement($i);
176
-            } elseif ($tokens[$i]['type'] === 'T_VARIABLE' && ($i < $functionStart || $i > $functionEnd)){
176
+            } elseif ($tokens[$i]['type'] === 'T_VARIABLE' && ($i < $functionStart || $i > $functionEnd)) {
177 177
                 $classElements[] = [
178 178
                     'type' => 'T_VARIABLE',
179 179
                     'visibility' => $i <= $lastVisibilityEnd ? $lastVisibility : 'T_PUBLIC',
180 180
                     'name' => $tokens[$i]['content']
181 181
                 ];
182
-            } elseif (in_array($tokens[$i]['type'], ['T_PRIVATE', 'T_PROTECTED', 'T_PUBLIC'])){
182
+            } elseif (in_array($tokens[$i]['type'], ['T_PRIVATE', 'T_PROTECTED', 'T_PUBLIC'])) {
183 183
                 $lastVisibility = $tokens[$i]['type'];
184 184
                 $lastVisibilityEnd = $file->findEndOfStatement($i);
185 185
             }
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
         $originalClassElements = $classElements;
189 189
         usort($classElements, [$this, 'sort']);
190 190
 
191
-        if ($classElements !== $originalClassElements){
191
+        if ($classElements !== $originalClassElements) {
192 192
             self::throwFixableError($file, $position);
193 193
         }
194 194
     }
Please login to merge, or discard this patch.