框架升级及修复升级后的bug

This commit is contained in:
Dev
2026-10-16 18:13:09 +08:00
parent dafb0c96c0
commit 2d342bcbd7
537 changed files with 49836 additions and 40933 deletions
+6 -4
View File
@@ -51,11 +51,11 @@ class PhpToken implements \Stringable
public function getTokenName(): ?string
{
if ('UNKNOWN' === $name = token_name($this->id)) {
$name = \strlen($this->text) > 1 || \ord($this->text) < 32 ? null : $this->text;
if ($this->id < 256) {
return \chr($this->id & 0xFF);
}
return $name;
return 'UNKNOWN' === ($name = token_name($this->id)) ? null : $name;
}
/**
@@ -92,13 +92,15 @@ class PhpToken implements \Stringable
$tokens = token_get_all($code, $flags);
foreach ($tokens as $index => $token) {
if (\is_string($token)) {
$id = \ord($token);
// b" is the only such token longer than one char
$id = \ord($token[-1]);
$text = $token;
} else {
[$id, $text, $line] = $token;
}
$tokens[$index] = new static($id, $text, $line, $position);
$position += \strlen($text);
$line += preg_match_all('/\r\n?|\n/', $text);
}
return $tokens;