Completed
Pull Request — master (#116)
by Bill
03:51
created
src/Codor/Sniffs/Files/ForbiddenMethodsSniff.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
      * The methods that are forbidden.
12 12
      * @var array
13 13
      */
14
-    public $forbiddenMethods = ['raw', 'statement'];
14
+    public $forbiddenMethods = [ 'raw', 'statement' ];
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_OBJECT_OPERATOR, T_DOUBLE_COLON];
22
+        return [ T_OBJECT_OPERATOR, T_DOUBLE_COLON ];
23 23
     }
24 24
 
25 25
     /**
@@ -33,16 +33,16 @@  discard block
 block discarded – undo
33 33
     public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
34 34
     {
35 35
         $tokens = $phpcsFile->getTokens();
36
-        $potentialMethodToken = $tokens[$stackPtr + 1];
37
-        $openParenToken = $tokens[$stackPtr + 2];
36
+        $potentialMethodToken = $tokens[ $stackPtr + 1 ];
37
+        $openParenToken = $tokens[ $stackPtr + 2 ];
38 38
 
39
-        if ($openParenToken['type'] !== 'T_OPEN_PARENTHESIS') {
39
+        if ($openParenToken[ 'type' ] !== 'T_OPEN_PARENTHESIS') {
40 40
             return;
41 41
         }
42 42
 
43
-        $methodName = $potentialMethodToken['content'];
43
+        $methodName = $potentialMethodToken[ 'content' ];
44 44
         if (in_array($methodName, $this->forbiddenMethods, true)) {
45
-            $phpcsFile->addError("Call to method {$methodName} is forbidden.", $potentialMethodToken['line']);
45
+            $phpcsFile->addError("Call to method {$methodName} is forbidden.", $potentialMethodToken[ 'line' ]);
46 46
         }
47 47
     }
48 48
 }
Please login to merge, or discard this patch.