Skip to content

Commit d6762a7

Browse files
author
Vincent Langlet
committed
✨ Clean rules, add some and update doc
1 parent c4fe690 commit d6762a7

File tree

7 files changed

+47
-160
lines changed

7 files changed

+47
-160
lines changed

Symfony3Custom/Sniffs/WhiteSpace/CommaSpacingSniff.php

Lines changed: 0 additions & 57 deletions
This file was deleted.

Symfony3Custom/Tests/WhiteSpace/CommaSpacingUnitTest.inc

Lines changed: 0 additions & 6 deletions
This file was deleted.

Symfony3Custom/Tests/WhiteSpace/CommaSpacingUnitTest.inc.fixed

Lines changed: 0 additions & 6 deletions
This file was deleted.

Symfony3Custom/Tests/WhiteSpace/CommaSpacingUnitTest.php

Lines changed: 0 additions & 39 deletions
This file was deleted.

Symfony3Custom/ruleset.xml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,27 +35,19 @@
3535
<!-- *** OTHERS *** -->
3636
<!-- **************** -->
3737

38-
<!-- Complete with some of ZEND standard -->
39-
<rule ref="Generic.Functions.OpeningFunctionBraceBsdAllman">
40-
<exclude name="Generic.Functions.OpeningFunctionBraceBsdAllman.BraceOnSameLine"/>
41-
</rule>
38+
<!-- From djoos repo -->
4239
<rule ref="Generic.PHP.DisallowShortOpenTag"/>
43-
<rule ref="PEAR.Classes.ClassDeclaration"/>
44-
<rule ref="Squiz.Functions.GlobalFunction"/>
4540
<rule ref="Squiz.NamingConventions.ValidVariableName">
4641
<exclude name="Squiz.NamingConventions.ValidVariableName.PrivateNoUnderscore"/>
4742
<exclude name="Squiz.NamingConventions.ValidVariableName.ContainsNumbers"/>
4843
</rule>
49-
50-
<!-- Rules added by djoos/Symfony2-coding-standard-->
5144
<rule ref="Generic.Formatting.SpaceAfterCast"/>
52-
<rule ref="Generic.Functions.CallTimePassByReference"/>
5345
<rule ref="Squiz.Arrays.ArrayBracketSpacing"/>
5446
<rule ref="Squiz.PHP.LowercasePHPFunctions"/>
5547
<rule ref="Squiz.Scope.MemberVarScope"/>
5648
<rule ref="PEAR.Commenting.InlineComment"/>
5749

58-
<!-- Rules added by endouble/Symfony3Custom-coding-standard -->
50+
<!-- From endouble repo -->
5951
<rule ref="Squiz.Strings.ConcatenationSpacing">
6052
<properties>
6153
<property name="spacing" value="1"/>
@@ -66,10 +58,14 @@
6658
<severity>0</severity>
6759
</rule>
6860

69-
<!-- Rules added by VincentLanglet/Symfony3Custom-coding-standard -->
61+
<!-- Added by VincentLanglet repo -->
62+
<rule ref="Squiz.Classes.ClassFileName"/>
63+
<rule ref="Squiz.Strings.DoubleQuoteUsage"/>
64+
<rule ref="Squiz.WhiteSpace.FunctionOpeningBraceSpace"/>
7065
<rule ref="Squiz.WhiteSpace.OperatorSpacing">
7166
<properties>
7267
<property name="ignoreNewlines" value="true"/>
7368
</properties>
7469
</rule>
70+
<rule ref="Squiz.WhiteSpace.SemicolonSpacing"/>
7571
</ruleset>

docs/standards.md

Lines changed: 30 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -39,91 +39,84 @@ We mainly respect the [Symfony Standard](./symfony.md) but
3939
- Do not use `else`, `elseif`, `break` after `if` and `case` conditions which return or throw something
4040

4141
## Others
42-
### From Zend
43-
44-
- @TODO
42+
### Imported
43+
- Do not use `<?` to define a php file
4544

4645
```
47-
<rule ref="Generic.Functions.OpeningFunctionBraceBsdAllman">
48-
<exclude name="Generic.Functions.OpeningFunctionBraceBsdAllman.BraceOnSameLine"/>
49-
</rule>
46+
<rule ref="Generic.PHP.DisallowShortOpenTag"/>
5047
```
5148

52-
- @TODO
49+
- Add a single space after type casting
5350

5451
```
55-
<rule ref="Generic.PHP.DisallowShortOpenTag"/>
52+
<rule ref="Generic.Formatting.SpaceAfterCast"/>
5653
```
5754

58-
- @TODO
55+
- Use lowercase for PHP functions
5956

6057
```
61-
<rule ref="PEAR.Classes.ClassDeclaration"/>
58+
<rule ref="Squiz.PHP.LowercasePHPFunctions"/>
6259
```
6360

64-
- @TODO
61+
- Variable have scope modifier
6562

