PHPStorm intentions 'Initialize field' option from all methods (non __construct)

In our projects we inject data via single method `->populate($param,$param2...)`. This is because of symfony DI where all required services has to be type-hinted in constructor. We build action objects as services, not by `new`.

We do a lot of such classes every day. Creating class fields from `populate` params is time consuming and changing method name to `__construct` just to use `initialize fields` option is really annoying.

My question is: how I can make `Intentions->Initialize fields` to work on any class method?
Is there a way to modify current intention or add new one that will do that.
Is there someone who has/know/can modify or make such intention (plugin?) that will allow us to use this feature on not construct methods?

With regards.

1 comment

My question is: how I can make Intentions->Initialize fields to work on any class method? Is there a way to modify current intention or add new one that will do that.

Currently, there's no way to do that.

Is there someone who has/know/can modify or make such intention (plugin?) that will allow us to use this feature on not construct methods?

If you know Java, you can start here: https://confluence.jetbrains.com/display/PhpStorm/Plugin+Development

0

Please sign in to leave a comment.