PhpStorm
 
Get PhpStorm

Pull members up, push members down

Last modified: 08 October 2024

The Pull Members Up refactoring allows you to move class members to a parent class. This may be helpful when you start to add functionality from the bottom of the class hierarchy and then realize that it can also be 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). With the Pull members up refactoring, you no longer need to manually copy a method or field from one class, paste it into another and fix internal references in the member.

The Push Members Down refactoring helps clean up the class hierarchy by moving class members to a subclass. The members are then relocated into the direct subclasses only.