Change Class Property to Method

I'm upgrading an application from CakePHP 2 to CakePHP 4, annoyingly one of the tasks I need to change all:

$this->params['option']

To

$args->getOption('option')

 

Where option could be anything.  Does anyone know if there is something native in phpStorm that will assist with the change, Shift+F6 doesn't like classes.

 

Many thanks in advance and stay safe.

0
2 comments

I am not really familiar with CakePHP, but if the only variable in such a statement is the option name, you can use Find in Files along with Regex for that:
https://recordit.co/9ycMurqMQz

Search pattern: \$this->params\[(\S*)\]
Replacement pattern: \$args->getOption\[$1\]

1

That worked great, thanks Eugene Morozov, sorry for the delay in replying.

0

Please sign in to leave a comment.