How to rearange the access methods?

I have a number of classes (entities or data objects) with only members and access methods (and maybe some constants or something like this, but it doesn't really matter here). The access methods are ordered as pairs. For every member $foo first is the getter getFoo() defined and then follows the according setter setFoo($foo). Now I need them to be ordered as: first setter, then getter. How can I reorder the access methods?

0
2 comments

Hi there,

You may do that manually: if you place caret on a line with method declaration .. and invoke "Code | Move Statement Up/Down" then it will move whole function (+ PHPDoc comment if available) before previous/after next method.

Another possible option (although I'm not sure if it will do exactly what is asked) -- Code Style ("Settings/Preferences | Editor | Code Style | PHP | Arrangement") -- try configuring it so it sorts in Z-A order. You can then use "Code | Rearrange Code" on whole file.

1

Hi Andriy,

Thank you for your answer!

I could not do it with "Rearrange". In the end I simply "searched in pah" "public function set" and moved the methods manually (with "move up", in my case Alt+Up, on the method's name/signature).

0

Please sign in to leave a comment.