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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With