Reputation: 206
I need these chunks of code to be indented properly like this:
$this->render('rights', array(
'admin' => $admin,
'editor' => $editor,
'author' => $author,
));
and widget snippet:
<?php $this->widget('zii.widgets.CMenu', array(
'items' => array(
array('label' => 'label', 'url' => 'url')
)
)); ?>
With default PHPStorm settings it indents this code like this:
$this->render('rights', array(
'admin' => $admin,
'editor' => $editor,
'author' => $author,
));
I went to Settings->Code Style->Wrapping and Braces and changed following options:
The result is:
$this->render('rights', array(
'admin' => $admin,
'editor' => $editor,
'author' => $author,
));
Still not the style I want, but that's all I managed to accomplish. Can you please point me to the option I need to change?
Upvotes: 18
Views: 23753
Reputation: 11543
I've found that unchecking the following option solves the issue for me:
Preferences > Editor > Code Style > PHP > Tab 'Wrapping and Braces' > Function/constructor call arguments > Align when multiline
This changes the following code:
var $numbers = $this->thing(array(
"one",
"two",
"three",
"four",
"five",
"six"
));
To be formatted like:
var $numbers = $this->thing(array(
"one",
"two",
"three",
"four",
"five",
"six"
));
Upvotes: 3
Reputation: 595
Try selecting all the code and clicking :
Ctrl + Alt + I
It's auto indentation shortcut ...
Upvotes: 27
Reputation: 2735
I think this will help you in formatting Your code https://laracasts.com/series/how-to-be-awesome-in-phpstorm/episodes/8
Upvotes: 3
Reputation: 401877
It seems a to be a known issue. Please watch/vote or add your comments there.
Upvotes: 7