-
Notifications
You must be signed in to change notification settings - Fork 1
4.2. Refactoring
Copy lines which you want to refactor. Refactor>Refactor this or ctrl + T. Select appropreate choice such as Method... or type met to filter. It will show a panel Extract Method. Select Visibility, Public, Protected or Private. Type a Name. It will create a method and replace the original with a new method name.
ctrl + T and select Rename. It will show a panel at the bottom to show all occurences. Click Do Refactor to complete.
Refactor to create a method. Move a cursor to the new method and ctrl + T, select Pull Members Up. And confirm Pull up members of ... to: BaseController. Then click Refactor to move the method to the parent controller.
- Rename a class
ctrl + T > Rename. This will change the file name automatically as well.
- Extract an interface, have the class implement that interface.
ctrl + T > Interface. This will display Extract Interface From Class ... Type Interface Nmae, Namespace and select Members to form interface. Click Refactor. This will add comments at the top of the file.
To modify the comments, cmd + , > file template > PHP Interface, delete #parse("PHP File Header.php").
<?php
#if (${NAMESPACE})
namespace ${NAMESPACE};
#end
interface ${NAME} {
}
PHPStorm implements the class with that interface.
Important: The Tables of Content are generated. Any change will be overridden on the next update.
For more information: GitHub Wikifier