Align subsequent ternary operators in PhpStorm

Viewed 275

Is there a way in PhpStorm to align subsequent ternary operators so that the ? (question marks) and the : (colons) are under each other?

Expected output:

$foo = empty($var)         ? 'default_value'     : $var;
$bar = empty($another_var) ? 'default_value_two' : $another_var;

The only option I see in File->Settings->Editor->Code Style->PHP->Wrapping and Braces that is related to ternary operators (by the end) is about single line -and wrapping it- and not about having multiple aligned in relation to each other.


To give a bit of perspective, the option that's called Alignment statement->Align consecutive assignments (if checked) produces this result:

$foo          = 'some value';
$another_name = 'another_value';

So, is there a way to make PhpStorm align the ternary operators in such manner?

I'm using PhpStorm 2017.2.1

1 Answers
Related