|
| 1 | +<?xml version="1.0"?> |
| 2 | +<!-- This is a ruleset for https://github.com/squizlabs/PHP_CodeSniffer --> |
| 3 | +<!-- Usage: phpcs.phar \-\-standard=path/toruleset.xml path/to/file_or_folder.php (Can't have double hyphen in xml comment) --> |
| 4 | +<!-- phpcbf.phar can be used to automatically fix many issues --> |
| 5 | +<!-- Use this with PHP_CodeSniffer 3.3.0 or newer --> |
| 6 | +<!-- Source: https://github.com/phan/phan/blob/master/phpcs.xml --> |
| 7 | +<ruleset name="Custom Standard"> |
| 8 | + <description>Coding standard for Phan</description> |
| 9 | + <config name="installed_paths" value="../../slevomat/coding-standard"/> |
| 10 | + <rule ref="SlevomatCodingStandard.Classes.ModernClassNameReference" /> |
| 11 | + <rule ref="SlevomatCodingStandard.Commenting.EmptyComment" /> |
| 12 | + <!-- TODO: Enable |
| 13 | + <rule ref="SlevomatCodingStandard.ControlStructures.DisallowEmpty" /> |
| 14 | + --> |
| 15 | + <rule ref="SlevomatCodingStandard.Namespaces.UseDoesNotStartWithBackslash" /> |
| 16 | + <rule ref="SlevomatCodingStandard.Namespaces.UselessAlias" /> |
| 17 | + <rule ref="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses"> |
| 18 | + <properties> |
| 19 | + <property name="psr12Compatible" type="bool" value="true" /> |
| 20 | + </properties> |
| 21 | + </rule> |
| 22 | + <rule ref="SlevomatCodingStandard.Operators.RequireCombinedAssignmentOperator" /> |
| 23 | + <rule ref="SlevomatCodingStandard.PHP.TypeCast" /> |
| 24 | + <rule ref="SlevomatCodingStandard.PHP.UselessSemicolon" /> |
| 25 | + |
| 26 | + <rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes" > |
| 27 | + <properties> |
| 28 | + <property name="spacesCountAroundEqualsSign" type="bool" value="false" /> |
| 29 | + </properties> |
| 30 | + <exclude name="SlevomatCodingStandard.TypeHints.DeclareStrictTypes.IncorrectWhitespaceAfterDeclare" /> |
| 31 | + <exclude name="SlevomatCodingStandard.TypeHints.DeclareStrictTypes.IncorrectWhitespaceBetweenOpenTagAndDeclare" /> |
| 32 | + <exclude name="SlevomatCodingStandard.TypeHints.DeclareStrictTypes.IncorrectStrictTypesFormat" /> |
| 33 | + </rule> |
| 34 | + <rule ref="SlevomatCodingStandard.TypeHints.LongTypeHints" /> |
| 35 | + <!-- <rule ref="SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalFunctions" /> doesn't account for 'use function...' statements, don't use that --> |
| 36 | + <!-- TODO: Look into SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing once PSR-12 is back into review --> |
| 37 | + |
| 38 | + <!-- Look into SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingTraversableParameterTypeHintSpecification if it ever supports generic arrays+array shapes - Or just add this functionality to Phan's annotation plugin --> |
| 39 | + |
| 40 | + <rule ref="PSR1" /> |
| 41 | + <rule ref="PSR2"> |
| 42 | + <exclude name="Generic.Files.LineLength.TooLong" /> |
| 43 | + <!-- We put class initialization in the same file as methods --> |
| 44 | + <exclude name="PSR1.Files.SideEffects.FoundWithSymbols" /> |
| 45 | + <exclude name="PSR1.Classes.ClassDeclaration.MultipleClasses" /> |
| 46 | + </rule> |
| 47 | + |
| 48 | + <rule ref="PSR12" /> |
| 49 | + <!-- Arbitrary increase of the line length limit --> |
| 50 | + <rule ref="Generic.Files.LineLength"> |
| 51 | + <properties> |
| 52 | + <property name="lineLimit" value="150"/> |
| 53 | + <property name="absoluteLineLimit" value="200"/> |
| 54 | + </properties> |
| 55 | + </rule> |
| 56 | +</ruleset> |
0 commit comments