vscode-intelephense icon indicating copy to clipboard operation
vscode-intelephense copied to clipboard

Unconsistent syntax highlighting when using instance with $this inside class

Open ludwig801 opened this issue 5 months ago • 0 comments

Describe the bug When using $this in an instanceof clause, any function used inside that block which belongs to the original $this does not count for the usages within the class, and the symbol is highlighted as unused.

To Reproduce Let's assume there is a class MyClass which implements a method doA() and doB() and an interface MyInterface.

Then, within the MyClass body:


class MyClass {
  ...
  
  private function doA() {
    if($this instanceof MyInterface) {
      $this->doB();
    }
  }
  
  // Even though doB() is used in doA, because it is inside a instanceOf clause, that usage is disregarded and 
  // doB() will show as having no usages. However, "Find All References" finds the reference inside doA().
  private function doB() {
    ...
  }
}

Screenshots Usage within class:

Method still shows as unused

Platform and version

  • Windows 11
  • VSCode v1.93.1
  • Intelephense v1.12.6

ludwig801 avatar Sep 26 '24 14:09 ludwig801