@@ -32,7 +32,7 @@ |
||
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 |
37 | 37 | * in the stack passed in $tokens. |
38 | 38 | * |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | /** |
44 | 44 | * Returns an array of tokens this test wants to listen for. |
45 | 45 | * |
46 | - * @return array |
|
46 | + * @return integer[] |
|
47 | 47 | */ |
48 | 48 | public function register() |
49 | 49 | { |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | /** |
59 | 59 | * Processes this test, when one of its tokens is encountered. |
60 | 60 | * |
61 | - * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
61 | + * @param File $phpcsFile The file being scanned. |
|
62 | 62 | * @param int $stackPtr The position of the current token |
63 | 63 | * in the stack passed in $tokens. |
64 | 64 | * |
@@ -34,9 +34,9 @@ discard block |
||
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 | * An array of functions we don't want in the condition of loops. |
@@ -44,12 +44,12 @@ discard block |
||
44 | 44 | * @return array |
45 | 45 | */ |
46 | 46 | protected $forbiddenFunctions = array( |
47 | - 'PHP' => array( |
|
48 | - 'sizeof' => true, |
|
49 | - 'strlen' => true, |
|
50 | - 'count' => true, |
|
51 | - ), |
|
52 | - 'JS' => array('length' => true), |
|
47 | + 'PHP' => array( |
|
48 | + 'sizeof' => true, |
|
49 | + 'strlen' => true, |
|
50 | + 'count' => true, |
|
51 | + ), |
|
52 | + 'JS' => array('length' => true), |
|
53 | 53 | ); |
54 | 54 | |
55 | 55 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | return array( |
64 | 64 | T_WHILE, |
65 | 65 | T_FOR, |
66 | - ); |
|
66 | + ); |
|
67 | 67 | |
68 | 68 | }//end register() |
69 | 69 |
@@ -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 | * |
@@ -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 | * |
@@ -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 | { |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | /** |
54 | 54 | * Processes this test, when one of its tokens is encountered. |
55 | 55 | * |
56 | - * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
56 | + * @param File $phpcsFile The file being scanned. |
|
57 | 57 | * @param int $stackPtr The position of the current token |
58 | 58 | * in the stack passed in $tokens. |
59 | 59 | * |
@@ -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 | /** |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | T_ELSEIF, |
60 | 60 | T_TRY, |
61 | 61 | T_CATCH, |
62 | - ); |
|
62 | + ); |
|
63 | 63 | |
64 | 64 | }//end register() |
65 | 65 | |
@@ -138,12 +138,12 @@ discard block |
||
138 | 138 | |
139 | 139 | // We ignore spacing for some structures that tend to have their own rules. |
140 | 140 | $ignore = array( |
141 | - T_FUNCTION => true, |
|
142 | - T_CLASS => true, |
|
143 | - T_INTERFACE => true, |
|
144 | - T_TRAIT => true, |
|
145 | - T_DOC_COMMENT_OPEN_TAG => true, |
|
146 | - ); |
|
141 | + T_FUNCTION => true, |
|
142 | + T_CLASS => true, |
|
143 | + T_INTERFACE => true, |
|
144 | + T_TRAIT => true, |
|
145 | + T_DOC_COMMENT_OPEN_TAG => true, |
|
146 | + ); |
|
147 | 147 | |
148 | 148 | if (isset($ignore[$tokens[$firstContent]['code']]) === false |
149 | 149 | && $tokens[$firstContent]['line'] >= ($tokens[$scopeOpener]['line'] + 2) |
@@ -44,7 +44,7 @@ |
||
44 | 44 | /** |
45 | 45 | * Processes this test, when one of its tokens is encountered. |
46 | 46 | * |
47 | - * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
47 | + * @param File $phpcsFile The file being scanned. |
|
48 | 48 | * @param int $stackPtr The position of the current token |
49 | 49 | * in the stack passed in $tokens. |
50 | 50 | * |
@@ -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 |
@@ -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); |