Simply, I have now code like following:
$myArray = array( 'restaurant_id' => $res_id, 'menu_id' => $menu_id, 'food_id' => $foods_id);
After reformatting my array is show in one line. If array is long it is time wasting to navigate right side of the editor.
I want to reformat all of my code array snippet like following:
$myArray = array(
'restaurant_id' => $res_id,
'menu_id' => $menu_id,
'food_id' => $foods_id);
How can I achieve that?
Reformat File dialog The dialog appears when you press Ctrl+Alt+Shift+L in the editor of the current file. If you choose Code | Reformat Code from the main menu or press Ctrl+Alt+L , PhpStorm tries to reformat the source code of the specified scope automatically.
Go to Settings/Preferences | Editor | Code Style, select your programming language, and open the Wrapping and Braces tab. In the Keep when reformatting section, select the formatting rules which you want to ignore and deselect those which should be applied. Reformat your code ( Ctrl+Alt+L ).
While in the editor, select the necessary code fragment and press Ctrl+Alt+I . If you need to adjust indentation settings, in the Settings/Preferences dialog ( Ctrl+Alt+S ), go to Editor | Code Style. On the appropriate language page, on the Tabs and Indents tab, specify the appropriate indents options and click OK.
Finally! I found the problem. In File | Settings | Editor | Code Style | Wrapping and Braces | Array Initializer
Option was do not wrap.
For that reformat code was not working as expected.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With