Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Netbeans PHP spaces in array declaration

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.

like image 980
Nolias Avatar asked Dec 14 '22 09:12

Nolias


1 Answers

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

enter image description here

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.

like image 193
Chetan Ameta Avatar answered Dec 25 '22 09:12

Chetan Ameta