|
| 1 | +<?xml version="1.0"?> |
| 2 | +<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PHPCSDev" namespace="PHPCSStandards\PHPCSDev" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd"> |
| 3 | + |
| 4 | + <description>A PSR-2 based standard for use by sniff developers to check the code style of external PHPCS standards</description> |
| 5 | + |
| 6 | + <!-- |
| 7 | + #################################################################### |
| 8 | + PHP: Check PHP cross version compatibility. |
| 9 | + For optimal results, the custom project ruleset should set the testVersion |
| 10 | + config variable. |
| 11 | + For compatibility with the PHP version supported by PHP_CodeSniffer 3.0+, |
| 12 | + this would typically be set like: <config name="testVersion" value="5.4-"/>. |
| 13 | + #################################################################### |
| 14 | + --> |
| 15 | + <rule ref="PHPCompatibility"> |
| 16 | + <exclude name="PHPCompatibility.Constants.NewConstants.t_finallyFound"/> |
| 17 | + <exclude name="PHPCompatibility.Constants.NewConstants.t_yieldFound"/> |
| 18 | + <exclude name="PHPCompatibility.Constants.NewConstants.t_ellipsisFound"/> |
| 19 | + <exclude name="PHPCompatibility.Constants.NewConstants.t_powFound"/> |
| 20 | + <exclude name="PHPCompatibility.Constants.NewConstants.t_pow_equalFound"/> |
| 21 | + <exclude name="PHPCompatibility.Constants.NewConstants.t_spaceshipFound"/> |
| 22 | + <exclude name="PHPCompatibility.Constants.NewConstants.t_coalesceFound"/> |
| 23 | + <exclude name="PHPCompatibility.Constants.NewConstants.t_coalesce_equalFound"/> |
| 24 | + <exclude name="PHPCompatibility.Constants.NewConstants.t_yield_fromFound"/> |
| 25 | + </rule> |
| 26 | + |
| 27 | + |
| 28 | + <!-- |
| 29 | + #################################################################### |
| 30 | + Code style: Check style for compliance with PSR2. |
| 31 | + #################################################################### |
| 32 | + --> |
| 33 | + <rule ref="PSR2"/> |
| 34 | + |
| 35 | + |
| 36 | + <!-- |
| 37 | + #################################################################### |
| 38 | + Code style: Naming Conventions. |
| 39 | + #################################################################### |
| 40 | + --> |
| 41 | + |
| 42 | + <!-- Check that variable names are in camelCase. --> |
| 43 | + <rule ref="Squiz.NamingConventions.ValidVariableName"> |
| 44 | + <exclude name="Squiz.NamingConventions.ValidVariableName.PrivateNoUnderscore"/> |
| 45 | + </rule> |
| 46 | + |
| 47 | + <!-- Check that function and method names are in camelCase. --> |
| 48 | + <rule ref="Generic.NamingConventions.CamelCapsFunctionName"> |
| 49 | + <properties> |
| 50 | + <!-- Allow for two adjacent capital letters for acronyms. --> |
| 51 | + <property name="strict" value="false"/> |
| 52 | + </properties> |
| 53 | + </rule> |
| 54 | + |
| 55 | + |
| 56 | + <!-- |
| 57 | + #################################################################### |
| 58 | + Code style: Various other additions. |
| 59 | + #################################################################### |
| 60 | + --> |
| 61 | + |
| 62 | + <!-- PSR2 appears to ignore blank lines for superfluous whitespace and in several other places. Let's fix that. --> |
| 63 | + <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"> |
| 64 | + <properties> |
| 65 | + <property name="ignoreBlankLines" value="false"/> |
| 66 | + </properties> |
| 67 | + </rule> |
| 68 | + <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.StartFile"> |
| 69 | + <severity>5</severity> |
| 70 | + </rule> |
| 71 | + <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EndFile"> |
| 72 | + <severity>5</severity> |
| 73 | + </rule> |
| 74 | + <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines"> |
| 75 | + <severity>5</severity> |
| 76 | + </rule> |
| 77 | + |
| 78 | + <!-- Ensure exactly one blank line before each property declaration. --> |
| 79 | + <rule ref="Squiz.WhiteSpace.MemberVarSpacing"/> |
| 80 | + |
| 81 | + <!-- Ensure exactly one blank line before each function declaration, two blank lines |
| 82 | + before the first function and 0 after the last. --> |
| 83 | + <rule ref="Squiz.WhiteSpace.FunctionSpacing"> |
| 84 | + <properties> |
| 85 | + <property name="spacing" value="1"/> |
| 86 | + <property name="spacingBeforeFirst" value="1"/> |
| 87 | + <property name="spacingAfterLast" value="0"/> |
| 88 | + </properties> |
| 89 | + </rule> |
| 90 | + |
| 91 | + <rule ref="Generic.PHP.LowerCaseType"/> |
| 92 | + <rule ref="Generic.WhiteSpace.ArbitraryParenthesesSpacing"/> |
| 93 | + <rule ref="PSR12.Classes.ClassInstantiation"/> |
| 94 | + <rule ref="PSR12.Keywords.ShortFormTypeKeywords"/> |
| 95 | + <rule ref="PSR12.Operators.OperatorSpacing"/> |
| 96 | + |
| 97 | + <!-- Align the equal operator in assignment blocks. --> |
| 98 | + <rule ref="Generic.Formatting.MultipleStatementAlignment"> |
| 99 | + <properties> |
| 100 | + <property name="maxPadding" value="25"/> |
| 101 | + </properties> |
| 102 | + </rule> |
| 103 | + |
| 104 | + <rule ref="PEAR.Files.IncludingFile"/> |
| 105 | + <rule ref="PEAR.Files.IncludingFile.UseInclude"> |
| 106 | + <severity>0</severity> |
| 107 | + </rule> |
| 108 | + <rule ref="PEAR.Files.IncludingFile.UseIncludeOnce"> |
| 109 | + <severity>0</severity> |
| 110 | + </rule> |
| 111 | + |
| 112 | + |
| 113 | + <!-- |
| 114 | + #################################################################### |
| 115 | + Code style: Array declarations. |
| 116 | + #################################################################### |
| 117 | + --> |
| 118 | + |
| 119 | + <!-- Use normalized array indentation. --> |
| 120 | + <rule ref="Generic.Arrays.ArrayIndent"/> |
| 121 | + <rule ref="Squiz.Arrays.ArrayDeclaration"/> |
| 122 | + |
| 123 | + <!-- Ignoring the Squiz indentation rules as normalized arrays are preferred. --> |
| 124 | + <rule ref="Squiz.Arrays.ArrayDeclaration.KeyNotAligned"> |
| 125 | + <severity>0</severity> |
| 126 | + </rule> |
| 127 | + <rule ref="Squiz.Arrays.ArrayDeclaration.ValueNotAligned"> |
| 128 | + <severity>0</severity> |
| 129 | + </rule> |
| 130 | + <rule ref="Squiz.Arrays.ArrayDeclaration.CloseBraceNotAligned"> |
| 131 | + <severity>0</severity> |
| 132 | + </rule> |
| 133 | + |
| 134 | + <!-- Single and multi-line arrays are both allowed. --> |
| 135 | + <rule ref="Squiz.Arrays.ArrayDeclaration.SingleLineNotAllowed"> |
| 136 | + <severity>0</severity> |
| 137 | + </rule> |
| 138 | + <rule ref="Squiz.Arrays.ArrayDeclaration.MultiLineNotAllowed"> |
| 139 | + <severity>0</severity> |
| 140 | + </rule> |
| 141 | + |
| 142 | + |
| 143 | + <!-- |
| 144 | + #################################################################### |
| 145 | + Docs: Verify the documentation. |
| 146 | + #################################################################### |
| 147 | + --> |
| 148 | + |
| 149 | + <rule ref="Generic.Commenting.DocComment"> |
| 150 | + <!-- Having a @see or @internal tag before the @param tags is fine. --> |
| 151 | + <exclude name="Generic.Commenting.DocComment.ParamNotFirst"/> |
| 152 | + </rule> |
| 153 | + |
| 154 | + <rule ref="PEAR.Commenting"> |
| 155 | + <!-- Exclude PEAR specific tag requirements. --> |
| 156 | + <exclude name="PEAR.Commenting.FileComment.MissingVersion"/> |
| 157 | + <exclude name="PEAR.Commenting.FileComment.MissingAuthorTag"/> |
| 158 | + <exclude name="PEAR.Commenting.FileComment.MissingCategoryTag"/> |
| 159 | + <exclude name="PEAR.Commenting.FileComment.MissingLicenseTag"/> |
| 160 | + <exclude name="PEAR.Commenting.FileComment.MissingLinkTag"/> |
| 161 | + <exclude name="PEAR.Commenting.ClassComment.MissingAuthorTag"/> |
| 162 | + <exclude name="PEAR.Commenting.ClassComment.MissingCategoryTag"/> |
| 163 | + <exclude name="PEAR.Commenting.ClassComment.MissingLicenseTag"/> |
| 164 | + <exclude name="PEAR.Commenting.ClassComment.MissingLinkTag"/> |
| 165 | + <exclude name="PEAR.Commenting.ClassComment.MissingPackageTag"/> |
| 166 | + |
| 167 | + <!-- Having a @see or @internal tag before the @category tag is fine. --> |
| 168 | + <exclude name="PEAR.Commenting.ClassComment.CategoryTagOrder"/> |
| 169 | + </rule> |
| 170 | + |
| 171 | +</ruleset> |
0 commit comments