Skip to content

Commit

Permalink
PHP tokenizer: add missing verbose message
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jrfnl committed Mar 14, 2020
1 parent 1dbc333 commit ec17d53
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Tokenizers/PHP.php
Original file line number Diff line number Diff line change
Expand Up @@ -1931,6 +1931,12 @@ protected function processAdditional()

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

$this->tokens[$i]['code'] = T_STRING;
$this->tokens[$i]['type'] = 'T_STRING';
}
Expand Down

0 comments on commit ec17d53

Please sign in to comment.