我试图将 phpcs 配置为在任何地方使用两个空格缩进而不是 4,但我被困在一个地方,我无法覆盖多行函数声明的规则
我的代码是
if (!function_exists('errorlog')) {
function errorlog(
Exception $e,
array $data = []
) {
}
虽然这段代码给了我错误
多行函数声明没有正确缩进;预计有 6 个空格,但找到了 4 个
我的自定义规则集
<?xml version="1.0"?>
<ruleset name="Amit">
<description>My Custom on top of PSR2</description>
<rule ref="PSR2">
<exclude name="PSR2.Classes.ClassDeclaration"/>
<exclude name="PSR2.ControlStructures.SwitchDeclaration"/>
<exclude name="PSR2.Methods.FunctionCallSignature"/>
</rule>
<rule ref="Generic.Arrays.ArrayIndent">
<properties>
<property name="indent" value="2"/>
</properties>
</rule>
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
<property name="indent" value="2"/>
</properties>
</rule>
<rule ref="PSR2.Classes.ClassDeclaration">
<properties>
<property name="indent" value="2"/>
</properties>
</rule>
<rule ref="PSR2.ControlStructures.SwitchDeclaration">
<properties>
<property name="indent" value="2"/>
</properties>
</rule>
<rule ref="PSR2.Methods.FunctionCallSignature">
<properties>
<property name="indent" value="2"/>
<property name="requiredSpacesAfterOpen" value="1"/>
<property name="requiredSpacesBeforeClose" value="1"/>
</properties>
</rule>
<rule ref="PEAR.ControlStructures.MultiLineCondition">
<properties>
<property name="indent" value="2"/>
</properties>
</rule>
<rule ref="PEAR.Formatting.MultiLineAssignment">
<properties>
<property name="indent" value="2"/>
</properties>
</rule>
<rule ref="PEAR.Functions.FunctionDeclaration">
<properties>
<property name="indent" value="2"/>
</properties>
</rule>
</ruleset>