Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PhpStorm/IntelliJ generate method from usage

I'm looking for a generate method from usage. IntelliJ supports extract, rename etc. But if i write, for instance, $this->new_method($a) i would like to quickly generate this method in the same class. Does this exist or maybe there is a plugin for it?

Thanks for any help

like image 642
apartridge Avatar asked Mar 30 '13 16:03

apartridge


People also ask

How do I extract a method in IntelliJ?

To extract method:Press Ctrl+Alt+M or from the main menu, select Refactor | Extract | Method. In the dialog that opens, configure a method options, such as visibility, parameters, and so on. You can also change a name of the method if you need. Click OK.

How do I find my method usage in IntelliJ?

In the editor, select a symbol for which you want to see the usages. From the main menu, select Edit | Find Usages | Show Usages In Code Ctrl+Alt+F7 . The usages window shows the current scope and total count of usages. If you want to quickly switch to the default scope, press Ctrl+Alt+F7 .

How do I automatically set getters and setters in IntelliJ?

You can use ⌘N (macOS), or Alt+Insert (Windows/Linux) for the Generate menu and then select Constructor , Getter , Setter or Getter and Setter .


1 Answers

  1. Place cursor on non existing method
  2. Alt + Enter (or wait and click on light bulb)
  3. Choose Add method from submenu.

enter image description here

like image 165
LazyOne Avatar answered Oct 15 '22 01:10

LazyOne