@@ -40,9 +40,9 @@ discard block |
||
| 40 | 40 | * @var array(string => string|null) |
| 41 | 41 | */ |
| 42 | 42 | public $forbiddenFunctions = array( |
| 43 | - 'sizeof' => 'count', |
|
| 44 | - 'delete' => 'unset', |
|
| 45 | - ); |
|
| 43 | + 'sizeof' => 'count', |
|
| 44 | + 'delete' => 'unset', |
|
| 45 | + ); |
|
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * A cache of forbidden function names, for faster lookups. |
@@ -121,19 +121,19 @@ discard block |
||
| 121 | 121 | $tokens = $phpcsFile->getTokens(); |
| 122 | 122 | |
| 123 | 123 | $ignore = array( |
| 124 | - T_DOUBLE_COLON => true, |
|
| 125 | - T_OBJECT_OPERATOR => true, |
|
| 126 | - T_FUNCTION => true, |
|
| 127 | - T_CONST => true, |
|
| 128 | - T_PUBLIC => true, |
|
| 129 | - T_PRIVATE => true, |
|
| 130 | - T_PROTECTED => true, |
|
| 131 | - T_AS => true, |
|
| 132 | - T_NEW => true, |
|
| 133 | - T_INSTEADOF => true, |
|
| 134 | - T_NS_SEPARATOR => true, |
|
| 135 | - T_IMPLEMENTS => true, |
|
| 136 | - ); |
|
| 124 | + T_DOUBLE_COLON => true, |
|
| 125 | + T_OBJECT_OPERATOR => true, |
|
| 126 | + T_FUNCTION => true, |
|
| 127 | + T_CONST => true, |
|
| 128 | + T_PUBLIC => true, |
|
| 129 | + T_PRIVATE => true, |
|
| 130 | + T_PROTECTED => true, |
|
| 131 | + T_AS => true, |
|
| 132 | + T_NEW => true, |
|
| 133 | + T_INSTEADOF => true, |
|
| 134 | + T_NS_SEPARATOR => true, |
|
| 135 | + T_IMPLEMENTS => true, |
|
| 136 | + ); |
|
| 137 | 137 | |
| 138 | 138 | $prevToken = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true); |
| 139 | 139 | |
@@ -204,7 +204,7 @@ |
||
| 204 | 204 | * |
| 205 | 205 | * @return void |
| 206 | 206 | */ |
| 207 | - protected function addError($phpcsFile, $stackPtr, $function, $pattern=null) |
|
| 207 | + protected function addError($phpcsFile, $stackPtr, $function, $pattern = null) |
|
| 208 | 208 | { |
| 209 | 209 | $data = array($function); |
| 210 | 210 | $error = 'The use of function %s() is '; |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | /** |
| 43 | 43 | * Processes this test, when one of its tokens is encountered. |
| 44 | 44 | * |
| 45 | - * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
| 45 | + * @param File $phpcsFile The file being scanned. |
|
| 46 | 46 | * @param int $stackPtr The position of the current token in the |
| 47 | 47 | * stack passed in $tokens. |
| 48 | 48 | * |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | /** |
| 238 | 238 | * Add and fix the missing brackets error. |
| 239 | 239 | * |
| 240 | - * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
| 240 | + * @param File $phpcsFile The file being scanned. |
|
| 241 | 241 | * @param int $stackPtr The position of the current token in the |
| 242 | 242 | * stack passed in $tokens. |
| 243 | 243 | * |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | return array( |
| 42 | 42 | T_OPEN_TAG, |
| 43 | 43 | T_OPEN_TAG_WITH_ECHO, |
| 44 | - ); |
|
| 44 | + ); |
|
| 45 | 45 | |
| 46 | 46 | }//end register() |
| 47 | 47 | |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | $nextVar['content'], |
| 77 | 77 | $openTag['content'], |
| 78 | 78 | $nextVar['content'], |
| 79 | - ); |
|
| 79 | + ); |
|
| 80 | 80 | $phpcsFile->addError($error, $stackPtr, 'EchoFound', $data); |
| 81 | 81 | } |
| 82 | 82 | |
@@ -204,7 +204,7 @@ |
||
| 204 | 204 | * |
| 205 | 205 | * @return void |
| 206 | 206 | */ |
| 207 | - protected function addError($phpcsFile, $stackPtr, $function, $pattern=null) |
|
| 207 | + protected function addError($phpcsFile, $stackPtr, $function, $pattern = null) |
|
| 208 | 208 | { |
| 209 | 209 | $data = array($function); |
| 210 | 210 | $error = 'The use of function %s() is '; |
@@ -38,8 +38,8 @@ discard block |
||
| 38 | 38 | * @var array |
| 39 | 39 | */ |
| 40 | 40 | protected $properties = array( |
| 41 | - 'svn:keywords' => 'Author Id Revision', |
|
| 42 | - 'svn:eol-style' => 'native', |
|
| 41 | + 'svn:keywords' => 'Author Id Revision', |
|
| 42 | + 'svn:eol-style' => 'native', |
|
| 43 | 43 | ); |
| 44 | 44 | |
| 45 | 45 | |
@@ -89,9 +89,9 @@ discard block |
||
| 89 | 89 | ) { |
| 90 | 90 | $error = 'Unexpected Subversion property "%s" = "%s"'; |
| 91 | 91 | $data = array( |
| 92 | - $key, |
|
| 93 | - $properties[$key], |
|
| 94 | - ); |
|
| 92 | + $key, |
|
| 93 | + $properties[$key], |
|
| 94 | + ); |
|
| 95 | 95 | $phpcsFile->addError($error, $stackPtr, 'Unexpected', $data); |
| 96 | 96 | continue; |
| 97 | 97 | } |
@@ -101,9 +101,9 @@ discard block |
||
| 101 | 101 | ) { |
| 102 | 102 | $error = 'Missing Subversion property "%s" = "%s"'; |
| 103 | 103 | $data = array( |
| 104 | - $key, |
|
| 105 | - $this->properties[$key], |
|
| 106 | - ); |
|
| 104 | + $key, |
|
| 105 | + $this->properties[$key], |
|
| 106 | + ); |
|
| 107 | 107 | $phpcsFile->addError($error, $stackPtr, 'Missing', $data); |
| 108 | 108 | continue; |
| 109 | 109 | } |
@@ -113,10 +113,10 @@ discard block |
||
| 113 | 113 | ) { |
| 114 | 114 | $error = 'Subversion property "%s" = "%s" does not match "%s"'; |
| 115 | 115 | $data = array( |
| 116 | - $key, |
|
| 117 | - $properties[$key], |
|
| 118 | - $this->properties[$key], |
|
| 119 | - ); |
|
| 116 | + $key, |
|
| 117 | + $properties[$key], |
|
| 118 | + $this->properties[$key], |
|
| 119 | + ); |
|
| 120 | 120 | $phpcsFile->addError($error, $stackPtr, 'NoMatch', $data); |
| 121 | 121 | } |
| 122 | 122 | }//end foreach |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | /** |
| 27 | 27 | * Returns an array of tokens this test wants to listen for. |
| 28 | 28 | * |
| 29 | - * @return array |
|
| 29 | + * @return integer[] |
|
| 30 | 30 | */ |
| 31 | 31 | public function register() |
| 32 | 32 | { |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | /** |
| 39 | 39 | * Processes this sniff when one of its tokens is encountered. |
| 40 | 40 | * |
| 41 | - * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
| 41 | + * @param File $phpcsFile The file being scanned. |
|
| 42 | 42 | * @param int $stackPtr The position of the current token |
| 43 | 43 | * in the stack passed in $tokens. |
| 44 | 44 | * |
@@ -35,9 +35,9 @@ discard block |
||
| 35 | 35 | * @var array |
| 36 | 36 | */ |
| 37 | 37 | public $supportedTokenizers = array( |
| 38 | - 'PHP', |
|
| 39 | - 'JS', |
|
| 40 | - ); |
|
| 38 | + 'PHP', |
|
| 39 | + 'JS', |
|
| 40 | + ); |
|
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | 43 | * If true, an error will be thrown; otherwise a warning. |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | return array( |
| 68 | 68 | T_STRING_CONCAT, |
| 69 | 69 | T_PLUS, |
| 70 | - ); |
|
| 70 | + ); |
|
| 71 | 71 | |
| 72 | 72 | }//end register() |
| 73 | 73 | |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | /** |
| 31 | 31 | * Returns an array of tokens this test wants to listen for. |
| 32 | 32 | * |
| 33 | - * @return array |
|
| 33 | + * @return string[] |
|
| 34 | 34 | */ |
| 35 | 35 | public function register() |
| 36 | 36 | { |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | /** |
| 43 | 43 | * Processes this test, when one of its tokens is encountered. |
| 44 | 44 | * |
| 45 | - * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
| 45 | + * @param File $phpcsFile The file being scanned. |
|
| 46 | 46 | * @param int $stackPtr The position of the current token |
| 47 | 47 | * in the stack passed in $tokens. |
| 48 | 48 | * |
@@ -93,16 +93,16 @@ |
||
| 93 | 93 | if ($nestingLevel > $this->absoluteNestingLevel) { |
| 94 | 94 | $error = 'Function\'s nesting level (%s) exceeds allowed maximum of %s'; |
| 95 | 95 | $data = array( |
| 96 | - $nestingLevel, |
|
| 97 | - $this->absoluteNestingLevel, |
|
| 98 | - ); |
|
| 96 | + $nestingLevel, |
|
| 97 | + $this->absoluteNestingLevel, |
|
| 98 | + ); |
|
| 99 | 99 | $phpcsFile->addError($error, $stackPtr, 'MaxExceeded', $data); |
| 100 | 100 | } else if ($nestingLevel > $this->nestingLevel) { |
| 101 | 101 | $warning = 'Function\'s nesting level (%s) exceeds %s; consider refactoring the function'; |
| 102 | 102 | $data = array( |
| 103 | 103 | $nestingLevel, |
| 104 | 104 | $this->nestingLevel, |
| 105 | - ); |
|
| 105 | + ); |
|
| 106 | 106 | $phpcsFile->addWarning($warning, $stackPtr, 'TooHigh', $data); |
| 107 | 107 | } |
| 108 | 108 | |
@@ -85,15 +85,15 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | // Predicate nodes for PHP. |
| 87 | 87 | $find = array( |
| 88 | - T_CASE => true, |
|
| 89 | - T_DEFAULT => true, |
|
| 90 | - T_CATCH => true, |
|
| 91 | - T_IF => true, |
|
| 92 | - T_FOR => true, |
|
| 93 | - T_FOREACH => true, |
|
| 94 | - T_WHILE => true, |
|
| 95 | - T_DO => true, |
|
| 96 | - T_ELSEIF => true, |
|
| 88 | + T_CASE => true, |
|
| 89 | + T_DEFAULT => true, |
|
| 90 | + T_CATCH => true, |
|
| 91 | + T_IF => true, |
|
| 92 | + T_FOR => true, |
|
| 93 | + T_FOREACH => true, |
|
| 94 | + T_WHILE => true, |
|
| 95 | + T_DO => true, |
|
| 96 | + T_ELSEIF => true, |
|
| 97 | 97 | ); |
| 98 | 98 | |
| 99 | 99 | $complexity = 1; |
@@ -108,16 +108,16 @@ discard block |
||
| 108 | 108 | if ($complexity > $this->absoluteComplexity) { |
| 109 | 109 | $error = 'Function\'s cyclomatic complexity (%s) exceeds allowed maximum of %s'; |
| 110 | 110 | $data = array( |
| 111 | - $complexity, |
|
| 112 | - $this->absoluteComplexity, |
|
| 113 | - ); |
|
| 111 | + $complexity, |
|
| 112 | + $this->absoluteComplexity, |
|
| 113 | + ); |
|
| 114 | 114 | $phpcsFile->addError($error, $stackPtr, 'MaxExceeded', $data); |
| 115 | 115 | } else if ($complexity > $this->complexity) { |
| 116 | 116 | $warning = 'Function\'s cyclomatic complexity (%s) exceeds %s; consider refactoring the function'; |
| 117 | 117 | $data = array( |
| 118 | 118 | $complexity, |
| 119 | 119 | $this->complexity, |
| 120 | - ); |
|
| 120 | + ); |
|
| 121 | 121 | $phpcsFile->addWarning($warning, $stackPtr, 'TooHigh', $data); |
| 122 | 122 | } |
| 123 | 123 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | /** |
| 27 | 27 | * Returns an array of tokens this test wants to listen for. |
| 28 | 28 | * |
| 29 | - * @return array |
|
| 29 | + * @return integer[] |
|
| 30 | 30 | */ |
| 31 | 31 | public function register() |
| 32 | 32 | { |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | /** |
| 39 | 39 | * Processes this sniff when one of its tokens is encountered. |
| 40 | 40 | * |
| 41 | - * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
| 41 | + * @param File $phpcsFile The file being scanned. |
|
| 42 | 42 | * @param int $stackPtr The position of the current token |
| 43 | 43 | * in the stack passed in $tokens. |
| 44 | 44 | * |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | 48 => 1, |
| 58 | 58 | 70 => 1, |
| 59 | 59 | 71 => 1, |
| 60 | - ); |
|
| 60 | + ); |
|
| 61 | 61 | |
| 62 | 62 | }//end getErrorList() |
| 63 | 63 | |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | 48 => 1, |
| 58 | 58 | 70 => 1, |
| 59 | 59 | 71 => 1, |
| 60 | - ); |
|
| 60 | + ); |
|
| 61 | 61 | |
| 62 | 62 | }//end getErrorList() |
| 63 | 63 | |