Skip to content

Commit 09d13e3

Browse files
committed
Switch to PHPCSDev as internal coding standard
1 parent 9fecccc commit 09d13e3

File tree

2 files changed

+8
-126
lines changed

2 files changed

+8
-126
lines changed

composer.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"ext-simplexml": "*"
4242
},
4343
"require-dev": {
44+
"phpcsstandards/phpcsdevcs": "^1.0",
4445
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0"
4546
},
4647
"replace": {
@@ -50,6 +51,11 @@
5051
"bin/phpcs",
5152
"bin/phpcbf"
5253
],
54+
"config": {
55+
"allow-plugins": {
56+
"dealerdirect/phpcodesniffer-composer-installer": true
57+
}
58+
},
5359
"scripts": {
5460
"cs": [
5561
"@php ./bin/phpcs"

phpcs.xml.dist

Lines changed: 2 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -17,130 +17,6 @@
1717
<arg name="parallel" value="75"/>
1818
<arg value="p"/>
1919

20-
<!-- Include the whole PEAR standard -->
21-
<rule ref="PEAR">
22-
<exclude name="PEAR.NamingConventions.ValidFunctionName"/>
23-
<exclude name="PEAR.NamingConventions.ValidVariableName"/>
24-
<exclude name="PEAR.Commenting.ClassComment"/>
25-
<exclude name="PEAR.Commenting.FileComment.MissingCategoryTag"/>
26-
<exclude name="PEAR.Commenting.FileComment.MissingPackageTag"/>
27-
<exclude name="PEAR.Commenting.FileComment.MissingLinkTag"/>
28-
<exclude name="PEAR.Commenting.FileComment.MissingVersion"/>
29-
<exclude name="PEAR.Commenting.InlineComment"/>
30-
<exclude name="Generic.Files.LineLength"/>
31-
</rule>
32-
33-
<!-- Include some sniffs from other standards that don't conflict with PEAR -->
34-
<rule ref="Squiz.Arrays.ArrayBracketSpacing"/>
35-
<rule ref="Squiz.Arrays.ArrayDeclaration"/>
36-
<rule ref="Squiz.Commenting.ClosingDeclarationComment"/>
37-
<rule ref="Squiz.ControlStructures.ControlSignature"/>
38-
<rule ref="Squiz.ControlStructures.ElseIfDeclaration"/>
39-
<rule ref="Squiz.Commenting.BlockComment"/>
40-
<rule ref="Squiz.Commenting.DocCommentAlignment"/>
41-
<rule ref="Squiz.Commenting.EmptyCatchComment"/>
42-
<rule ref="Squiz.Commenting.InlineComment"/>
43-
<rule ref="Squiz.Commenting.LongConditionClosingComment"/>
44-
<rule ref="Squiz.Commenting.PostStatementComment"/>
45-
<rule ref="Squiz.Commenting.VariableComment"/>
46-
<rule ref="Squiz.Formatting.OperatorBracket"/>
47-
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing"/>
48-
<rule ref="Squiz.Operators.ComparisonOperatorUsage"/>
49-
<rule ref="Squiz.PHP.DisallowInlineIf"/>
50-
<rule ref="Squiz.Scope.MethodScope"/>
51-
<rule ref="Squiz.Strings.ConcatenationSpacing"/>
52-
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing"/>
53-
<rule ref="Squiz.WhiteSpace.FunctionClosingBraceSpace"/>
54-
<rule ref="Squiz.WhiteSpace.FunctionSpacing"/>
55-
<rule ref="Squiz.WhiteSpace.MemberVarSpacing"/>
56-
<rule ref="Squiz.WhiteSpace.OperatorSpacing"/>
57-
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"/>
58-
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
59-
<rule ref="Generic.Commenting.Todo"/>
60-
<rule ref="Generic.ControlStructures.DisallowYodaConditions"/>
61-
<rule ref="Generic.ControlStructures.InlineControlStructure"/>
62-
<rule ref="Generic.Formatting.DisallowMultipleStatements"/>
63-
<rule ref="Generic.Formatting.SpaceAfterCast"/>
64-
<rule ref="Generic.NamingConventions.ConstructorName"/>
65-
<rule ref="Generic.PHP.DeprecatedFunctions"/>
66-
<rule ref="Generic.PHP.LowerCaseKeyword"/>
67-
<rule ref="Generic.Strings.UnnecessaryStringConcat"/>
68-
<rule ref="Generic.WhiteSpace.IncrementDecrementSpacing"/>
69-
<rule ref="PSR2.Classes.PropertyDeclaration"/>
70-
<rule ref="PSR2.Methods.MethodDeclaration"/>
71-
<rule ref="PSR2.Files.EndFileNewline"/>
72-
<rule ref="PSR12.Files.OpenTag"/>
73-
<rule ref="Zend.Files.ClosingTag"/>
74-
75-
<!-- We use custom indent rules for arrays -->
76-
<rule ref="Generic.Arrays.ArrayIndent"/>
77-
<rule ref="Squiz.Arrays.ArrayDeclaration.KeyNotAligned">
78-
<severity>0</severity>
79-
</rule>
80-
<rule ref="Squiz.Arrays.ArrayDeclaration.ValueNotAligned">
81-
<severity>0</severity>
82-
</rule>
83-
<rule ref="Squiz.Arrays.ArrayDeclaration.CloseBraceNotAligned">
84-
<severity>0</severity>
85-
</rule>
86-
<rule ref="Squiz.Arrays.ArrayDeclaration.CloseBraceNewLine">
87-
<severity>0</severity>
88-
</rule>
89-
90-
<!-- Check var names, but we don't want leading underscores for private vars -->
91-
<rule ref="Squiz.NamingConventions.ValidVariableName"/>
92-
<rule ref="Squiz.NamingConventions.ValidVariableName.PrivateNoUnderscore">
93-
<severity>0</severity>
94-
</rule>
95-
96-
<!-- Only one argument per line in multi-line function calls -->
97-
<rule ref="PEAR.Functions.FunctionCallSignature">
98-
<properties>
99-
<property name="allowMultipleArguments" value="false"/>
100-
</properties>
101-
</rule>
102-
103-
<!-- Have 12 chars padding maximum -->
104-
<rule ref="Generic.Formatting.MultipleStatementAlignment">
105-
<properties>
106-
<property name="maxPadding" value="12"/>
107-
</properties>
108-
</rule>
109-
110-
<!-- Ban some functions -->
111-
<rule ref="Generic.PHP.ForbiddenFunctions">
112-
<properties>
113-
<property name="forbiddenFunctions" type="array">
114-
<element key="sizeof" value="count"/>
115-
<element key="delete" value="unset"/>
116-
<element key="print" value="echo"/>
117-
<element key="is_null" value="null"/>
118-
<element key="create_function" value="null"/>
119-
</property>
120-
</properties>
121-
</rule>
122-
123-
<!-- Do not allow unreachable code. -->
124-
<rule ref="Squiz.PHP.NonExecutableCode"/>
125-
126-
<!-- The testing bootstrap file uses string concats to stop IDEs seeing the class aliases -->
127-
<rule ref="Generic.Strings.UnnecessaryStringConcat">
128-
<exclude-pattern>tests/bootstrap\.php</exclude-pattern>
129-
</rule>
130-
131-
<!-- This test file specifically *needs* Windows line endings for testing purposes. -->
132-
<rule ref="Generic.Files.LineEndings.InvalidEOLChar">
133-
<exclude-pattern>tests/Core/Tokenizer/StableCommentWhitespaceWinTest\.php</exclude-pattern>
134-
</rule>
135-
136-
<!-- Avoid false positive with this sniff detecting itself -->
137-
<rule ref="Generic.Commenting.Todo">
138-
<exclude-pattern>src/Standards/Generic/Sniffs/Commenting/TodoSniff\.php</exclude-pattern>
139-
<exclude-pattern>src/Standards/Generic/Tests/Commenting/TodoUnitTest\.php</exclude-pattern>
140-
</rule>
141-
142-
<!-- @see https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/122#discussion_r1414167897 -->
143-
<rule ref="Squiz.Commenting.VariableComment">
144-
<exclude-pattern>src/Util/Tokens\.php</exclude-pattern>
145-
</rule>
20+
<!-- https://github.com/PHPCSStandards/PHPCSDevCS -->
21+
<rule ref="PHPCSDev"/>
14622
</ruleset>

0 commit comments

Comments
 (0)