View source code hierarchy
With PhpStorm, you can examine the hierarchy of classes, methods, and calls and explore the structure of source files.
Build hierarchies
Type hierarchies show parent and child classes of a class.
Method hierarchies show subclasses where the method overrides the selected one as well as superclasses or interfaces where the selected method gets overridden.
In the hierarchy tree, PhpStorm displays
to indicate subclasses that are not abstract but don't have the method defined in them. When a method is not defined in a class, but is defined in the superclass, PhpStorm displays
.
Call hierarchies show callers (supertypes) or callees (subtypes) of a method.
When built, a hierarchy can be immediately viewed and examined in the Hierarchy tool window. By default, every new built hierarchy overwrites the contents of the current tab. You can retain the current tab and have the next hierarchy built in a new one.
Build a type hierarchy
Select the desired class in the Project tool window or open it in the editor.
From the main menu, select Navigate | Type Hierarchy or just press Ctrl+H.
Build a method hierarchy
Open the file in the editor and place the caret at the declaration of the desired method.
Alternatively, select the desired method in the Project tool window.
From the main menu, select Navigate | Method Hierarchy or press Ctrl+Shift+H.
Build a call hierarchy
Open a file in the editor and place the caret at the declaration or usage of the desired method.
Alternatively, select the desired method in the Project tool window.
From the main menu, select Navigate | Call Hierarchy or press Ctrl+Alt+H.
Retain a hierarchy tab
In the Hierarchy tool window, click the Pin Tab button
on the toolbar.
Viewing hierarchies
Open the Hierarchy tool window
Make sure, you have already built hierarchies to show, see Building hierarchies above.
Select View | Tool Windows | Hierarchy from the main menu.
Navigate between the tabs
Click the currently displayed tab and select the next one to display from the list.
Toggle between views
With PhpStorm, you can build and explore ascending or descending hierarchies, that is, callee or caller methods, parent or children classes, and so on.
Click
or
to show caller methods or callee methods respectively.
Thanks for your feedback!