Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to auto-generate methods of the implemented interface

Is there a way in PhpStorm to automatically generate the empty methods that are required by the interface the given class is implementing?

Say we have an Interface with 3 methods - when defining the new class that implements this interface - some option to auto-generate containers for all required methods.

like image 560
Sebastian Sulinski Avatar asked Jan 20 '15 18:01

Sebastian Sulinski


2 Answers

Sure, you can.

There are 3 ways to do it :

  1. Press
    Ctrl + I
  2. On main menu, click
    Code --> Implement Methods
  3. On the code editor, press right click on your mouse, then click
    Generate --> Implement Methods

After that, you can select one or some method(s), then click OK.

like image 81
Adi Priyanto Avatar answered Sep 28 '22 03:09

Adi Priyanto


From my comment: You could try ALT + ENTER. This normaly shows up a small "dialog" to autogenerate phpdoc, functions, etc.

like image 43
bish Avatar answered Sep 28 '22 04:09

bish