Skip to content

Commit ec17d53

Browse files
committed
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 1dbc333 commit ec17d53

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
@@ -1931,6 +1931,12 @@ protected function processAdditional()
19311931

19321932
// If after all that, the extra tokens are not set, this is not an arrow function.
19331933
if (isset($this->tokens[$i]['scope_closer']) === false) {
1934+
if (PHP_CODESNIFFER_VERBOSITY > 1) {
1935+
$line = $this->tokens[$i]['line'];
1936+
$oldCode = $this->tokens[$i]['code'];
1937+
echo "\t\t* token $i on line $line changed from $oldCode to T_STRING: not an arrow function after all".PHP_EOL;
1938+
}
1939+
19341940
$this->tokens[$i]['code'] = T_STRING;
19351941
$this->tokens[$i]['type'] = 'T_STRING';
19361942
}

0 commit comments

Comments
 (0)