-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfp-ruleset.xml
More file actions
123 lines (93 loc) · 3.78 KB
/
fp-ruleset.xml
File metadata and controls
123 lines (93 loc) · 3.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?xml version="1.0"?>
<ruleset name="PHP Standard">
<description>custom coding standard</description>
<!-- tab 缩进 -->
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent"/>
<!-- UNIX 换行 -->
<rule ref="Generic.Files.LineEndings">
<properties>
<property name="eolChar" value="\n"/>
</properties>
</rule>
<!-- 每行不超过 100 个字符
<rule ref="Generic.Files.LineLength">
<properties>
<property phpcs-only="true" name="lineLimit" value="100"/>
<property phpcbf-only="true" name="lineLimit" value="100"/>
</properties>
</rule>
-->
<!-- 类名必须开头大写 -->
<rule ref="Squiz.Classes.ValidClassName"/>
<!-- class 类名 括号{ 必须在同一行 -->
<rule ref="FunPlus.Classes.OpeningClassBraceKernighanRitchie"/>
<!-- 所有常量大写 -->
<rule ref="Generic.PHP.UpperCaseConstant"/>
<rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
<!-- 方法名用骆驼 -->
<rule ref="Generic.NamingConventions.CamelCapsFunctionName"/>
<!-- 行尾禁止多余 -->
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
<properties>
<property name="ignoreBlankLines" value="true"/>
</properties>
</rule>
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.StartFile">
<severity>0</severity>
</rule>
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EndFile">
<severity>0</severity>
</rule>
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines">
<severity>0</severity>
</rule>
<!-- 文件尾空行 -->
<rule ref="Generic.Files.EndFileNewline"/>
<!-- 数组必须用 [] 而不能用 array() -->
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
<!-- 函数如果没有参数,() 里不应该有空格 -->
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing">
<properties>
<property name="equalsSpacing" value="1"/>
</properties>
</rule>
<!-- 运算符两侧要有空格 -->
<rule ref="Squiz.WhiteSpace.OperatorSpacing"/>
<!-- 显式声明成员修饰符 -->
<rule ref="Squiz.Scope.MemberVarScope"/>
<rule ref="Squiz.Scope.MethodScope"/>
<rule ref="Squiz.WhiteSpace.ScopeKeywordSpacing"/>
<!-- 类型转换(开头有 (string) 之类的)里面和后面不能有空格 -->
<rule ref="Generic.Formatting.NoSpaceAfterCast"/>
<rule ref="Squiz.WhiteSpace.CastSpacing"/>
<!-- 结尾分号前不能有空格 -->
<rule ref="Squiz.WhiteSpace.SemicolonSpacing"/>
<!-- 方法调用(->)不能有空格 -->
<rule ref="Squiz.WhiteSpace.ObjectOperatorSpacing"/>
<!-- new 不能有太多空格,echo 之后必须有空格 -->
<rule ref="Squiz.WhiteSpace.LanguageConstructSpacing"/>
<!-- 禁用 global -->
<rule ref="Squiz.PHP.GlobalKeyword"/>
<!-- 内置函数全部小写 -->
<rule ref="Squiz.PHP.LowercasePHPFunctions"/>
<!-- 禁止一行多个分号的给多个值赋值 -->
<rule ref="Generic.Formatting.DisallowMultipleStatements"/>
<!-- if 等结构必须有花括号,且不得写成一行 -->
<rule ref="Generic.ControlStructures.InlineControlStructure"/>
<!-- 右花括号 } 必须单起一行 -->
<rule ref="Squiz.WhiteSpace.ScopeClosingBrace"/>
<!-- 提示函数有没用到的参数 -->
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter"/>
<!-- 方法名相关(static 最后,final 最前,抽象类必须可见,不可见的必须下划线前缀) -->
<rule ref="PSR2.Methods.MethodDeclaration"/>
<!-- 多余的 final 关键字 -->
<rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/>
<!-- 多余的 ?> -->
<rule ref="Zend.Files.ClosingTag"/>
<!-- 花括号在行尾而不是新起一行 -->
<rule ref="Generic.Functions.OpeningFunctionBraceKernighanRitchie"/>
<!-- 空格检查(if while for foreach do 等) -->
<rule ref="PEAR.ControlStructures.ControlSignature"/>
<!-- 参数默认值必须放最后 -->
<rule ref="PEAR.Functions.ValidDefaultValue"/>
</ruleset>