gpt4 book ai didi

WordPress 编码标准精度嗅探问题

转载 作者:行者123 更新时间:2023-12-05 08:08:29 25 4
gpt4 key购买 nike

更新到最新后wpcs版本我在我的文件中收到精确对齐警告。它正在发生在我类(class)的属性评论中。例如

<?php
/**
* FIle that holds the test class
*
* @since 1.0.0
* @package test
*/

namespace Namespace\Admin;

/**
* Test class
*
* @since 1.0.0
*/
class Test {
/**
* Global theme name
*
* @var string
*
* @since 1.0.0
*/
protected $theme_name;
}

我在我的规则集中使用 2 个空格代替 4 个空格,并使用空格代替制表符。

<!-- Tabs should represent 2 spaces. -->
<arg name="tab-width" value="2"/>

<!-- Set the default indent value and force spaces instead of tabs -->
<rule ref="WordPress">
<exclude name="Generic.WhiteSpace.DisallowSpaceIndent" />
</rule>
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
<property name="indent" value="2"/>
<property name="tabIndent" value="false"/>
</properties>
</rule>
<rule ref="Generic.WhiteSpace.DisallowTabIndent" />

<rule ref="PEAR.Functions.FunctionCallSignature">
<properties>
<property name="indent" value="2"/>
</properties>
</rule>

我尝试将 T_DOC_COMMENT_WHITESPACE 添加到 ignoreAlignmentTokens

  <!-- Precision alignment sniff -->
<rule ref="WordPress.WhiteSpace.PrecisionAlignment">
<properties>
<property name="ignoreAlignmentTokens" type="array" value="T_COMMENT,T_INLINE_HTML,T_DOC_COMMENT_WHITESPACE"/>
</properties>
</rule>

但我仍然收到关于我的文档 block 和我的属性上 2 个空格的精确对齐的警告。

这可以静音吗,还是我遗漏了什么?

最佳答案

我使用 phpstorm,它可以通过正确的设置处理它。

它带有 WordPress 编码标准的预设规则。

关于WordPress 编码标准精度嗅探问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48784182/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com