Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP-Netbeans: How to change formatting for multi-conditional if statements

I have the following Code:

if(
    condition1
    && condition2
    && condition3
) {
    // do something
}

And after having netbeans reformat it i get

if(
    condition1 && condition2 && condition3
) {
    // do something
}

which is not what I want.

I already tried changing Editor>Formatting>PHP>Wrapping>If Statement - but I could not even figure out what this option does, but at least it seems not to solve my issue.

How can I make netbeans format multiconditonal ifs as I like them (or just leave them as they are)?

like image 590
Alex Avatar asked Nov 12 '22 07:11

Alex


1 Answers

Netbeans has changed the syntax slightly. You'll need to do a line break at the end of the AND operator instead of before and it will retain the breaks after a format.

if(
    condition1 &&
    condition2 &&
    condition3
) {
    // do something
}
like image 79
kovert Avatar answered Nov 25 '22 14:11

kovert