@@ -35,7 +35,7 @@ |
||
| 35 | 35 | /** |
| 36 | 36 | * Should this test be skipped for some reason. |
| 37 | 37 | * |
| 38 | - * @return void |
|
| 38 | + * @return boolean |
|
| 39 | 39 | */ |
| 40 | 40 | protected function shouldSkipTest() |
| 41 | 41 | { |
@@ -34,9 +34,9 @@ |
||
| 34 | 34 | * @var array |
| 35 | 35 | */ |
| 36 | 36 | public $supportedTokenizers = array( |
| 37 | - 'PHP', |
|
| 38 | - 'JS', |
|
| 39 | - ); |
|
| 37 | + 'PHP', |
|
| 38 | + 'JS', |
|
| 39 | + ); |
|
| 40 | 40 | |
| 41 | 41 | |
| 42 | 42 | /** |
@@ -147,7 +147,7 @@ |
||
| 147 | 147 | * |
| 148 | 148 | * @return void |
| 149 | 149 | */ |
| 150 | - public function processBracket($phpcsFile, $openBracket, $tokens, $type='function') |
|
| 150 | + public function processBracket($phpcsFile, $openBracket, $tokens, $type = 'function') |
|
| 151 | 151 | { |
| 152 | 152 | $errorPrefix = ''; |
| 153 | 153 | if ($type === 'use') { |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | /** |
| 28 | 28 | * Registers the token types that this sniff wishes to listen to. |
| 29 | 29 | * |
| 30 | - * @return array |
|
| 30 | + * @return string[] |
|
| 31 | 31 | */ |
| 32 | 32 | public function register() |
| 33 | 33 | { |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | /** |
| 40 | 40 | * Process the tokens that this sniff is listening for. |
| 41 | 41 | * |
| 42 | - * @param PHP_CodeSniffer_File $phpcsFile The file where the token was found. |
|
| 42 | + * @param File $phpcsFile The file where the token was found. |
|
| 43 | 43 | * @param int $stackPtr The position in the stack where |
| 44 | 44 | * the token was found. |
| 45 | 45 | * |
@@ -80,7 +80,7 @@ |
||
| 80 | 80 | /** |
| 81 | 81 | * Process the tokens that this sniff is listening for. |
| 82 | 82 | * |
| 83 | - * @param PHP_CodeSniffer_File $phpcsFile The file where the token was found. |
|
| 83 | + * @param File $phpcsFile The file where the token was found. |
|
| 84 | 84 | * @param int $stackPtr The position in the stack where the token |
| 85 | 85 | * was found. |
| 86 | 86 | * |
@@ -55,9 +55,9 @@ discard block |
||
| 55 | 55 | * @var array |
| 56 | 56 | */ |
| 57 | 57 | public $supportedTokenizers = array( |
| 58 | - 'PHP', |
|
| 59 | - 'JS', |
|
| 60 | - ); |
|
| 58 | + 'PHP', |
|
| 59 | + 'JS', |
|
| 60 | + ); |
|
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | 63 | * A list of valid comparison operators. |
@@ -65,13 +65,13 @@ discard block |
||
| 65 | 65 | * @var array |
| 66 | 66 | */ |
| 67 | 67 | private static $_validOps = array( |
| 68 | - T_IS_IDENTICAL, |
|
| 69 | - T_IS_NOT_IDENTICAL, |
|
| 70 | - T_LESS_THAN, |
|
| 71 | - T_GREATER_THAN, |
|
| 72 | - T_IS_GREATER_OR_EQUAL, |
|
| 73 | - T_IS_SMALLER_OR_EQUAL, |
|
| 74 | - T_INSTANCEOF, |
|
| 68 | + T_IS_IDENTICAL, |
|
| 69 | + T_IS_NOT_IDENTICAL, |
|
| 70 | + T_LESS_THAN, |
|
| 71 | + T_GREATER_THAN, |
|
| 72 | + T_IS_GREATER_OR_EQUAL, |
|
| 73 | + T_IS_SMALLER_OR_EQUAL, |
|
| 74 | + T_INSTANCEOF, |
|
| 75 | 75 | ); |
| 76 | 76 | |
| 77 | 77 | /** |
@@ -80,16 +80,16 @@ discard block |
||
| 80 | 80 | * @var array(int => string) |
| 81 | 81 | */ |
| 82 | 82 | private static $_invalidOps = array( |
| 83 | - 'PHP' => array( |
|
| 84 | - T_IS_EQUAL => '===', |
|
| 85 | - T_IS_NOT_EQUAL => '!==', |
|
| 86 | - T_BOOLEAN_NOT => '=== FALSE', |
|
| 83 | + 'PHP' => array( |
|
| 84 | + T_IS_EQUAL => '===', |
|
| 85 | + T_IS_NOT_EQUAL => '!==', |
|
| 86 | + T_BOOLEAN_NOT => '=== FALSE', |
|
| 87 | 87 | ), |
| 88 | - 'JS' => array( |
|
| 89 | - T_IS_EQUAL => '===', |
|
| 90 | - T_IS_NOT_EQUAL => '!==', |
|
| 88 | + 'JS' => array( |
|
| 89 | + T_IS_EQUAL => '===', |
|
| 90 | + T_IS_NOT_EQUAL => '!==', |
|
| 91 | 91 | ), |
| 92 | - ); |
|
| 92 | + ); |
|
| 93 | 93 | |
| 94 | 94 | |
| 95 | 95 | /** |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | T_INLINE_THEN, |
| 106 | 106 | T_WHILE, |
| 107 | 107 | T_FOR, |
| 108 | - ); |
|
| 108 | + ); |
|
| 109 | 109 | |
| 110 | 110 | }//end register() |
| 111 | 111 | |
@@ -191,9 +191,9 @@ discard block |
||
| 191 | 191 | if (in_array($type, array_keys(self::$_invalidOps[$tokenizer])) === true) { |
| 192 | 192 | $error = 'Operator %s prohibited; use %s instead'; |
| 193 | 193 | $data = array( |
| 194 | - $tokens[$i]['content'], |
|
| 195 | - self::$_invalidOps[$tokenizer][$type], |
|
| 196 | - ); |
|
| 194 | + $tokens[$i]['content'], |
|
| 195 | + self::$_invalidOps[$tokenizer][$type], |
|
| 196 | + ); |
|
| 197 | 197 | $phpcsFile->addError($error, $i, 'NotAllowed', $data); |
| 198 | 198 | $foundOps++; |
| 199 | 199 | } else if (in_array($type, self::$_validOps) === true) { |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | /** |
| 39 | 39 | * Processes this test, 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 | * |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | /** |
| 61 | 61 | * Checks to ensure increment and decrement operators are not confusing. |
| 62 | 62 | * |
| 63 | - * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
| 63 | + * @param File $phpcsFile The file being scanned. |
|
| 64 | 64 | * @param int $stackPtr The position of the current token |
| 65 | 65 | * in the stack passed in $tokens. |
| 66 | 66 | * |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | /** |
| 107 | 107 | * Checks to ensure increment and decrement operators are used. |
| 108 | 108 | * |
| 109 | - * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
| 109 | + * @param File $phpcsFile The file being scanned. |
|
| 110 | 110 | * @param int $stackPtr The position of the current token |
| 111 | 111 | * in the stack passed in $tokens. |
| 112 | 112 | * |
@@ -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 | |
@@ -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 | { |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | /** |
| 33 | 33 | * Processes this test, when one of its tokens is encountered. |
| 34 | 34 | * |
| 35 | - * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
| 35 | + * @param File $phpcsFile The file being scanned. |
|
| 36 | 36 | * @param int $stackPtr The position of the current token in the |
| 37 | 37 | * stack passed in $tokens. |
| 38 | 38 | * |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | /** |
| 58 | 58 | * Validates embedded PHP that exists on multiple lines. |
| 59 | 59 | * |
| 60 | - * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
| 60 | + * @param File $phpcsFile The file being scanned. |
|
| 61 | 61 | * @param int $stackPtr The position of the current token in the |
| 62 | 62 | * stack passed in $tokens. |
| 63 | 63 | * |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | /** |
| 291 | 291 | * Validates embedded PHP that exists on one line. |
| 292 | 292 | * |
| 293 | - * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
| 293 | + * @param File $phpcsFile The file being scanned. |
|
| 294 | 294 | * @param int $stackPtr The position of the current token in the |
| 295 | 295 | * stack passed in $tokens. |
| 296 | 296 | * |
@@ -167,9 +167,9 @@ discard block |
||
| 167 | 167 | if ($contentColumn !== $indent) { |
| 168 | 168 | $error = 'First line of embedded PHP code must be indented %s spaces; %s found'; |
| 169 | 169 | $data = array( |
| 170 | - $indent, |
|
| 171 | - $contentColumn, |
|
| 172 | - ); |
|
| 170 | + $indent, |
|
| 171 | + $contentColumn, |
|
| 172 | + ); |
|
| 173 | 173 | $fix = $phpcsFile->addFixableError($error, $firstContent, 'Indent', $data); |
| 174 | 174 | if ($fix === true) { |
| 175 | 175 | $padding = str_repeat(' ', $indent); |
@@ -225,9 +225,9 @@ discard block |
||
| 225 | 225 | if ($found > $expected) { |
| 226 | 226 | $error = 'Opening PHP tag indent incorrect; expected no more than %s spaces but found %s'; |
| 227 | 227 | $data = array( |
| 228 | - $expected, |
|
| 229 | - $found, |
|
| 230 | - ); |
|
| 228 | + $expected, |
|
| 229 | + $found, |
|
| 230 | + ); |
|
| 231 | 231 | $fix = $phpcsFile->addFixableError($error, $stackPtr, 'OpenTagIndent', $data); |
| 232 | 232 | if ($fix === true) { |
| 233 | 233 | $phpcsFile->fixer->replaceToken(($stackPtr - 1), str_repeat(' ', $expected)); |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | $indent, |
| 171 | 171 | $contentColumn, |
| 172 | 172 | ); |
| 173 | - $fix = $phpcsFile->addFixableError($error, $firstContent, 'Indent', $data); |
|
| 173 | + $fix = $phpcsFile->addFixableError($error, $firstContent, 'Indent', $data); |
|
| 174 | 174 | if ($fix === true) { |
| 175 | 175 | $padding = str_repeat(' ', $indent); |
| 176 | 176 | if ($contentColumn === 0) { |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | $expected, |
| 229 | 229 | $found, |
| 230 | 230 | ); |
| 231 | - $fix = $phpcsFile->addFixableError($error, $stackPtr, 'OpenTagIndent', $data); |
|
| 231 | + $fix = $phpcsFile->addFixableError($error, $stackPtr, 'OpenTagIndent', $data); |
|
| 232 | 232 | if ($fix === true) { |
| 233 | 233 | $phpcsFile->fixer->replaceToken(($stackPtr - 1), str_repeat(' ', $expected)); |
| 234 | 234 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | /** |
| 30 | 30 | * Processes this test, when one of its tokens is encountered. |
| 31 | 31 | * |
| 32 | - * @param PHP_CodeSniffer_File $phpcsFile The current file being scanned. |
|
| 32 | + * @param File $phpcsFile The current file being scanned. |
|
| 33 | 33 | * @param int $stackPtr The position of the current token in the |
| 34 | 34 | * stack passed in $tokens. |
| 35 | 35 | * @param int $currScope A pointer to the start of the scope. |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | * Processes a token that is found within the scope that this test is |
| 77 | 77 | * listening to. |
| 78 | 78 | * |
| 79 | - * @param PHP_CodeSniffer_File $phpcsFile The file where this token was found. |
|
| 79 | + * @param File $phpcsFile The file where this token was found. |
|
| 80 | 80 | * @param int $stackPtr The position in the stack where this |
| 81 | 81 | * token was found. |
| 82 | 82 | * |
@@ -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 | * |
@@ -109,9 +109,9 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | $error .= ' after function; %s found'; |
| 111 | 111 | $data = array( |
| 112 | - $this->spacing, |
|
| 113 | - $foundLines, |
|
| 114 | - ); |
|
| 112 | + $this->spacing, |
|
| 113 | + $foundLines, |
|
| 114 | + ); |
|
| 115 | 115 | |
| 116 | 116 | $fix = $phpcsFile->addFixableError($error, $closer, 'After', $data); |
| 117 | 117 | if ($fix === true) { |
@@ -202,9 +202,9 @@ discard block |
||
| 202 | 202 | |
| 203 | 203 | $error .= ' before function; %s found'; |
| 204 | 204 | $data = array( |
| 205 | - $this->spacing, |
|
| 206 | - $foundLines, |
|
| 207 | - ); |
|
| 205 | + $this->spacing, |
|
| 206 | + $foundLines, |
|
| 207 | + ); |
|
| 208 | 208 | |
| 209 | 209 | $fix = $phpcsFile->addFixableError($error, $stackPtr, 'Before', $data); |
| 210 | 210 | if ($fix === true) { |
@@ -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 | * |
@@ -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 | /** |
@@ -81,8 +81,8 @@ discard block |
||
| 81 | 81 | $found = $phpcsFile->getTokensAsString($nonSpace, ($stackPtr - $nonSpace)).';'; |
| 82 | 82 | $error = 'Space found before semicolon; expected "%s" but found "%s"'; |
| 83 | 83 | $data = array( |
| 84 | - $expected, |
|
| 85 | - $found, |
|
| 84 | + $expected, |
|
| 85 | + $found, |
|
| 86 | 86 | ); |
| 87 | 87 | |
| 88 | 88 | $fix = $phpcsFile->addFixableError($error, $stackPtr, 'Incorrect', $data); |
@@ -62,7 +62,7 @@ |
||
| 62 | 62 | /** |
| 63 | 63 | * Processes this sniff, when one of its tokens is encountered. |
| 64 | 64 | * |
| 65 | - * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
| 65 | + * @param File $phpcsFile The file being scanned. |
|
| 66 | 66 | * @param int $stackPtr The position of the current token in the |
| 67 | 67 | * stack passed in $tokens. |
| 68 | 68 | * |
@@ -38,10 +38,10 @@ discard block |
||
| 38 | 38 | * @var array |
| 39 | 39 | */ |
| 40 | 40 | public $supportedTokenizers = array( |
| 41 | - 'PHP', |
|
| 42 | - 'JS', |
|
| 43 | - 'CSS', |
|
| 44 | - ); |
|
| 41 | + 'PHP', |
|
| 42 | + 'JS', |
|
| 43 | + 'CSS', |
|
| 44 | + ); |
|
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | 47 | * If TRUE, whitespace rules are not checked for blank lines. |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | T_COMMENT, |
| 68 | 68 | T_DOC_COMMENT_WHITESPACE, |
| 69 | 69 | T_CLOSURE, |
| 70 | - ); |
|
| 70 | + ); |
|
| 71 | 71 | |
| 72 | 72 | }//end register() |
| 73 | 73 | |