PHP CodeSniffer 开始缩进

问题描述

我正在考虑将 PHPCS 设置为在构建时运行并报告任何问题。

我发现更具可读性的是基于开放 PHP 标记的开始缩进:

enter image description here

PHPCS 似乎确定我需要这样的东西:

enter image description here

我知道这可能是一个滑坡和高度偏见,但我非常希望配置此特定规则。

结果,我得到:

 2 | ERROR   | [ ] Missing file doc comment
 3 | ERROR   | [x] Line indented incorrectly; expected 0 spaces,found 4
 3 | ERROR   | [ ] Expected "if (...) {\n"; found "if (...)\n    {\n"
 3 | WARNING | [ ] Line exceeds 85 characters; contains 94 characters
 3 | ERROR   | [x] There must be a single space between the closing parenthesis and the opening brace of a multi-line IF statement; found newline
 5 | ERROR   | [x] File is being conditionally included; use "include" instead
 5 | WARNING | [ ] Line exceeds 85 characters; contains 89 characters
 6 | ERROR   | [x] Line indented incorrectly; expected 0 spaces,found 4

我对这个错误特别感兴趣:

 3 | ERROR   | [x] Line indented incorrectly; expected 0 spaces,found 4

到目前为止,我已经确定这个错误来自:

/usr/share/PHP/PHP/CodeSniffer/src/Standards/Generic/Sniffs/WhiteSpace/ScopeIndentSniff.PHP#955

有没有办法做到这一点?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)