@@ -24,7 +24,7 @@ |
||
24 | 24 | * its data should be counted in the grand totals. |
25 | 25 | * |
26 | 26 | * @param array $report Prepared report data. |
27 | - * @param \PHP_CodeSniffer\File $phpcsFile The file being reported on. |
|
27 | + * @param File $phpcsFile The file being reported on. |
|
28 | 28 | * @param bool $showSources Show sources? |
29 | 29 | * @param int $width Maximum allowed line width. |
30 | 30 | * |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | foreach ($colErrors as $error) { |
45 | 45 | if (isset($sources[$error['source']]) === false) { |
46 | 46 | $sources[$error['source']] = array( |
47 | - 'fixable' => (int) $error['fixable'], |
|
48 | - 'count' => 1, |
|
49 | - ); |
|
47 | + 'fixable' => (int) $error['fixable'], |
|
48 | + 'count' => 1, |
|
49 | + ); |
|
50 | 50 | } else { |
51 | 51 | $sources[$error['source']]['count']++; |
52 | 52 | } |
@@ -133,9 +133,9 @@ discard block |
||
133 | 133 | $maxLength = max($maxLength, $sniff); |
134 | 134 | |
135 | 135 | $sources[$source] = array( |
136 | - 'count' => 1, |
|
137 | - 'fixable' => $fixable, |
|
138 | - 'parts' => $parts, |
|
136 | + 'count' => 1, |
|
137 | + 'fixable' => $fixable, |
|
138 | + 'parts' => $parts, |
|
139 | 139 | ); |
140 | 140 | } else { |
141 | 141 | $sources[$source]['count']++; |
@@ -143,10 +143,10 @@ discard block |
||
143 | 143 | |
144 | 144 | $fileLen = strlen($parts[0]); |
145 | 145 | $reportFiles[$parts[0]] = array( |
146 | - 'errors' => $parts[1], |
|
147 | - 'warnings' => $parts[2], |
|
148 | - 'strlen' => $fileLen, |
|
149 | - ); |
|
146 | + 'errors' => $parts[1], |
|
147 | + 'warnings' => $parts[2], |
|
148 | + 'strlen' => $fileLen, |
|
149 | + ); |
|
150 | 150 | }//end foreach |
151 | 151 | |
152 | 152 | if ($showSources === true) { |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @return bool |
32 | 32 | */ |
33 | - public function generateFileReport($report, File $phpcsFile, $showSources=false, $width=80) |
|
33 | + public function generateFileReport($report, File $phpcsFile, $showSources = false, $width = 80) |
|
34 | 34 | { |
35 | 35 | if ($report['errors'] === 0 && $report['warnings'] === 0) { |
36 | 36 | // Nothing to print. |
@@ -85,10 +85,10 @@ discard block |
||
85 | 85 | $totalErrors, |
86 | 86 | $totalWarnings, |
87 | 87 | $totalFixable, |
88 | - $showSources=false, |
|
89 | - $width=80, |
|
90 | - $interactive=false, |
|
91 | - $toScreen=true |
|
88 | + $showSources = false, |
|
89 | + $width = 80, |
|
90 | + $interactive = false, |
|
91 | + $toScreen = true |
|
92 | 92 | ) { |
93 | 93 | $lines = explode(PHP_EOL, $cachedData); |
94 | 94 | array_pop($lines); |
@@ -24,7 +24,7 @@ |
||
24 | 24 | * its data should be counted in the grand totals. |
25 | 25 | * |
26 | 26 | * @param array $report Prepared report data. |
27 | - * @param \PHP_CodeSniffer\File $phpcsFile The file being reported on. |
|
27 | + * @param File $phpcsFile The file being reported on. |
|
28 | 28 | * @param bool $showSources Show sources? |
29 | 29 | * @param int $width Maximum allowed line width. |
30 | 30 | * |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @return bool |
32 | 32 | */ |
33 | - public function generateFileReport($report, File $phpcsFile, $showSources=false, $width=80) |
|
33 | + public function generateFileReport($report, File $phpcsFile, $showSources = false, $width = 80) |
|
34 | 34 | { |
35 | 35 | $out = new \XMLWriter; |
36 | 36 | $out->openMemory(); |
@@ -97,10 +97,10 @@ discard block |
||
97 | 97 | $totalErrors, |
98 | 98 | $totalWarnings, |
99 | 99 | $totalFixable, |
100 | - $showSources=false, |
|
101 | - $width=80, |
|
102 | - $interactive=false, |
|
103 | - $toScreen=true |
|
100 | + $showSources = false, |
|
101 | + $width = 80, |
|
102 | + $interactive = false, |
|
103 | + $toScreen = true |
|
104 | 104 | ) { |
105 | 105 | echo '<?xml version="1.0" encoding="UTF-8"?>'.PHP_EOL; |
106 | 106 | echo '<phpcs version="'.Config::VERSION.'">'.PHP_EOL; |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | /** |
178 | 178 | * Processes the test. |
179 | 179 | * |
180 | - * @param PHP_CodeSniffer_File $phpcsFile The PHP_CodeSniffer file where the |
|
180 | + * @param File $phpcsFile The PHP_CodeSniffer file where the |
|
181 | 181 | * token occurred. |
182 | 182 | * @param int $stackPtr The position in the tokens stack |
183 | 183 | * where the listening token type was |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | * for checking, which includes are |
248 | 248 | * parsed token representation of the |
249 | 249 | * pattern. |
250 | - * @param PHP_CodeSniffer_File $phpcsFile The PHP_CodeSniffer file where the |
|
250 | + * @param File $phpcsFile The PHP_CodeSniffer file where the |
|
251 | 251 | * token occurred. |
252 | 252 | * @param int $stackPtr The position in the tokens stack where |
253 | 253 | * the listening token type was found. |
@@ -746,7 +746,7 @@ discard block |
||
746 | 746 | /** |
747 | 747 | * Processes any tokens registered with registerSupplementary(). |
748 | 748 | * |
749 | - * @param PHP_CodeSniffer_File $phpcsFile The PHP_CodeSniffer file where to |
|
749 | + * @param File $phpcsFile The PHP_CodeSniffer file where to |
|
750 | 750 | * process the skip. |
751 | 751 | * @param int $stackPtr The position in the tokens stack to |
752 | 752 | * process. |
@@ -10,7 +10,6 @@ |
||
10 | 10 | namespace PHP_CodeSniffer\Sniffs; |
11 | 11 | |
12 | 12 | use PHP_CodeSniffer\Files\File; |
13 | -use PHP_CodeSniffer\Config; |
|
14 | 13 | use PHP_CodeSniffer\Util\Tokens; |
15 | 14 | use PHP_CodeSniffer\Tokenizers\PHP; |
16 | 15 | use PHP_CodeSniffer\Exceptions\RuntimeException; |
@@ -114,9 +114,9 @@ discard block |
||
114 | 114 | $listenTypes[] = $tokenType; |
115 | 115 | |
116 | 116 | $patternArray = array( |
117 | - 'listen_pos' => $pos, |
|
118 | - 'pattern' => $parsedPattern, |
|
119 | - 'pattern_code' => $pattern, |
|
117 | + 'listen_pos' => $pos, |
|
118 | + 'pattern' => $parsedPattern, |
|
119 | + 'pattern_code' => $pattern, |
|
120 | 120 | ); |
121 | 121 | |
122 | 122 | if (isset($this->_parsedPatterns[$tokenType]) === false) { |
@@ -763,17 +763,17 @@ discard block |
||
763 | 763 | }//end registerSupplementary() |
764 | 764 | |
765 | 765 | |
766 | - /** |
|
767 | - * Processes any tokens registered with registerSupplementary(). |
|
768 | - * |
|
769 | - * @param PHP_CodeSniffer_File $phpcsFile The PHP_CodeSniffer file where to |
|
770 | - * process the skip. |
|
771 | - * @param int $stackPtr The position in the tokens stack to |
|
772 | - * process. |
|
773 | - * |
|
774 | - * @return void |
|
775 | - * @see registerSupplementary() |
|
776 | - */ |
|
766 | + /** |
|
767 | + * Processes any tokens registered with registerSupplementary(). |
|
768 | + * |
|
769 | + * @param PHP_CodeSniffer_File $phpcsFile The PHP_CodeSniffer file where to |
|
770 | + * process the skip. |
|
771 | + * @param int $stackPtr The position in the tokens stack to |
|
772 | + * process. |
|
773 | + * |
|
774 | + * @return void |
|
775 | + * @see registerSupplementary() |
|
776 | + */ |
|
777 | 777 | protected function processSupplementary( |
778 | 778 | PHP_CodeSniffer_File $phpcsFile, |
779 | 779 | $stackPtr |
@@ -948,10 +948,10 @@ discard block |
||
948 | 948 | $patterns = array(); |
949 | 949 | foreach ($tokens as $patternInfo) { |
950 | 950 | $patterns[] = array( |
951 | - 'type' => 'token', |
|
952 | - 'token' => $patternInfo['code'], |
|
953 | - 'value' => $patternInfo['content'], |
|
954 | - ); |
|
951 | + 'type' => 'token', |
|
952 | + 'token' => $patternInfo['code'], |
|
953 | + 'value' => $patternInfo['content'], |
|
954 | + ); |
|
955 | 955 | } |
956 | 956 | |
957 | 957 | return $patterns; |
@@ -890,26 +890,26 @@ |
||
890 | 890 | $nestedBraces = 0; |
891 | 891 | for ($start = $from; $start >= 0; $start--) { |
892 | 892 | switch ($pattern[$start]) { |
893 | - case '(': |
|
894 | - if ($nestedParenthesis === 0) { |
|
895 | - $skip['to'] = 'parenthesis_closer'; |
|
896 | - } |
|
893 | + case '(': |
|
894 | + if ($nestedParenthesis === 0) { |
|
895 | + $skip['to'] = 'parenthesis_closer'; |
|
896 | + } |
|
897 | 897 | |
898 | - $nestedParenthesis--; |
|
899 | - break; |
|
900 | - case '{': |
|
901 | - if ($nestedBraces === 0) { |
|
902 | - $skip['to'] = 'scope_closer'; |
|
903 | - } |
|
898 | + $nestedParenthesis--; |
|
899 | + break; |
|
900 | + case '{': |
|
901 | + if ($nestedBraces === 0) { |
|
902 | + $skip['to'] = 'scope_closer'; |
|
903 | + } |
|
904 | 904 | |
905 | - $nestedBraces--; |
|
906 | - break; |
|
907 | - case '}': |
|
908 | - $nestedBraces++; |
|
909 | - break; |
|
910 | - case ')': |
|
911 | - $nestedParenthesis++; |
|
912 | - break; |
|
905 | + $nestedBraces--; |
|
906 | + break; |
|
907 | + case '}': |
|
908 | + $nestedBraces++; |
|
909 | + break; |
|
910 | + case ')': |
|
911 | + $nestedParenthesis++; |
|
912 | + break; |
|
913 | 913 | }//end switch |
914 | 914 | |
915 | 915 | if (isset($skip['to']) === true) { |
@@ -78,7 +78,7 @@ |
||
78 | 78 | * |
79 | 79 | * @param boolean $ignoreComments If true, comments will be ignored. |
80 | 80 | */ |
81 | - public function __construct($ignoreComments=null) |
|
81 | + public function __construct($ignoreComments = null) |
|
82 | 82 | { |
83 | 83 | // This is here for backwards compatibility. |
84 | 84 | if ($ignoreComments !== null) { |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | /** |
118 | 118 | * Processes the tokens that this test is listening for. |
119 | 119 | * |
120 | - * @param PHP_CodeSniffer_File $phpcsFile The file where this token was found. |
|
120 | + * @param File $phpcsFile The file where this token was found. |
|
121 | 121 | * @param int $stackPtr The position in the stack where this |
122 | 122 | * token was found. |
123 | 123 | * |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * Processes a token that is found within the scope that this test is |
148 | 148 | * listening to. |
149 | 149 | * |
150 | - * @param PHP_CodeSniffer_File $phpcsFile The file where this token was found. |
|
150 | + * @param File $phpcsFile The file where this token was found. |
|
151 | 151 | * @param int $stackPtr The position in the stack where this |
152 | 152 | * token was found. |
153 | 153 | * @param int $currScope The position in the tokens array that |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | * Processes a token that is found within the scope that this test is |
164 | 164 | * listening to. |
165 | 165 | * |
166 | - * @param PHP_CodeSniffer_File $phpcsFile The file where this token was found. |
|
166 | + * @param File $phpcsFile The file where this token was found. |
|
167 | 167 | * @param int $stackPtr The position in the stack where this |
168 | 168 | * token was found. |
169 | 169 | * |
@@ -86,7 +86,7 @@ |
||
86 | 86 | public function __construct( |
87 | 87 | array $scopeTokens, |
88 | 88 | array $tokens, |
89 | - $listenOutside=false |
|
89 | + $listenOutside = false |
|
90 | 90 | ) { |
91 | 91 | if (empty($scopeTokens) === true) { |
92 | 92 | $error = 'The scope tokens list cannot be empty'; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | /** |
70 | 70 | * Processes the token in the specified PHP_CodeSniffer_File. |
71 | 71 | * |
72 | - * @param PHP_CodeSniffer_File $phpcsFile The PHP_CodeSniffer file where this |
|
72 | + * @param File $phpcsFile The PHP_CodeSniffer file where this |
|
73 | 73 | * token was found. |
74 | 74 | * @param int $stackPtr The position where the token was found. |
75 | 75 | * @param array $currScope The current scope opener token. |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | /** |
144 | 144 | * Processes the token outside the scope in the file. |
145 | 145 | * |
146 | - * @param PHP_CodeSniffer_File $phpcsFile The PHP_CodeSniffer file where this |
|
146 | + * @param File $phpcsFile The PHP_CodeSniffer file where this |
|
147 | 147 | * token was found. |
148 | 148 | * @param int $stackPtr The position where the token was found. |
149 | 149 | * |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | /** |
172 | 172 | * Called to process class member vars. |
173 | 173 | * |
174 | - * @param PHP_CodeSniffer_File $phpcsFile The PHP_CodeSniffer file where this |
|
174 | + * @param File $phpcsFile The PHP_CodeSniffer file where this |
|
175 | 175 | * token was found. |
176 | 176 | * @param int $stackPtr The position where the token was found. |
177 | 177 | * |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | /** |
184 | 184 | * Called to process normal member vars. |
185 | 185 | * |
186 | - * @param PHP_CodeSniffer_File $phpcsFile The PHP_CodeSniffer file where this |
|
186 | + * @param File $phpcsFile The PHP_CodeSniffer file where this |
|
187 | 187 | * token was found. |
188 | 188 | * @param int $stackPtr The position where the token was found. |
189 | 189 | * |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * Note that there may be more than one variable in the string, which will |
199 | 199 | * result only in one call for the string or one call per line for heredocs. |
200 | 200 | * |
201 | - * @param PHP_CodeSniffer_File $phpcsFile The PHP_CodeSniffer file where this |
|
201 | + * @param File $phpcsFile The PHP_CodeSniffer file where this |
|
202 | 202 | * token was found. |
203 | 203 | * @param int $stackPtr The position where the double quoted |
204 | 204 | * string was found. |
@@ -16,7 +16,6 @@ |
||
16 | 16 | namespace PHP_CodeSniffer\Sniffs; |
17 | 17 | |
18 | 18 | use PHP_CodeSniffer\Files\File; |
19 | -use PHP_CodeSniffer\Exceptions\RuntimeException; |
|
20 | 19 | |
21 | 20 | abstract class AbstractVariableSniff extends AbstractScopeSniff |
22 | 21 | { |
@@ -67,17 +67,17 @@ |
||
67 | 67 | public function __construct() |
68 | 68 | { |
69 | 69 | $scopes = array( |
70 | - T_CLASS, |
|
71 | - T_TRAIT, |
|
72 | - T_INTERFACE, |
|
73 | - ); |
|
70 | + T_CLASS, |
|
71 | + T_TRAIT, |
|
72 | + T_INTERFACE, |
|
73 | + ); |
|
74 | 74 | |
75 | 75 | $listen = array( |
76 | - T_FUNCTION, |
|
77 | - T_VARIABLE, |
|
78 | - T_DOUBLE_QUOTED_STRING, |
|
79 | - T_HEREDOC, |
|
80 | - ); |
|
76 | + T_FUNCTION, |
|
77 | + T_VARIABLE, |
|
78 | + T_DOUBLE_QUOTED_STRING, |
|
79 | + T_HEREDOC, |
|
80 | + ); |
|
81 | 81 | |
82 | 82 | parent::__construct($scopes, $listen, true); |
83 | 83 |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | /** |
40 | 40 | * Registers the tokens that this sniff wants to listen for. |
41 | 41 | * |
42 | - * @return int[] |
|
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 |
56 | 56 | * in the stack passed in $tokens. |
57 | 57 | * |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | /** |
33 | 33 | * Registers the tokens that this sniff wants to listen for. |
34 | 34 | * |
35 | - * @return int[] |
|
35 | + * @return integer[] |
|
36 | 36 | */ |
37 | 37 | public function register() |
38 | 38 | { |
@@ -44,7 +44,7 @@ discard block |
||
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 | * |
@@ -128,7 +128,7 @@ |
||
128 | 128 | T_VARIABLE, |
129 | 129 | T_LNUMBER, |
130 | 130 | T_CONSTANT_ENCAPSED_STRING, |
131 | - ); |
|
131 | + ); |
|
132 | 132 | |
133 | 133 | $parameters = array(''); |
134 | 134 | $parenthesisCount = 1; |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | /** |
30 | 30 | * Returns an array of tokens this test wants to listen for. |
31 | 31 | * |
32 | - * @return array |
|
32 | + * @return string[] |
|
33 | 33 | */ |
34 | 34 | public function register() |
35 | 35 | { |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | /** |
42 | 42 | * Processes this test, when one of its tokens is encountered. |
43 | 43 | * |
44 | - * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
44 | + * @param File $phpcsFile The file being scanned. |
|
45 | 45 | * @param int $stackPtr The position of the current token |
46 | 46 | * in the stack passed in $tokens. |
47 | 47 | * |
@@ -32,9 +32,9 @@ discard block |
||
32 | 32 | * @var array |
33 | 33 | */ |
34 | 34 | public $supportedTokenizers = array( |
35 | - 'PHP', |
|
36 | - 'JS', |
|
37 | - ); |
|
35 | + 'PHP', |
|
36 | + 'JS', |
|
37 | + ); |
|
38 | 38 | |
39 | 39 | |
40 | 40 | /** |
@@ -65,9 +65,9 @@ discard block |
||
65 | 65 | $commentEnd = $tokens[$stackPtr]['comment_closer']; |
66 | 66 | |
67 | 67 | $empty = array( |
68 | - T_DOC_COMMENT_WHITESPACE, |
|
69 | - T_DOC_COMMENT_STAR, |
|
70 | - ); |
|
68 | + T_DOC_COMMENT_WHITESPACE, |
|
69 | + T_DOC_COMMENT_STAR, |
|
70 | + ); |
|
71 | 71 | |
72 | 72 | $short = $phpcsFile->findNext($empty, ($stackPtr + 1), $commentEnd, true); |
73 | 73 | if ($short === false) { |
@@ -310,9 +310,9 @@ discard block |
||
310 | 310 | if ($padding !== $required) { |
311 | 311 | $error = 'Tag value indented incorrectly; expected %s spaces but found %s'; |
312 | 312 | $data = array( |
313 | - $required, |
|
314 | - $padding, |
|
315 | - ); |
|
313 | + $required, |
|
314 | + $padding, |
|
315 | + ); |
|
316 | 316 | |
317 | 317 | $fix = $phpcsFile->addFixableError($error, ($tag + 1), 'TagValueIndent', $data); |
318 | 318 | if ($fix === true) { |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | /** |
38 | 38 | * Returns an array of tokens this test wants to listen for. |
39 | 39 | * |
40 | - * @return array |
|
40 | + * @return integer[] |
|
41 | 41 | */ |
42 | 42 | public function register() |
43 | 43 | { |
@@ -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 in the |
63 | 63 | * stack passed in $tokens. |
64 | 64 | * |
@@ -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 |