How to auto-generate methods of the implemented interface

柔情痞子 提交于 2019-12-10 13:23:49

问题


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.


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/28052463/how-to-auto-generate-methods-of-the-implemented-interface

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!