6663
```
67-
<rule ref="Squiz.Functions.GlobalFunction"/>
64+
<rule ref="Squiz.Scope.MemberVarScope"/>
65+
<rule ref="Symfony3Custom.Scope.MethodScope"/>
6866
```
6967

70-
- @TODO
68+
- No perl-style comments are used
7169

7270
```
73-
<rule ref="Squiz.NamingConventions.ValidVariableName">
74-
<exclude name="Squiz.NamingConventions.ValidVariableName.PrivateNoUnderscore"/>
75-
<exclude name="Squiz.NamingConventions.ValidVariableName.ContainsNumbers"/>
76-
</rule>
71+
<rule ref="PEAR.Commenting.InlineComment"/>
7772
```
7873

79-
### Others
80-
81-
- Add a single space after type casting
74+
- Use same name for a file and the class inside
8275

8376
```
84-
<rule ref="Generic.Formatting.SpaceAfterCast"/>
77+
<rule ref="Squiz.Classes.ClassFileName"/>
8578
```
8679

87-
- Add a single space around assignement operator
80+
- Use single quotes instead of double quotes
8881

8982
```
90-
<rule ref="Symfony3Custom.WhiteSpace.AssignementSpacing"/>
83+
<rule ref="Squiz.Strings.DoubleQuoteUsage"/>
9184
```
9285

93-
- Do not use spaces after `(` or `{` or before `)` or `}`
86+
- Do not skip blank line after function opening brace
9487

9588
```
96-
<rule ref="Symfony3Custom.WhiteSpace.CloseBracketSpacing"/>
97-
<rule ref="Symfony3Custom.WhiteSpace.OpenBracketSpacing"/>
89+
<rule ref="Squiz.WhiteSpace.FunctionOpeningBraceSpace"/>
9890
```
9991

100-
- Do not use multiple following blank lines
92+
- Do not use space before semicolon
10193

10294
```
103-
<rule ref="Symfony3Custom.WhiteSpace.EmptyLines"/>
95+
<rule ref="Squiz.WhiteSpace.SemicolonSpacing"/>
10496
```
10597

106-
- Do not call functions with variables passed by reference
98+
### Custom
99+
- Some others checks are made about array (`=>` alignments and indentation)
107100

108101
```
109-
<rule ref="Generic.Functions.CallTimePassByReference"/>
102+
<rule ref="Symfony3Custom.Array.ArrayDeclaration"/>
110103
```
111104

112-
- Use lowercase for PHP functions
105+
- Do not use spaces after `(` or `{` and before `)` or `}`
113106

114107
```
115-
<rule ref="Squiz.PHP.LowercasePHPFunctions"/>
108+
<rule ref="Symfony3Custom.WhiteSpace.CloseBracketSpacing"/>
109+
<rule ref="Symfony3Custom.WhiteSpace.OpenBracketSpacing"/>
116110
```
117111

118-
- Variable and methods have scope modifier
112+
- Do not use multiple following blank lines
119113

120114
```
121-
<rule ref="Squiz.Scope.MemberVarScope"/>
122-
<rule ref="Symfony3Custom.Scope.MethodScope"/>
115+
<rule ref="Symfony3Custom.WhiteSpace.EmptyLines"/>
123116
```
124117

125-
- No perl-style comments are used
118+
- Methods have scope modifier
126119

127120
```
128-
<rule ref="PEAR.Commenting.InlineComment"/>
121+
<rule ref="Symfony3Custom.Scope.MethodScope"/>
129122
```

docs/standards/symfony.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ From [symfony standard](http://symfony.com/doc/current/contributing/code/standar
55
- Add a single space after each comma delimiter
66

77
```
8-
<rule ref="Symfony3Custom.WhiteSpace.CommaSpacing" />
8+
<rule ref="Symfony3Custom.Array.ArrayDeclaration" />
99
```
1010

1111
- Add a single space around binary operators (`==`, `&&`, `...`)
1212

1313
```
14-
<rule ref="Symfony3Custom.WhiteSpace.BinaryOperatorSpacing" />
14+
<rule ref="Squiz.WhiteSpace.OperatorSpacing" />
1515
```
1616

1717
We do not respect the exception of the concatenation (`.`) operator
@@ -116,11 +116,17 @@ Not covered
116116

117117
- Use camelCase, not underscores, for variable, function and method names, arguments
118118

119-
Covered by `PSR2` and `Zend`
119+
Covered by `PSR2` completed by
120+
```
121+
<rule ref="Squiz.NamingConventions.ValidVariableName">
122+
<exclude name="Squiz.NamingConventions.ValidVariableName.PrivateNoUnderscore"/>
123+
<exclude name="Squiz.NamingConventions.ValidVariableName.ContainsNumbers"/>
124+
</rule>
125+
```
120126

121127
- Use namespaces for all classes
122128

123-
Covered by `PSR1`
129+
Covered by `PSR1` completed by
124130
```
125131
<rule ref="Squiz.Classes.ValidClassName" />
126132
```

0 commit comments

Comments
 (0)