TroodoN-Mike
TroodoN-Mike

Reputation: 16175

Moving up/down methods in PhpStorm

I like organising my methods in a class so that protected functions are on the bottom, public on the top. Sometimes, I write a protected method on the bottom of the file and then I realize it's actually a public method.

Is there a keyboard shortcut to move methods up/down without using the standard cut (Ctrl+X) / paste (Ctrl+V) features in PhpStorm?

Upvotes: 14

Views: 3115

Answers (1)

LazyOne
LazyOne

Reputation: 165188

Code | Move Statement Up/Down Ctrl + Shift + Up/Down -- no selection required: just place cursor in function declaration line.

Alternatively:
Configure your ordering rules at Settings | Code Style | PHP | Arrangement and then use Code | Rearrange Code (selection is required, AFAIK). If such action is not available then reformat your whole file (Code | Reformat Code...) -- it has an option to rearrange entries.

Upvotes: 23

Related Questions