Code-style: multi-line return not indented

I am having trouble with the code formatting when there is a multi-line return statement, e.g.

    return $this->isSomething() &&
$this->hasSomethingElse() &&
$this->isThisTrue();

The formatter always creates the following:

    return $this->isSomething() &&
$this->hasSomethingElse() &&
$this->isThisTrue();

Can I tell it to keep the indent for such lines?

 

Thanks!

2 comments

Hello,

Please enable option File | Settings | Editor | Code Style | PHP > Wrapping and Braces > Binary Expressions > Align when multiline.

   
0

Thanks for your response!

This works as a "workaround" I suppose.

It also looks to me that there is an issue with "Continuation indent"? The multi-line alignment creates (potentially) more indentations than specified as continuation indent:

    return $this->isSomething() &&
$this->hasSomethingElse() &&
$this->isThisTrue();

This is using 8 spaces as indent.

With the setting "Align when multiline" it gets aligned to 7 spaces:

    return $this->isSomething() &&
$this->hasSomethingElse() &&
$this->isThisTrue();

But my expectation would be to get 4 spaces as defined as the continuation indent:

    return $this->isSomething() &&
$this->hasSomethingElse() &&
$this->isThisTrue();

 

Or do I misunderstand continuation indent? The sample in the settings does work for the sample code

 return
"string";

 

Thanks in any case!

0

Please sign in to leave a comment.