Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我可以使用 if 语句,如:
if (!true) { return false }
或者是这样的:
if (! true) { return false }
根据 PSR示例,子句中的所有条件在if表达式之前或之后都没有空格。那么在你的情况下
if
if (!true) { return false; }
将是一个案例。请记住,对于短表达式,您始终可以使用三元运算符,如果要检查复杂的条件,请考虑将其放入变量中。