1

Is there any way in PhpStorm to convert string

$arr = array('where' => '{"key_4":' . $this->key_4 . '}', 'key_2' => $this->user->key_2, 'key_3' => $this->user->key_5, 'key_6' => '');

into

$arr = array(
    'where' => '{"key_4":' . $this->key_4 .'}',
    'key_2' => $this->user->key_2, 
    'key_3' => $this->user->key_5, 
    'key_6' => ''
);

Has anyone some ideas?

2
  • You may configure your Code Style to do such array formatting -- see array declaration settings. But if question was "is there such action that would do that without touching code style" -- nope. Commented Mar 31, 2017 at 11:33
  • @LazyOne what options I need to change in code style? PhpStorm doesn't reformat code to multiline by pressing Ctrl+Alt+L Commented Mar 31, 2017 at 11:34

1 Answer 1

4

These are the only changes that I've done in Default scheme to get such formatting:

enter image description here

Results (before and after):

enter image description here

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks a lot. I waste over 30 minutes by searching myself

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.