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?
The dialog appears when you press Ctrl+Alt+Shift+L in the editor of the current file. If you choose Code | Reformat Code from the main menu or press Ctrl+Alt+L , PhpStorm tries to reformat the source code of the specified scope automatically.
IDEA has a “smart tabs” option that you can turn on: If this check box is selected, IntelliJ IDEA inserts tabs for indentation and reformatting, but fine alignment to a necessary column is done only via spaces. This is done in order to preserve visual representation of the source code, when the Tab Size is changed.
Try selecting all the code and clicking :
Ctrl + Alt + I
It's auto indentation shortcut ...
It seems a to be a known issue. Please watch/vote or add your comments there.
I think this will help you in formatting Your code https://laracasts.com/series/how-to-be-awesome-in-phpstorm/episodes/8
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With