I'm new! Question about PHP array new line wrapping
So I'd like to wrap my PHP arrays so that I can type "array('something'," ...then hit <enter> and have the next line aline under the first item in my array list. Is this possible? I've messaged with the 'Preferences' > 'Code Style' > 'PHP' > 'Wrapping And Braces' > 'Array Initializer' but nothing I change there seems to do anything. Do I need to turn on formating somewhere?
I'm new to PHPStorm so any help would be great. Thanks!
Please sign in to leave a comment.
I have been looking for the same option for a long time.
This is what I want:
$foo = array('one' => 1,
'two' => 2
);
But this is what I get:
$foo = array('one' => 1,
'two' => 2);
Any ideas?
I believe
Code style | PHP | Wapping and braces | Array initializer | Chop down if long
and also enabling "Align when mulitline" should do the trick.
I just tried that again, but it's what happens is after I hit enter after typing the comma in the below line the cursor goes to column zero.
$foo = array('one' => 1,
)
Same thing if I try to modify this code to add "three"
$foo = array('one' => 1,
'two' => 2);
$foo = array('one' => 1,
'two' => 2,
'three' => 3);
Now if I do Code | Reformat code... it sets is correctly. It just doesn't work as expected when typing.
Ya...I don't think the preferences are working for this. Where do we report that?
http://youtrack.jetbrains.net/issues/WI#newissue=yes
Steve (or anyone else searching for a solution to this)
I just created http://youtrack.jetbrains.com/issue/WI-22628. Up votes / Stars would be great.
Make that http://youtrack.jetbrains.com/issue/WI-15775 since my bug was just marked as duplicate.