Skip to content

Keywords should be colored as methods, when used as methods. #2817

@danon

Description

@danon

Information

  • Language: PHP
  • Plugins: none

Description

In PHP there are keywords, which can't be used as class names or variable names, but they can be used as method names.

For example, match and foreach are keywords, but they can be used as $var->match() and $var->forEach() methods.

For example GitHub and PhpStorm colors this code corectly.

Code snippet

Test page

The code being highlighted incorrectly.
$variable->foreach(); // this "foreach" is a method
$variable->method();  // this is also a method

foreach ($list as $value) { // this "foreach" is a keyword
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions