Skip to content

Commit ac051a8

Browse files
committed
Add PSR12 sniffs.
1 parent eef7031 commit ac051a8

File tree

4 files changed

+22
-54
lines changed

4 files changed

+22
-54
lines changed

PSR2R/Sniffs/ControlStructures/ControlStructureSpacingSniff.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ public function process(File $phpcsFile, $stackPtr) {
102102
}
103103

104104
$phpcsFile->recordMetric($stackPtr, 'Spaces before control structure close parenthesis', (string)$spaceBeforeClose);
105+
$x = (bool)$phpcsFile;
105106

106107
if ($spaceBeforeClose !== $this->requiredSpacesBeforeClose) {
107108
$error = 'Expected %s spaces before closing bracket; %s found';

PSR2R/Sniffs/WhiteSpace/CastSpacingSniff.php

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

PSR2R/ruleset.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838

3939
<rule ref="Generic.Formatting.DisallowMultipleStatements"/>
4040

41+
<rule ref="Generic.Formatting.NoSpaceAfterCast"/>
42+
4143
<rule ref="Squiz.Functions.FunctionDeclaration"/>
4244
<rule ref="PEAR.Functions.ValidDefaultValue"/>
4345

@@ -51,6 +53,11 @@
5153

5254
<rule ref="PSR2.ControlStructures.ElseIfDeclaration"/>
5355

56+
<rule ref="PSR12.Classes.ClassInstantiation"/>
57+
<rule ref="PSR12.Keywords.ShortFormTypeKeywords"/>
58+
<rule ref="PSR12.Namespaces.CompoundNamespaceDepth"/>
59+
<rule ref="PSR12.Operators.OperatorSpacing"/>
60+
5461
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing">
5562
<properties>
5663
<property name="equalsSpacing" value="1"/>
@@ -87,6 +94,7 @@
8794
<rule ref="Squiz.Scope.StaticThisUsage"/>
8895

8996
<rule ref="Squiz.WhiteSpace.CastSpacing"/>
97+
<rule ref="Squiz.WhiteSpace.LanguageConstructSpacing"/>
9098
<rule ref="Squiz.WhiteSpace.LogicalOperatorSpacing"/>
9199
<rule ref="Squiz.WhiteSpace.MemberVarSpacing"/>
92100
<rule ref="Squiz.WhiteSpace.SemicolonSpacing"/>

docs/sniffs.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# PSR2R Code Sniffer
22

33

4-
The PSR2R standard contains 103 sniffs
4+
The PSR2R standard contains 108 sniffs
55

6-
Generic (13 sniffs)
6+
Generic (14 sniffs)
77
-------------------
88
- Generic.Arrays.DisallowLongArraySyntax
99
- Generic.CodeAnalysis.ForLoopShouldBeWhileLoop
@@ -14,6 +14,7 @@ Generic (13 sniffs)
1414
- Generic.ControlStructures.InlineControlStructure
1515
- Generic.Files.LineEndings
1616
- Generic.Formatting.DisallowMultipleStatements
17+
- Generic.Formatting.NoSpaceAfterCast
1718
- Generic.PHP.DeprecatedFunctions
1819
- Generic.PHP.ForbiddenFunctions
1920
- Generic.PHP.LowerCaseConstant
@@ -25,13 +26,20 @@ PEAR (3 sniffs)
2526
- PEAR.Functions.ValidDefaultValue
2627
- PEAR.NamingConventions.ValidClassName
2728

29+
PSR12 (4 sniffs)
30+
----------------
31+
- PSR12.Classes.ClassInstantiation
32+
- PSR12.Keywords.ShortFormTypeKeywords
33+
- PSR12.Namespaces.CompoundNamespaceDepth
34+
- PSR12.Operators.OperatorSpacing
35+
2836
PSR2 (3 sniffs)
2937
---------------
3038
- PSR2.ControlStructures.ElseIfDeclaration
3139
- PSR2.Namespaces.NamespaceDeclaration
3240
- PSR2.Namespaces.UseDeclaration
3341

34-
PSR2R (66 sniffs)
42+
PSR2R (65 sniffs)
3543
-----------------
3644
- PSR2R.Classes.BraceOnSameLine
3745
- PSR2R.Classes.ClassCreateInstance
@@ -86,7 +94,6 @@ PSR2R (66 sniffs)
8694
- PSR2R.PHP.ShortCast
8795
- PSR2R.PHP.SingleQuote
8896
- PSR2R.WhiteSpace.ArraySpacing
89-
- PSR2R.WhiteSpace.CastSpacing
9097
- PSR2R.WhiteSpace.CommaSpacing
9198
- PSR2R.WhiteSpace.ConcatenationSpacing
9299
- PSR2R.WhiteSpace.DocBlockAlignment
@@ -100,7 +107,7 @@ PSR2R (66 sniffs)
100107
- PSR2R.WhiteSpace.TabIndent
101108
- PSR2R.WhiteSpace.UnaryOperatorSpacing
102109

103-
Squiz (17 sniffs)
110+
Squiz (18 sniffs)
104111
-----------------
105112
- Squiz.Arrays.ArrayBracketSpacing
106113
- Squiz.Classes.LowercaseClassKeywords
@@ -115,6 +122,7 @@ Squiz (17 sniffs)
115122
- Squiz.Scope.MethodScope
116123
- Squiz.Scope.StaticThisUsage
117124
- Squiz.WhiteSpace.CastSpacing
125+
- Squiz.WhiteSpace.LanguageConstructSpacing
118126
- Squiz.WhiteSpace.LogicalOperatorSpacing
119127
- Squiz.WhiteSpace.MemberVarSpacing
120128
- Squiz.WhiteSpace.SemicolonSpacing

0 commit comments

Comments
 (0)