coding-style - 当参数拆分为多行时,阻止 PhpStorm 在函数声明后添加新行

标签 coding-style phpstorm

在我的 PhpStorm 8.0.3 代码样式中,我已将其设置为在函数声明后添加新行,效果很好。

问题是现在我在遵循 PSR-2 Standards 的新项目中,这表示函数的左大括号必须与函数参数的右括号放在同一行,当这些函数参数拆分为多行时,如您所见 here .

当参数分成多行时,我想要这个......

public function myMethod(
    MyClass $arg1,
    $arg2 = null
) {
    // method body
}

......当他们都在同一条线上时......
public function myMethod(MyClass $arg1, $arg2 = null)
{
    // method body
}

我试图搜索该选项,但找不到 - 我知道我可以决定是否要为 添加新行全部 功能,但我只在这些特殊场合需要它。

最佳答案

作为@marekful 答案的补充。为了更清楚,这些是实现我想要的目标所需的 2 个设置:

enter image description here

关于coding-style - 当参数拆分为多行时,阻止 PhpStorm 在函数声明后添加新行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29805484/

相关文章:

logging - 哪个最好 : First Log then do the Operation OR First do the Operation then Log it?

coding-style - MISRA 中评论规则的基本原理

c++ - 删除的默认构造函数应该是公共(public)的还是私有(private)的?

javascript - 如何在 PhpStorm 的 js 源代码中禁用 html 检查器?

php - 在类中找不到方法

python - if __name__ == '__main__' 的风格指南是什么?

C# 命名空间/文件夹 : when is getting too organized/creating too many namespaces not right?

php - Php (PhpStorm) 中是否有像我们在 Java (Intellij IDEA) 中那样的国际化功能

doctrine - 无法在 Adob​​e Commerce (Magento 2) 中执行 PHPUnit 测试

intellij-idea - 在PhpStorm项目工具窗口中显示.idea文件夹