PhpStorm 2024.3 Help

Implement methods of an interface or abstract class

If a class is declared as implementing a certain interface or extending a class with abstract methods, it has to implement the methods of such interface or class. PhpStorm creates stubs for implemented methods .

Implement required methods

  1. By default, the classes that do not implement the required methods are detected by the Class hierarchy checks code inspection and highlighted in the editor.

    Class hierarchy check in the editor

    Click the light bulb icon the Quick-fix button or press Alt+Enter and select Add method stubs.

    Class hierarchy check quick-fix

    Alternatively, from the main menu, select Code | Implement methods or press Ctrl+I. You can also right-click anywhere in the class file, then click Generate Alt+Insert, and select Implement methods.

  2. In the dialog that opens, select the methods to implement (hold the Shift or Ctrl key to perform a multi-selection). The list does not include the methods that are already implemented or cannot be accessed from the current class. The methods that are required for the current class are selected by default. If necessary, select the Add PHPDoc checkbox to insert PHPDoc comments for the implemented methods and choose the desired PHPDoc.

    The Choose Methods to Implement dialog
Last modified: 08 October 2024