自动格式化/对齐阵列PhpStorm

时间:2017-12-14 03:45:50

标签: php arrays phpstorm

我正在使用Ubuntu。

如何点击 Ctrl + Alt + Shift + L 重新格式化我的代码时,如何告诉PhpStorm 2017.3保留以下数组:

<?php
return [

'page_not_found' => 'Page not Found',
'message_required' => 'Please enter your message',
];

到这个

<?php
return [

'page_not_found'   => 'Page not Found',
'message_required' => 'Please enter your message',
];

1 个答案:

答案 0 :(得分:5)

目前我正在回答关于PHP设置的问题(它与其他语言类似。)

1)打开PHP Storm

2)转到设置

3)查找editor tab&gt; Code style&gt; PHP

4)现在你会找到选项"Wrapping and braces"(第三个标签)

5)现在,在该标签的最后第3个选项中,您会找到Array Initializer(选择前2个选项。结帐屏幕截图)screenshot