Netbeans PHP spaces in array declaration

依然范特西╮ 提交于 2020-01-03 18:30:47

问题


Simple question, I have array:

array(
  'aaa' => 1,
  'bbbbbbbb' => 2,
  'ccccc' => 3,
  'dd' => 4
);

and I want format code to:

array(
  'aaa'       => 1,
  'bbbbbbbb'  => 2,
  'ccccc'     => 3,
  'dd'        => 4
);

Is there a Formatting option to do this, because I don't see anything like this?

PS. Sorry for my English.


回答1:


PHP code into NetBeans 7.1 In Alignment category there are new properties for Group Multiline Alignment - Assignment and Array Initializer.

On the left site - Assignment property is off and on the right site the property is on. As you can see, when the property is set on, then the assignment char '=' is placed after the longest identifier in a group. The group is defined as a number of lines that contains the same type of assignments. End of a group can be empty line, line where is only a comment, different expression, end of a block. This formatting options works for variable assignment, field initialization and constants.

The second new property is for Array Initializer.

Both properties are switched off by default. Just turn it on and you are done.




回答2:


I am working on NETBEAN for so long, The Best practise is alt+shift+F



来源:https://stackoverflow.com/questions/34853565/netbeans-php-spaces-in-array-declaration

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!