PHP-Netbeans:如何更改多条件if语句的格式 [英] PHP-Netbeans: How to change formatting for multi-conditional if statements

查看:103
本文介绍了PHP-Netbeans:如何更改多条件if语句的格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码:

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

在将netbeans重新格式化后,我得到了

And after having netbeans reformat it i get

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

这不是我想要的.

我已经尝试过更改Editor> Formatting> PHP> Wrapping> If语句-但我什至无法弄清楚此选项的作用,但至少似乎无法解决我的问题.

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.

如何根据自己的喜好使netbeans格式为多条件(或保持它们原样)?

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

推荐答案

Netbeans的语法略有更改.您需要在AND运算符的末尾而不是之前进行换行,并且它将在格式之后保留换行符.

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
}

这篇关于PHP-Netbeans:如何更改多条件if语句的格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