Something went wrong. Try again.
A post-modern development environment.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327(php_tag) @tag(php_end_tag) @tag
; Variables
(relative_scope) @variable.builtin
(variable_name) @variable
((name) @constant (#match? @constant "^_?[A-Z][A-Z\\d_]+$"))
((name) @constructor (#match? @constructor "^[A-Z]"))
((name) @variable.builtin (#eq? @variable.builtin "this"))
; Types[ (primitive_type) (cast_type)] @type.builtin
(named_type [ (name) @type (qualified_name (name) @type)])
(base_clause [ (name) @type (qualified_name (name) @type)])
(enum_declaration name: (name) @type.enum)
(interface_declaration name: (name) @constructor)
(class_declaration name: (name) @constructor)
(trait_declaration name:(name) @constructor)
(namespace_definition name: (namespace_name (name) @namespace))
(qualified_name prefix: (namespace_name (name) @namespace))
(namespace_use_clause [ (name) @namespace (qualified_name (name) @type) ])
(namespace_use_clause alias: (name) @namespace)
(class_interface_clause [(name) @type (qualified_name (name) @type)])
(scoped_call_expression scope: [(name) @type (qualified_name (name) @type)])
(class_constant_access_expression . [(name) @constructor (qualified_name (name) @constructor)] (name) @constant)
(use_declaration (name) @type)
(binary_expression operator: "instanceof" right: [(name) @type (qualified_name (name) @type)])
; Superglobals(subscript_expression (variable_name(name) @constant.builtin (#match? @constant.builtin "^_?[A-Z][A-Z\\d_]+$")))
; Functions
(array_creation_expression "array" @function.builtin)(list_literal "list" @function.builtin)
(method_declaration name: (name) @function.method)
(function_call_expression function: (_) @function)
(scoped_call_expression name: (name) @function)
(member_call_expression name: (name) @function.method)
(function_definition name: (name) @function)
(nullsafe_member_call_expression name: (name) @function.method)
(object_creation_expression [(name) @constructor (qualified_name (name) @constructor)])
; Parameters[ (simple_parameter) (variadic_parameter)] @variable.parameter
(argument (name) @variable.parameter)
; Property hooks (PHP 8.4): the `get`/`set` accessor name parses as a plain; `name`; anchor to the first child so names inside the hook body aren't caught.(property_hook . (name) @keyword)
; Member
(property_element (variable_name) @variable.other.member)
(member_access_expression name: (variable_name (name)) @variable.other.member)(member_access_expression name: (name) @variable.other.member)
; Attributes(attribute_list) @attribute
; Basic tokens
[ (string) (encapsed_string) (heredoc_body) (nowdoc_body) (shell_command_expression) ] @string(escape_sequence) @constant.character.escape
(boolean) @constant.builtin.boolean(null) @constant.builtin(integer) @constant.numeric.integer(float) @constant.numeric.float(comment) @comment
(goto_statement (name) @label)(named_label_statement (name) @label)
; Keywords
[ "default" "echo" "enum" "extends" "final" "goto" "global" "implements" "insteadof" "new" "print" "private" "protected" "public" "clone" "unset"] @keyword
[ "if" "else" "elseif" "endif" "switch" "endswitch" "case" "match" "declare" "enddeclare" "??"] @keyword.control.conditional
[ "for" "endfor" "foreach" "endforeach" "while" "endwhile" "do"] @keyword.control.repeat
[ "include_once" "include" "require_once" "require" "use"] @keyword.control.import
[ "return" "break" "continue" "yield" "yield from"] @keyword.control.return
[ "throw" "try" "catch" "finally"] @keyword.control.exception
[ "as" "or" "xor" "and" "instanceof"] @keyword.operator
[ "fn" "function" ] @keyword.function
[ "namespace" "class" "interface" "trait" "abstract" ] @keyword.storage.type
[ "static" "const" "readonly"] @keyword.storage.modifier
[ "," ";" ":" "\\" ] @punctuation.delimiter
[ (php_tag) (php_end_tag) "(" ")" "[" "]" "{" "}" "#["] @punctuation.bracket
[ "="
"." "-" "*" "/" "+" "%" "**"
"~" "|" "^" "&" "<<" ">>"
"->" "?->"
"=>"
"<" "<=" ">=" ">" "<>" "==" "!=" "===" "!=="
"!" "&&" "||"
".=" "-=" "+=" "*=" "/=" "%=" "**=" "&=" "|=" "^=" "<<=" ">>=" "??=" "--" "++"
"@" "::"] @operator