PhpStorm“重新格式化代码”在使用换行符

时间:2016-03-10 13:47:01

标签: php phpstorm formatter

假设我有这行PHP代码:

if ($this->request->getModuleName() == 'abc' && $this->request->getControllerName() == 'test' && $this->request->getActionName() == 'test') {

然后我使用PhpStorms“重新格式化代码”功能重新格式化代码,它变为:

if ($this->request && $this->request->getModuleName(
    ) == 'abc' && $this->request->getControllerName(
    ) == 'test' && $this->request->getActionName() == 'test'
) {

但为什么在a之后(和a之前)添加新行?不应该更好地打破&&amp ;?像这样,它更易读:

if ($this->request && $this->request->getModuleName() == 'abc'
    && $this->request->getControllerName() == 'test' 
    && $this->request->getActionName() == 'test'
) {

我无法在PhpStorms设置中找到解决此问题的选项。最大行长度设置为120个字符。

1 个答案:

答案 0 :(得分:0)

检查你的phpstorm代码风格设置。这应该是有帮助的

相关问题