Array auto formatting Follow
Hi,
I'm struggling with PHPStorms array auto formatter (v2.1.1). Basically I want something like this:
$values = array(
1 => "1",
2 => "2",
3 => "3",
4 => "4"
);
I adjusted the array initializer wrapping in PHPStorms Code Style Settings, but wrapping only formats it like this:
$values =
array
(
1 => "1",
2 => "2",
3 => "3",
4 => "4"
);
Is there a valid setting for what I want? What would it be?
Thanks for any helpful hints!
Please sign in to leave a comment.
Try that:
Settings -> Code Style -> Wrapping and Braces -> Php tab:
Array initializer: Do not wrap
- Align when multiline - false
- New line after '{' - true
- Place '}' on new line - true
Or try Predefined... and select PEAR
@V V
Good try, but not what I want; the "Do not wrap" setting and the PEAR selection both lead to
$values = array(
1 => "1", 2 => "2", 3 => "3", 4 => "4"
);
which is not too bad, but a little confusing sometimes.
I wonder if my preferred formatting can be done at all, although to me it seems to be a usual way, at least I've seen it often.
From my experience, currently it is impossible.
Yeah, so it seems...