Reputation: 7225
Code inside <?php ?>
doesn't always get indented in PhpStorm. It acts like this:
<?php
echo 's';//PRESS ENTER
//caret jumps here
if($boolean){//PRESS ENTER
//caret jumps here(as expected)
}
?>
How to fix this?
Upvotes: 3
Views: 1647
Reputation: 44823
By default, PHP code is only indented in a code block ({...}
or an array definition, like array(...)
). In other words, by default, PHPStorm formats code like this:
<?php
echo 's';//PRESS ENTER
//caret jumps here
if($boolean){//PRESS ENTER
//caret jumps here(as expected)
}
?>
To make it indent inside the <?php ... ?>
tags, go to Preferences > Editor > Code Style > PHP > Other and check "Indent code in PHP tags", like this:
You can see both the check box and the resulting formatting in the image above.
Upvotes: 5
Reputation: 38584
I have some few updated code with PHPStorm.
Import this setting to yours. It has lot features associate with this.
- Php
- SQL
- CSS
- JS
Upvotes: 0