douxian5076 2014-06-12 04:04
浏览 53
已采纳

覆盖PHP CodeSniffer中的规则集

I am trying to override a rule in PHP CodeSniffer as follows:

<rule ref="Squiz.WhiteSpace.FunctionSpacing.Before">
    <properties>
        <property name="spacing" value="1"/>
    </properties>
</rule>

However, the overridden value of 1 is not being recognised at all, and it is still defaulting to 2.

  • 写回答

1条回答 默认 最新

  • dongxia9620 2014-06-12 14:52
    关注

    The rule ref you have in that sample code is for a specific message rather than the sniff itself. The 4-part message code is used to do things like override the message itself, mute the message, or change its severity. The sniff code is the 3-part code used for properties.

    So in this case, you just need to do this:

    <rule ref="Squiz.WhiteSpace.FunctionSpacing">
        <properties>
            <property name="spacing" value="1"/>
        </properties>
    </rule>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部