如何解决PHPCS 为 WordPress 重写函数语法
我正在为 WordPress 使用 phpcs,并想使用 Generic.Functions.OpeningFunctionBraceBsdAllman 编写函数,就像这样
private function create_templates( string $modelName,string $postType = '' )
{ <-- bracket on a next line with no spaces
然而 WordPress 不使用这种语法,嗅探器给了我这个错误 - Expected exactly one space between closing parenthesis and opening control structure; "\n" found.
。 WordPress.WhiteSpace.ControlStructureSpacing 禁用它,但它也禁用 if 语句等的相同语法。我想对函数应用这样的语法ONLY
我的 phpcs.xml 看起来像这样(仅限规则)
<!-- Best practices beyond core WordPress Coding Standards -->
<rule ref="WordPress-Extra">
<!-- Disable rules for filename -->
<exclude name="WordPress.Files.FileName"></exclude>
<!-- Open brace on a next line -->
<exclude name="Generic.Classes.OpeningBraceSameLine"></exclude>
<!-- Allow short array syntax -->
<exclude name="Generic.Arrays.DisallowShortArraySyntax"></exclude>
<!-- Function syntax -->
<exclude name="Generic.Functions.OpeningFunctionBraceKernighanRitchie"></exclude>
<!-- Allow varaibles to be named in camelCase -->
<exclude name="WordPress.NamingConventions.ValidVariableName"></exclude>
</rule>
<!-- WordPress Coding Standards for Inline Documentation and Comments -->
<rule ref="WordPress-Docs">
<exclude name="Squiz.Commenting.ClassComment"></exclude>
</rule>
我应该添加、删除或同时删除哪些规则?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。