Refactoring for Class Members in PhpStorm 6: Pull Up and Push Down
As you work on a big project, you often face the need to refactor your code to maintain it properly. Likewise, there are many situations when you start to add functionality from the bottom of the class hierarchy and then realize it can be also used in more common cases (otherwise some parts of your code may become obsolete for the parent class but still be valid for one of its children).
To fix this, you copy a method or field from one class, paste it into another and fix internal references in the member. This isn’t so difficult, yet rather annoying if done over and over.
With PhpStorm, both of these tasks become much easier. To help you move class members thought the hierarchy, the IDE offers you two helpful refactorings: Pull Members Up and Push Members Down.
Pull Up Refactoring
To perform this refactoring, place the caret inside the class and choose Refactor | Pull Members Up… in the menu. The Pull Members Up dialog will display:
Now, configure the list of members to be pulled up and the target class. If no conflicts are found, the refactoring will be performed immediately, otherwise you’ll need to resolve the conflicts.
That’s all – PhpStorm will take care of all other actions for you. Here’s how it looks after the refactoring is complete:
Push Down Refactoring
Push Down refactoring looks very similar: place the caret inside the class and choose Refactor | Push Members Down… in the menu.
You also can choose the list of class members to be pushed down, and they will be moved to the direct child classes.
We hope you find these refactorings useful in your daily work. If you find any bugs or come up with any feature requests related to Pull Up/Push Down, please file in our issue tracker.
Develop with pleasure!
– JetBrains Web IDE Team.
Working with Windows Azure SQL Database in PhpStorm
PhpStorm provides us the possibility to connect to Windows Azure SQL Database right from within the IDE. In this post, we’ll explore several options that are available for working with Windows Azure SQL Database (or database systems like SQL Server, MySQL, PostgreSQL or Oracle, for that matter): …
Change signature refactoring in PhpStorm
A very powerful refactoring is the Change signature refactoring in PhpStorm. It enables us to modify a function signature in many ways: we can change the function name, change its visibility, add, remove and reorder parameters as well as rename parameters. (more…)…
Folding for imports in PhpStorm 6.0
In PhpStorm 6, we've introduced code folding for imports. Any list of imports will now be folded into a single line. This greatly reduced clutter in your editor when having a lot of imports! (more…)…
Drag & Drop Project Files to Remote Hosts in PhpStorm
The Remote Host pane allows us to work directly on a remote server through FTP, FTPS, SFTP or a local/network folder. A lot of people asked us to add drag & drop to the Remote Host pane in PhpStorm. Good news: PhpStorm 6 comes with drag & drop as well as copy & paste support from the pro…