Use Null Coalesce Operator
This commit is contained in:
Родитель
10e901a608
Коммит
bee824b040
|
@ -33,9 +33,8 @@ class DiagnosticsProvider {
|
|||
return new Diagnostic(
|
||||
DiagnosticKind::Error,
|
||||
"Unexpected '" .
|
||||
(isset(self::$tokenKindToText[$node->kind])
|
||||
? self::$tokenKindToText[$node->kind]
|
||||
: Token::getTokenKindNameFromValue($node->kind)) .
|
||||
(self::$tokenKindToText[$node->kind]
|
||||
?? Token::getTokenKindNameFromValue($node->kind)) .
|
||||
"'",
|
||||
$node->start,
|
||||
$node->getEndPosition() - $node->start
|
||||
|
@ -44,9 +43,8 @@ class DiagnosticsProvider {
|
|||
return new Diagnostic(
|
||||
DiagnosticKind::Error,
|
||||
"'" .
|
||||
(isset(self::$tokenKindToText[$node->kind])
|
||||
? self::$tokenKindToText[$node->kind]
|
||||
: Token::getTokenKindNameFromValue($node->kind)) .
|
||||
(self::$tokenKindToText[$node->kind]
|
||||
?? Token::getTokenKindNameFromValue($node->kind)) .
|
||||
"' expected.",
|
||||
$node->start,
|
||||
$node->getEndPosition() - $node->start
|
||||
|
|
|
@ -107,9 +107,7 @@ class PhpTokenizer implements TokenStreamProviderInterface {
|
|||
continue;
|
||||
}
|
||||
|
||||
$newTokenKind = isset(self::TOKEN_MAP[$tokenKind])
|
||||
? self::TOKEN_MAP[$tokenKind]
|
||||
: $newTokenKind = TokenKind::Unknown;
|
||||
$newTokenKind = self::TOKEN_MAP[$tokenKind] ?? TokenKind::Unknown;
|
||||
$arr[] = new Token($newTokenKind, $fullStart, $start, $pos - $fullStart);
|
||||
$start = $fullStart = $pos;
|
||||
continue;
|
||||
|
|
Загрузка…
Ссылка в новой задаче