@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | /** |
| 29 | 29 | * Returns the token types that this sniff is interested in. |
| 30 | 30 | * |
| 31 | - * @return int[] |
|
| 31 | + * @return integer[] |
|
| 32 | 32 | */ |
| 33 | 33 | public function register() |
| 34 | 34 | { |
@@ -40,11 +40,11 @@ discard block |
||
| 40 | 40 | /** |
| 41 | 41 | * Processes the tokens that this sniff is interested in. |
| 42 | 42 | * |
| 43 | - * @param PHP_CodeSniffer_File $phpcsFile The file where the token was found. |
|
| 43 | + * @param File $phpcsFile The file where the token was found. |
|
| 44 | 44 | * @param int $stackPtr The position in the stack where |
| 45 | 45 | * the token was found. |
| 46 | 46 | * |
| 47 | - * @return void |
|
| 47 | + * @return null|integer |
|
| 48 | 48 | * @throws PHP_CodeSniffer_Exception If jshint.js could not be run |
| 49 | 49 | */ |
| 50 | 50 | public function process(File $phpcsFile, $stackPtr) |
@@ -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 integer[] |
|
| 34 | 34 | */ |
| 35 | 35 | public function register() |
| 36 | 36 | { |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | /** |
| 43 | 43 | * Processes this sniff, 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 |
| 47 | 47 | * the stack passed in $tokens. |
| 48 | 48 | * |
@@ -34,10 +34,10 @@ |
||
| 34 | 34 | * @var array |
| 35 | 35 | */ |
| 36 | 36 | public $supportedTokenizers = array( |
| 37 | - 'PHP', |
|
| 38 | - 'JS', |
|
| 39 | - 'CSS', |
|
| 40 | - ); |
|
| 37 | + 'PHP', |
|
| 38 | + 'JS', |
|
| 39 | + 'CSS', |
|
| 40 | + ); |
|
| 41 | 41 | |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -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 integer[] |
|
| 34 | 34 | */ |
| 35 | 35 | public function register() |
| 36 | 36 | { |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | /** |
| 43 | 43 | * Processes this sniff, 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 |
| 47 | 47 | * the stack passed in $tokens. |
| 48 | 48 | * |
@@ -34,10 +34,10 @@ |
||
| 34 | 34 | * @var array |
| 35 | 35 | */ |
| 36 | 36 | public $supportedTokenizers = array( |
| 37 | - 'PHP', |
|
| 38 | - 'JS', |
|
| 39 | - 'CSS', |
|
| 40 | - ); |
|
| 37 | + 'PHP', |
|
| 38 | + 'JS', |
|
| 39 | + 'CSS', |
|
| 40 | + ); |
|
| 41 | 41 | |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | /** |
| 40 | 40 | * Returns an array of tokens this test wants to listen for. |
| 41 | 41 | * |
| 42 | - * @return array |
|
| 42 | + * @return integer[] |
|
| 43 | 43 | */ |
| 44 | 44 | public function register() |
| 45 | 45 | { |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | /** |
| 52 | 52 | * Processes this test, when one of its tokens is encountered. |
| 53 | 53 | * |
| 54 | - * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
| 54 | + * @param File $phpcsFile The file being scanned. |
|
| 55 | 55 | * @param int $stackPtr The position of the current token in |
| 56 | 56 | * the stack passed in $tokens. |
| 57 | 57 | * |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | /** |
| 78 | 78 | * Checks if a line is too long. |
| 79 | 79 | * |
| 80 | - * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
| 80 | + * @param File $phpcsFile The file being scanned. |
|
| 81 | 81 | * @param array $tokens The token stack. |
| 82 | 82 | * @param int $stackPtr The first token on the next line. |
| 83 | 83 | * |
@@ -131,16 +131,16 @@ |
||
| 131 | 131 | && $lineLength > $this->absoluteLineLimit |
| 132 | 132 | ) { |
| 133 | 133 | $data = array( |
| 134 | - $this->absoluteLineLimit, |
|
| 135 | - $lineLength, |
|
| 134 | + $this->absoluteLineLimit, |
|
| 135 | + $lineLength, |
|
| 136 | 136 | ); |
| 137 | 137 | |
| 138 | 138 | $error = 'Line exceeds maximum limit of %s characters; contains %s characters'; |
| 139 | 139 | $phpcsFile->addError($error, $stackPtr, 'MaxExceeded', $data); |
| 140 | 140 | } else if ($lineLength > $this->lineLimit) { |
| 141 | 141 | $data = array( |
| 142 | - $this->lineLimit, |
|
| 143 | - $lineLength, |
|
| 142 | + $this->lineLimit, |
|
| 143 | + $lineLength, |
|
| 144 | 144 | ); |
| 145 | 145 | |
| 146 | 146 | $warning = 'Line exceeds %s characters; contains %s characters'; |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | /** |
| 20 | 20 | * Returns an array of tokens this test wants to listen for. |
| 21 | 21 | * |
| 22 | - * @return array |
|
| 22 | + * @return string[] |
|
| 23 | 23 | */ |
| 24 | 24 | public function register() |
| 25 | 25 | { |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | /** |
| 32 | 32 | * Processes this test, when one of its tokens is encountered. |
| 33 | 33 | * |
| 34 | - * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
| 34 | + * @param File $phpcsFile The file being scanned. |
|
| 35 | 35 | * @param int $stackPtr The position of the current token in |
| 36 | 36 | * the stack passed in $tokens. |
| 37 | 37 | * |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | /** |
| 66 | 66 | * Processes this test, when one of its tokens is encountered. |
| 67 | 67 | * |
| 68 | - * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
| 68 | + * @param File $phpcsFile The file being scanned. |
|
| 69 | 69 | * @param int $stackPtr The position of the current token |
| 70 | 70 | * in the stack passed in $tokens. |
| 71 | 71 | * |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | /** |
| 94 | 94 | * Processes this test, when one of its tokens is encountered. |
| 95 | 95 | * |
| 96 | - * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
| 96 | + * @param File $phpcsFile The file being scanned. |
|
| 97 | 97 | * @param int $stackPtr The position of the current token |
| 98 | 98 | * in the stack passed in $tokens. |
| 99 | 99 | * |
@@ -36,9 +36,9 @@ discard block |
||
| 36 | 36 | * @var array |
| 37 | 37 | */ |
| 38 | 38 | public $supportedTokenizers = array( |
| 39 | - 'PHP', |
|
| 40 | - 'JS', |
|
| 41 | - ); |
|
| 39 | + 'PHP', |
|
| 40 | + 'JS', |
|
| 41 | + ); |
|
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | 44 | * If true, an error will be thrown; otherwise a warning. |
@@ -242,11 +242,11 @@ discard block |
||
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | $assignments[$assign] = array( |
| 245 | - 'var_end' => $varEnd, |
|
| 246 | - 'assign_len' => $assignLen, |
|
| 247 | - 'assign_col' => $assignColumn, |
|
| 248 | - 'expected' => $padding, |
|
| 249 | - 'found' => $found, |
|
| 245 | + 'var_end' => $varEnd, |
|
| 246 | + 'assign_len' => $assignLen, |
|
| 247 | + 'assign_col' => $assignColumn, |
|
| 248 | + 'expected' => $padding, |
|
| 249 | + 'found' => $found, |
|
| 250 | 250 | ); |
| 251 | 251 | |
| 252 | 252 | $lastLine = $tokens[$assign]['line']; |
@@ -288,9 +288,9 @@ discard block |
||
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | $errorData = array( |
| 291 | - $expectedText, |
|
| 292 | - $foundText, |
|
| 293 | - ); |
|
| 291 | + $expectedText, |
|
| 292 | + $foundText, |
|
| 293 | + ); |
|
| 294 | 294 | |
| 295 | 295 | if ($this->error === true) { |
| 296 | 296 | $fix = $phpcsFile->addFixableError($error, $assignment, $type, $errorData); |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | /** |
| 21 | 21 | * Returns an array of tokens this test wants to listen for. |
| 22 | 22 | * |
| 23 | - * @return array |
|
| 23 | + * @return integer[] |
|
| 24 | 24 | */ |
| 25 | 25 | public function register() |
| 26 | 26 | { |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | /** |
| 36 | 36 | * Processes this test, when one of its tokens is encountered. |
| 37 | 37 | * |
| 38 | - * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
| 38 | + * @param File $phpcsFile The file being scanned. |
|
| 39 | 39 | * @param int $stackPtr The position of the current token |
| 40 | 40 | * in the stack passed in $tokens. |
| 41 | 41 | * |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | return array( |
| 40 | 40 | T_STRING, |
| 41 | 41 | T_VARIABLE, |
| 42 | - ); |
|
| 42 | + ); |
|
| 43 | 43 | |
| 44 | 44 | }//end register() |
| 45 | 45 | |
@@ -95,9 +95,9 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | $nextSeparator = $openBracket; |
| 97 | 97 | $find = array( |
| 98 | - T_VARIABLE, |
|
| 99 | - T_OPEN_SHORT_ARRAY, |
|
| 100 | - ); |
|
| 98 | + T_VARIABLE, |
|
| 99 | + T_OPEN_SHORT_ARRAY, |
|
| 100 | + ); |
|
| 101 | 101 | |
| 102 | 102 | while (($nextSeparator = $phpcsFile->findNext($find, ($nextSeparator + 1), $closeBracket)) !== false) { |
| 103 | 103 | if (isset($tokens[$nextSeparator]['nested_parenthesis']) === false) { |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | /** |
| 51 | 51 | * Processes this test, when one of its tokens is encountered. |
| 52 | 52 | * |
| 53 | - * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
| 53 | + * @param File $phpcsFile The file being scanned. |
|
| 54 | 54 | * @param int $stackPtr The position of the current token in the |
| 55 | 55 | * stack passed in $tokens. |
| 56 | 56 | * |
@@ -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 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | /** |
| 39 | 39 | * Returns an array of tokens this test wants to listen for. |
| 40 | 40 | * |
| 41 | - * @return array |
|
| 41 | + * @return integer[] |
|
| 42 | 42 | */ |
| 43 | 43 | public function register() |
| 44 | 44 | { |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | /** |
| 51 | 51 | * Processes this test, when one of its tokens is encountered. |
| 52 | 52 | * |
| 53 | - * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
| 53 | + * @param File $phpcsFile The file being scanned. |
|
| 54 | 54 | * @param int $stackPtr The position of the current token |
| 55 | 55 | * in the stack passed in $tokens. |
| 56 | 56 | * |
@@ -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 | |