Skip to content

Commit 794a902

Browse files
jrfnlgsherwood
authored andcommitted
PHP tokenizer: add missing verbose message
PR 2860 made a change to the tokenizer which changes the token type of an `fn` keyword (back) to `T_STRING` if it turns out not to be an arrow function. That change did not include a verbose message for tokenizer debugging. Fixed now.
1 parent de409c7 commit 794a902

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Tokenizers/PHP.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1800,6 +1800,12 @@ protected function processAdditional()
18001800

18011801
// If after all that, the extra tokens are not set, this is not an arrow function.
18021802
if (isset($this->tokens[$i]['scope_closer']) === false) {
1803+
if (PHP_CODESNIFFER_VERBOSITY > 1) {
1804+
$line = $this->tokens[$i]['line'];
1805+
$oldCode = $this->tokens[$i]['code'];
1806+
Common::printStatusMessage("* token $i on line $line changed from $oldCode to T_STRING: not an arrow function after all", 2);
1807+
}
1808+
18031809
$this->tokens[$i]['code'] = T_STRING;
18041810
$this->tokens[$i]['type'] = 'T_STRING';
18051811
}

0 commit comments

Comments
 (0)