Is there a way to tell 'add method' _where_ to put it in the class?

I find i use the alt+enter functionality to create new methods quite a lot.

If i am in an open scope and do something like

$mail = new my_mail_class();
$mail->send();

and the send() function does not exists then hoveing over it and hitting alt+enter will popup a dialog "add method" which will create an empty public method in that class.

Same thing works if i am inside the class

$mail_receivers = $this->_get_mail_receivers();

and the _get_mail_receivers method does not exist, hitting alt+enter will bring up "add method" and create a new private method.

Great feature!

What im wondering is: Is there a way to tell it WHERE in the class to make it.

I like to keep all my public methods at the top of a class and the private ones at the bottom.

WHAT HAPPENS NOW:
When I add a new public or private method using this feature it always goes to the bottom of the class.  I have to copy and paste it to where i want it to be.

WHAT IM HOPING CAN HAPPEN:
I can define a break point that is common to classes that will define the types of methods that go in each location and when new methods are created they will get put at the bottom of these locations.

kind of like this in the class:
########################################
# PRIVATE METHODS BELOW HERE
########################################

Is there any way to do this now?

2 comments

One of the IDE's that I use to use before phpStorm had a feature in the generator where you could define at generation where to put a generated property or method.

Maybe a simple dropdown box in the dialog box with a list of properties or methods depending on the scope of genration.
Ex. Pick the method you want the new method placed after.

Maybe a feature request should be opened in the tracker.
That is, if we are on the same page.
I know I would like what I just mentioned.

0

Not yet.
You can file a feature request to project issue tracker.

0

Please sign in to leave a comment.