PhpStorm 2019.1 Help

Tutorial: Finding usages of implemented and overridden PHP methods

In the PHP context, PhpStorm applies the Find Usages functionality to implemented and overridden methods. Let's consider the following example:

  1. Create an interface, an abstract class that implements it, and two classes that extend the abstract class, organized as follows:

    1. An interface MyInterface with a foo() method.

    2. An abstract class MyAbstractClass that implements MyInterface.

    3. A class MyClass that extends MyAbstractClass, implements foo() required by the interface, and overrides the methods of the parent class.

    4. A class MyClassWithDelegate that extends MyClass and implements foo() with a delegate.

    5. The $b and $c variables that call foo() from MyClass and MyClassWithDelegate respectively:

    <?php interface MyInterface { //press Alt-F7 on foo() here public function foo(); } abstract class MyAbstractClass implements MyInterface { public function foo () { // TODO: Implement foo() method. } } class MyClass extends MyAbstractClass { public function foo() { parent::foo(); } } class MyClassWithDelegate extends MyClass { public function foo() { foo(); } } $b = new MyClass(); $b->foo(); $c = new MyClassWithDelegate(); $c->foo();
  2. From MyInterface, invoke Find Usages Settings for foo() by pressing Ctrl+Shift+Alt+F7 or choosing Edit | Find | Find Usages Settings from the main menu.

  3. In the Find Usages. Method Options dialog that opens, select the Include overriding/implementing methods checkbox and click Find.

  4. PhpStorm will find the methods that implement or override the base method and display them in the Find tool window:

    find usages with overridden

Last modified: 17 June 2019