How can I get PhpStorm to go to the right declaration

2.4k views Asked by At

I have the following snippet of code.

abstract class MrParent {
  public function __construct() {
    $this->var = 'a';
  }
}

class MrChild extends MrParent {
  public function hello() {
    echo 'Hello';
  }
}

$MrGuy = new MrChild();

Now, in PhpStorm, when I middle-click ("Go To Declaration") on the last line of the "MrChild" class, the cursor jumps up to the "__construct" line. I was expecting it to go to the "class MrChild extends MrParent" line.

In a single document, this is OK, but in a setup where it's one class per file, this is quite annoying because it means the IDE is constantly showing me the class I don't want.

I know that if I added the following code to the "MrChild" class, I'd get what I want, but that seems like I shouldn't be fixing what I consider to be an IDE bug by adding extra code.

public function __construct() {
    parent::__construct();
}

Do you have any suggestion?

1

There are 1 answers

0
CrazyCoder On BEST ANSWER

You are facing WI-4880 issue. Feel free to watch/vote.