Skip to content

Commit 2a6d8be

Browse files
Merge pull request #8 from mauriciofauth/doctrine-cs
Use Doctrine CS as a base standard
2 parents c6121fa + 99810e4 commit 2a6d8be

File tree

2 files changed

+20
-68
lines changed

2 files changed

+20
-68
lines changed

PhpMyAdmin/ruleset.xml

Lines changed: 16 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,24 @@
11
<?xml version="1.0"?>
2-
<ruleset
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
name="phpMyAdmin"
5-
namespace="PhpMyAdmin"
6-
xsi:noNamespaceSchemaLocation="../vendor/squizlabs/php_codesniffer/phpcs.xsd"
7-
>
2+
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="phpMyAdmin coding standard" xsi:noNamespaceSchemaLocation="../vendor/squizlabs/php_codesniffer/phpcs.xsd">
83
<description>The phpMyAdmin coding standard.</description>
94

10-
<!-- The PSR-2 coding standard -->
11-
<rule ref="PSR2"/>
12-
13-
<!-- Short array syntax must be used to define arrays -->
14-
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
15-
<!-- Ensures that array are indented with 4 spaces -->
16-
<rule ref="Generic.Arrays.ArrayIndent"/>
17-
18-
<!-- Functions should not have a nesting level greater than 10, and should try to stay below 5 -->
19-
<rule ref="Generic.Metrics.NestingLevel"/>
20-
21-
<!-- Control Structures must have at least one statement inside of the body -->
22-
<rule ref="Generic.CodeAnalysis.EmptyStatement"/>
23-
24-
<!-- Ensures there is a single space after cast -->
25-
<rule ref="Generic.Formatting.SpaceAfterCast"/>
26-
<!-- Ensures there is a single space after a NOT operator -->
27-
<rule ref="Generic.Formatting.SpaceAfterNot"/>
28-
29-
<!-- Files, classes and functions must have a non-empty doc comment -->
30-
<rule ref="PEAR.Commenting.ClassComment">
31-
<exclude name="PEAR.Commenting.ClassComment.MissingCategoryTag"/>
32-
<exclude name="PEAR.Commenting.ClassComment.MissingAuthorTag"/>
33-
<exclude name="PEAR.Commenting.ClassComment.MissingLicenseTag"/>
34-
<exclude name="PEAR.Commenting.ClassComment.MissingLinkTag"/>
35-
</rule>
36-
<rule ref="PEAR.Commenting.FileComment">
37-
<exclude name="PEAR.Commenting.FileComment.MissingCategoryTag"/>
38-
<exclude name="PEAR.Commenting.FileComment.MissingAuthorTag"/>
39-
<exclude name="PEAR.Commenting.FileComment.MissingLicenseTag"/>
40-
<exclude name="PEAR.Commenting.FileComment.MissingLinkTag"/>
41-
<exclude name="PEAR.Commenting.FileComment.MissingVersion"/>
42-
</rule>
43-
<rule ref="PEAR.Commenting.FunctionComment"/>
44-
<!-- Checks that no Perl-style # comments are used -->
45-
<rule ref="PEAR.Commenting.InlineComment"/>
46-
47-
<!-- Ensure that there are no spaces around square brackets -->
48-
<rule ref="Squiz.Arrays.ArrayBracketSpacing"/>
49-
<!-- Ensures that arrays conform to the array coding standard -->
50-
<rule ref="Squiz.Arrays.ArrayDeclaration">
51-
<exclude name="Squiz.Arrays.ArrayDeclaration.DoubleArrowNotAligned"/>
52-
<exclude name="Squiz.Arrays.ArrayDeclaration.KeyNotAligned"/>
53-
<exclude name="Squiz.Arrays.ArrayDeclaration.MultiLineNotAllowed"/>
54-
<exclude name="Squiz.Arrays.ArrayDeclaration.CloseBraceNotAligned"/>
55-
<exclude name="Squiz.Arrays.ArrayDeclaration.ValueNotAligned"/>
56-
</rule>
57-
58-
<!-- Tests that the stars in a doc comment align correctly -->
59-
<rule ref="Squiz.Commenting.DocCommentAlignment"/>
60-
61-
<!-- Makes sure there is only one space before and after the concatenation operator -->
62-
<rule ref="Squiz.Strings.ConcatenationSpacing">
5+
<rule ref="Doctrine">
6+
<!-- Do not add a space before the return type colon -->
7+
<!-- See SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing -->
638
<properties>
64-
<property name="spacing" value="1"/>
65-
<property name="ignoreNewlines" value="true"/>
9+
<property name="spacesCountBeforeColon" value="0"/>
6610
</properties>
67-
</rule>
6811

69-
<!-- Variable names should be camelCased with the first letter lowercase. -->
70-
<rule ref="Squiz.NamingConventions.ValidVariableName">
71-
<!-- Checked by PSR2 -->
72-
<exclude name="Squiz.NamingConventions.ValidVariableName.PrivateNoUnderscore"/>
73-
<exclude name="Squiz.NamingConventions.ValidVariableName.PublicHasUnderscore"/>
74-
<type>warning</type>
12+
<!-- Do not require multiple assignment alignment -->
13+
<exclude name="Generic.Formatting.MultipleStatementAlignment"/>
14+
15+
<!-- Allow the 'global' keyword -->
16+
<exclude name="Squiz.PHP.GlobalKeyword"/>
17+
18+
<!-- Disable the superfluous class naming rules -->
19+
<exclude name="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming"/>
20+
<exclude name="SlevomatCodingStandard.Classes.SuperfluousExceptionNaming"/>
21+
<exclude name="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming"/>
22+
<exclude name="SlevomatCodingStandard.Classes.SuperfluousTraitNaming"/>
7523
</rule>
7624
</ruleset>

composer.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
},
1818
"require": {
1919
"php": "^7.1",
20+
"doctrine/coding-standard": "^6.0",
2021
"squizlabs/php_codesniffer": "^3.4.0"
22+
},
23+
"config": {
24+
"sort-packages": true
2125
}
2226
}

0 commit comments

Comments
 (0)