fix(php): fix use_{as,instead_of}_clause highlights

This commit is contained in:
Caleb White 2024-03-18 22:42:44 -05:00 committed by Christian Clason
parent 1c9a94bd60
commit 7d938c1c72
2 changed files with 31 additions and 6 deletions

View file

@ -26,7 +26,8 @@
(name) @type) (name) @type)
]) ])
(named_type (name) @type.builtin (named_type
(name) @type.builtin
(#any-of? @type.builtin "static" "self")) (#any-of? @type.builtin "static" "self"))
(class_declaration (class_declaration
@ -99,7 +100,9 @@
(list_literal (list_literal
"list" @function.builtin) "list" @function.builtin)
(exit_statement "exit" @function.builtin "(") (exit_statement
"exit" @function.builtin
"(")
(method_declaration (method_declaration
name: (name) @function.method) name: (name) @function.method)
@ -123,6 +126,18 @@
(nullsafe_member_call_expression (nullsafe_member_call_expression
name: (name) @function.method) name: (name) @function.method)
(use_instead_of_clause
(class_constant_access_expression
(_)
(name) @function.method)
(name) @type)
(use_as_clause
(class_constant_access_expression
(_)
(name) @function.method)*
(name) @function.method)
(method_declaration (method_declaration
name: (name) @constructor name: (name) @constructor
(#eq? @constructor "__construct")) (#eq? @constructor "__construct"))
@ -280,7 +295,6 @@
(yield_expression (yield_expression
"from" @keyword.return) "from" @keyword.return)
[ [
"case" "case"
"else" "else"

View file

@ -96,9 +96,20 @@ class B extends A implements T
U::small insteadof T; U::small insteadof T;
// ^ @type // ^ @type
// ^^ @operator // ^^ @operator
// ^^^^^ @constant // ^^^^^ @function.method
// ^^^^^^^^^ @keyword // ^^^^^^^^^ @keyword
// ^ @type // ^ @type
T::big as protected tBig;
// ^ @type
// ^^^ @function.method
// ^^ @keyword.operator
// ^^^^^^^^^ @keyword.modifier
// ^^^^ @function.method
big as private tBig;
// ^^^ @function.method
// ^^ @keyword.operator
// ^^^^^^^^^ @keyword.modifier
// ^^^^ @function.method
} }
public function foo(callable $call): self public function foo(callable $call): self
// ^^^^^^^^ @type.builtin // ^^^^^^^^ @type.builtin
@ -106,7 +117,7 @@ class B extends A implements T
{ {
$call instanceof Closure; $call instanceof Closure;
// ^^^^^ @variable // ^^^^^ @variable
// ^^^^^^^^^^ @keyword // ^^^^^^^^^^ @keyword.operator
// ^^^^^^^ @type // ^^^^^^^ @type
fn ($a, $b) => $a + $b; fn ($a, $b) => $a + $b;
// ^^ @keyword.function // ^^ @keyword.function
@ -147,7 +158,7 @@ class B extends A implements T
print("a"); print("a");
// ^^^^^ @keyword // ^^^^^ @keyword
exit; exit;
// ^^^^ @keyword // ^^^^ @keyword.return
exit(); exit();
// ^^^^ @function.builtin // ^^^^ @function.builtin
exit(1); exit(1);