|
9 | 9 |
|
10 | 10 | namespace PHP_CodeSniffer\Tokenizers; |
11 | 11 |
|
| 12 | +use PHP_CodeSniffer\Config; |
12 | 13 | use PHP_CodeSniffer\Exceptions\TokenizerException; |
13 | 14 | use PHP_CodeSniffer\Util\Common; |
14 | 15 | use PHP_CodeSniffer\Util\IgnoreList; |
@@ -108,7 +109,7 @@ abstract class Tokenizer |
108 | 109 | * @return void |
109 | 110 | * @throws \PHP_CodeSniffer\Exceptions\TokenizerException If the file appears to be minified. |
110 | 111 | */ |
111 | | - public function __construct($content, $config, $eolChar='\n') |
| 112 | + public function __construct(string $content, ?Config $config, string $eolChar='\n') |
112 | 113 | { |
113 | 114 | $this->eolChar = $eolChar; |
114 | 115 |
|
@@ -139,7 +140,7 @@ public function __construct($content, $config, $eolChar='\n') |
139 | 140 | * |
140 | 141 | * @return boolean |
141 | 142 | */ |
142 | | - protected function isMinifiedContent($content, $eolChar='\n') |
| 143 | + protected function isMinifiedContent(string $content, string $eolChar='\n') |
143 | 144 | { |
144 | 145 | // Minified files often have a very large number of characters per line |
145 | 146 | // and cause issues when tokenizing. |
@@ -174,7 +175,7 @@ public function getTokens() |
174 | 175 | * |
175 | 176 | * @return array |
176 | 177 | */ |
177 | | - abstract protected function tokenize($code); |
| 178 | + abstract protected function tokenize(string $code); |
178 | 179 |
|
179 | 180 |
|
180 | 181 | /** |
@@ -500,7 +501,7 @@ private function createPositionMap() |
500 | 501 | * |
501 | 502 | * @return void |
502 | 503 | */ |
503 | | - public function replaceTabsInToken(&$token, $prefix=' ', $padding=' ', $tabWidth=null) |
| 504 | + public function replaceTabsInToken(array &$token, string $prefix=' ', string $padding=' ', ?int $tabWidth=null) |
504 | 505 | { |
505 | 506 | $checkEncoding = false; |
506 | 507 | if (function_exists('iconv_strlen') === true) { |
@@ -840,7 +841,7 @@ private function createScopeMap() |
840 | 841 | * @return int The position in the stack that closed the scope. |
841 | 842 | * @throws \PHP_CodeSniffer\Exceptions\TokenizerException If the nesting level gets too deep. |
842 | 843 | */ |
843 | | - private function recurseScopeMap($stackPtr, $depth=1, &$ignore=0) |
| 844 | + private function recurseScopeMap(int $stackPtr, int $depth=1, int &$ignore=0) |
844 | 845 | { |
845 | 846 | if (PHP_CODESNIFFER_VERBOSITY > 1) { |
846 | 847 | StatusWriter::write("=> Begin scope map recursion at token $stackPtr with depth $depth", $depth); |
|
0 commit comments