Auto indent with php 8.0
Hello,
with PHP 8, since we can declare variable name in function calls , i tried to use this functionnaly with the "auto-indent" functionnaly.
Actually when i use the auto indent function, the result is :
return new Node\Stmt\Expression(
expr: new Node\Expr\Assign(
var: new Node\Expr\Variable('base'),
expr: new Node\Expr\New_(
class: new Node\Name\FullyQualified('SQLiteDatabase'),
args: [
new Node\Arg($this->file),
],
),
),
);
}
And I would like it look like this :
return new Node\Stmt\Expression(
expr: new Node\Expr\Assign(
var: new Node\Expr\Variable('base'),
expr: new Node\Expr\New_(
class: new Node\Name\FullyQualified('SQLiteDatabase'),
args: [
new Node\Arg($this->file),
],
),
),
);
All I want is that the line start at the same position than the cursor when I press enter at the end of the line like this:

How can I achieve this ?
Thank you
Thank you.
请先登录再写评论。
Could you please check if the behavior is any different in version 2021.2 EAP: http://www.jetbrains.com/phpstorm/eap/?
Yes, it just add a space between var: and new :
Try to open File | Settings | Editor | Code Style | PHP > Wrapping and Braces tab and disable "Align when multiline" for function/constructor call argument:
Hello,
now I have this result :
Could you please export your code style & share it somehow? You can drop it at https://uploads.jetbrains.com/
There is a the id of the upload.
Upload id: 2021_07_19_JcvzviZSwZPTvL9E (file: Default.xml)
Thanks. Please try to import this scheme: https://drive.google.com/file/d/1TfX4Az-FktqW8RrTHytrxexnILzRZr_w/view?usp=sharing
It's based on your with a couple of adjustments.
Hello,
Thank you very much, it worked !
This is only working with this scheme and PhpStorm 2021.2-EAP and next releases I guess.
Advanced information about version :
PhpStorm 2021.2 Beta
Build #PS-212.4746.20, built on July 14, 2021
Oh yeah, sorry, forgot to mention that 2021.2 is required: one of the formatting options is available only starting ver. 2021.2.
Happy to hear this is working as expected now.