PhpStorm - Extract Method - Can the behaviour be modified?

Hi there,

We have a particular task upcoming which is going to be incredibly tedious.

In order to mitigate the pain of this process it would be nice to write a PhpStorm plugin which removes some of the legwork.

We will have a number of existing skeleton classes (let's call them 'Placeholders'') into which we will be moving a number of pieces of existing code that exists in client code. This is the first step of a larger refactoring.

Is it possible to hook into the extract method refactoring at all? Essentially I wish to be able to apply the "extract method" process to the selected code, but provide a list of these skeleton classes (of which the user can select one) into which the new method will be placed, replaced in the client code with a call to the newly created method. We would have standardised access to these "placeholder" classes (i.e. Placeholder::getInstace()->newMethod() -- not quite like that, but you get the idea).

I suppose my question is - do you think that's feasible given the current API? Would I need to write the entire refactoring process myself? Or can I leverage existing extract method?

Just to be clear, all of this would be for PHP only.

Many thanks,

- Nils

1 comment

Hi Nils,

This sounds a lot more like the use case of 'Move', than 'Extract method...' to me.
Does that meet your requirements?

Alan

0

Please sign in to leave a comment.