Reputation: 9426
PhpStorm has a nice little rearrange feature, but I can't seem to get it to work.
I have a set of functions that my framework uses in every page. I want them to always be in the same order (and hopefully have 2 newlines between each one). For example:
class myClass {
function head() {}
function css() {}
function html() {}
function js() {}
}
I set up up my arrange tab under Settings > Editor > Code Style > PHP to look like this:
After doing this, clicking the Rearrange Code option still did nothing. I've also tried adding method to each one, like this:
It made no difference.
Is there a way to get PhpStorm to automatically rearrange functions in a user defined order (hopefully with 2 newlines in between each)?
Upvotes: 1
Views: 937
Reputation: 14927
You need to put the rules before the method - by modifiers
(default) one.
This way, your methods will always come first and then PHPStorm will order the rest like it usually does. If they're at the end, all of the methods will already have been consumed by the default rule, so the remaining rules won't matter.
Also, you need to specify method
as you did in your second example.
Then, using Rearrange Code
should do it (I've just tested it).
Upvotes: 1