Passed
Pull Request — master (#153)
by
unknown
02:29
created
src/Codor/Sniffs/Classes/NewInstanceSniff.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
 
8 8
 class NewInstanceSniff implements PHP_CodeSniffer_Sniff
9 9
 {
10
-  /**
10
+    /**
11 11
      * The forbidden strings this sniff looks for.
12 12
      * @var array
13 13
      */
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php declare(strict_types = 1);
1
+<?php declare(strict_types=1);
2 2
 
3 3
 namespace Codor\Sniffs\Classes;
4 4
 
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
      * The forbidden strings this sniff looks for.
12 12
      * @var array
13 13
      */
14
-    protected $keywords = ['And', '_and', 'Or', '_or'];
14
+    protected $keywords = [ 'And', '_and', 'Or', '_or' ];
15 15
 
16 16
     /**
17 17
      * Returns the token types that this sniff is interested in.
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
      */
20 20
     public function register(): array
21 21
     {
22
-        return [T_FUNCTION];
22
+        return [ T_FUNCTION ];
23 23
     }
24 24
 
25 25
     /**
@@ -33,15 +33,15 @@  discard block
 block discarded – undo
33 33
     public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
34 34
     {
35 35
         $tokens = $phpcsFile->getTokens();
36
-        $functionName = $tokens[$stackPtr + 2]['content'];
37
-        $token = $tokens[$stackPtr];
36
+        $functionName = $tokens[ $stackPtr + 2 ][ 'content' ];
37
+        $token = $tokens[ $stackPtr ];
38 38
      
39
-        $start = $token['scope_opener'];
40
-        $end = $token['scope_closer'];
39
+        $start = $token[ 'scope_opener' ];
40
+        $end = $token[ 'scope_closer' ];
41 41
 
42 42
         foreach (range($start, $end) as $index) {
43
-            if ($tokens[$index]['type'] === 'T_NEW') {
44
-                $phpcsFile->addWarning($this->getWarningMessage($functionName), $tokens[$index]['line'], __CLASS__);
43
+            if ($tokens[ $index ][ 'type' ] === 'T_NEW') {
44
+                $phpcsFile->addWarning($this->getWarningMessage($functionName), $tokens[ $index ][ 'line' ], __CLASS__);
45 45
             }
46 46
         }
47 47
     }
Please login to merge, or discard this patch.