|
| 1 | +<?xml version="1.0"?> |
| 2 | +<ruleset> |
| 3 | + <arg name="basepath" value="."/> |
| 4 | + <arg name="extensions" value="php"/> |
| 5 | + <arg name="parallel" value="80"/> |
| 6 | + <arg name="cache" value=".phpcs-cache"/> |
| 7 | + <arg name="colors" /> |
| 8 | + |
| 9 | + <!-- Ignore warnings, show progress of the run, and show sniff names --> |
| 10 | + <arg value="nps"/> |
| 11 | + |
| 12 | + <autoload>.phpcs/autoload.php</autoload> |
| 13 | + |
| 14 | + <file>.phpcs</file> |
| 15 | + <file>src</file> |
| 16 | + <file>tests</file> |
| 17 | + |
| 18 | + <rule ref="Doctrine"> |
| 19 | + <!-- Exclude sniffs that require newer PHP versions --> |
| 20 | + <!-- Available with PHP 7.0 --> |
| 21 | + <exclude name="SlevomatCodingStandard.TypeHints.DeclareStrictTypes" /> |
| 22 | + <!-- In addition to requiring PHP 7.0, this sniff will cause a significant amount of BC breaks. Proceed with caution! --> |
| 23 | + <exclude name="SlevomatCodingStandard.TypeHints.TypeHintDeclaration" /> |
| 24 | + <exclude name="SlevomatCodingStandard.Exceptions.ReferenceThrowableOnly" /> |
| 25 | + <exclude name="SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator" /> |
| 26 | + |
| 27 | + <!-- Available with PHP 7.1 --> |
| 28 | + <exclude name="SlevomatCodingStandard.Classes.ClassConstantVisibility" /> |
| 29 | + <exclude name="SlevomatCodingStandard.PHP.ShortList.LongListUsed" /> |
| 30 | + <exclude name="SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue" /> |
| 31 | + |
| 32 | + <!-- No statement alignment so far --> |
| 33 | + <exclude name="Generic.Formatting.MultipleStatementAlignment" /> |
| 34 | + |
| 35 | + <!-- Class naming sniffs are excluded to preserve BC --> |
| 36 | + <exclude name="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming" /> |
| 37 | + <exclude name="SlevomatCodingStandard.Classes.SuperfluousExceptionNaming" /> |
| 38 | + <exclude name="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming" /> |
| 39 | + <exclude name="SlevomatCodingStandard.Classes.SuperfluousTraitNaming" /> |
| 40 | + |
| 41 | + <!-- Forbid useless annotations - Git and LICENCE file provide more accurate information --> |
| 42 | + <!-- Disable forbidden annotation sniff as excluding @api from the list doesn't work --> |
| 43 | + <exclude name="SlevomatCodingStandard.Commenting.ForbiddenAnnotations.AnnotationForbidden" /> |
| 44 | + |
| 45 | + <!-- Keep long typehints (for now) --> |
| 46 | + <exclude name="SlevomatCodingStandard.PHP.TypeCast.InvalidCastUsed" /> |
| 47 | + <exclude name="SlevomatCodingStandard.TypeHints.LongTypeHints" /> |
| 48 | + |
| 49 | + <!-- Don't require a full stop after @throws tags --> |
| 50 | + <exclude name="Squiz.Commenting.FunctionComment.ThrowsNoFullStop" /> |
| 51 | + |
| 52 | + <!-- Disable some sniffs as they can cause functional changes. These will be enabled later --> |
| 53 | + <exclude name="Generic.PHP.ForbiddenFunctions.FoundWithAlternative" /> |
| 54 | + <exclude name="SlevomatCodingStandard.Classes.UnusedPrivateElements" /> |
| 55 | + <exclude name="SlevomatCodingStandard.ControlStructures.DisallowYodaComparison" /> |
| 56 | + <exclude name="SlevomatCodingStandard.ControlStructures.EarlyExit" /> |
| 57 | + <exclude name="SlevomatCodingStandard.ControlStructures.UselessIfConditionWithReturn" /> |
| 58 | + <exclude name="SlevomatCodingStandard.Functions.StaticClosure" /> |
| 59 | + <exclude name="SlevomatCodingStandard.Functions.UnusedInheritedVariablePassedToClosure" /> |
| 60 | + <exclude name="SlevomatCodingStandard.Operators.DisallowEqualOperators" /> |
| 61 | + |
| 62 | + <!-- These sniffs cause a large diff, so enable them in separate steps --> |
| 63 | + <exclude name="SlevomatCodingStandard.Commenting.DocCommentSpacing.IncorrectAnnotationsGroup" /> |
| 64 | + <exclude name="SlevomatCodingStandard.Commenting.RequireOneLinePropertyDocComment" /> |
| 65 | + <exclude name="Squiz.Strings.DoubleQuoteUsage" /> |
| 66 | + |
| 67 | + <!-- Sniff currently breaks, see https://github.com/slevomat/coding-standard/issues/727 --> |
| 68 | + <exclude name="SlevomatCodingStandard.Namespaces.NamespaceSpacing" /> |
| 69 | + </rule> |
| 70 | + |
| 71 | + <!-- Change use statement sorting to be compatible with PSR-12 --> |
| 72 | + <rule ref="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses"> |
| 73 | + <properties> |
| 74 | + <property name="psr12Compatible" value="true"/> |
| 75 | + </properties> |
| 76 | + </rule> |
| 77 | + |
| 78 | + <!-- Forbid fully qualified names even for colliding names --> |
| 79 | + <rule ref="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly"> |
| 80 | + <properties> |
| 81 | + <property name="allowFallbackGlobalConstants" value="false"/> |
| 82 | + <property name="allowFallbackGlobalFunctions" value="false"/> |
| 83 | + <property name="allowFullyQualifiedGlobalClasses" value="false"/> |
| 84 | + <property name="allowFullyQualifiedGlobalConstants" value="false"/> |
| 85 | + <property name="allowFullyQualifiedGlobalFunctions" value="false"/> |
| 86 | + <property phpcs-only="true" name="allowFullyQualifiedNameForCollidingClasses" value="false"/> |
| 87 | + <property phpcs-only="true" name="allowFullyQualifiedNameForCollidingConstants" value="false"/> |
| 88 | + <property phpcs-only="true" name="allowFullyQualifiedNameForCollidingFunctions" value="false"/> |
| 89 | + <property name="searchAnnotations" value="true"/> |
| 90 | + </properties> |
| 91 | + </rule> |
| 92 | + |
| 93 | + <rule ref="PSR1.Methods.CamelCapsMethodName.NotCamelCaps"> |
| 94 | + <exclude-pattern>/src/GridFS/StreamWrapper</exclude-pattern> |
| 95 | + <exclude-pattern>/tests/DocumentationExamplesTest.php</exclude-pattern> |
| 96 | + </rule> |
| 97 | + |
| 98 | + <rule ref="PSR1.Classes.ClassDeclaration.MultipleClasses"> |
| 99 | + <exclude-pattern>/tests/Compat/PolyfillAssertTrait.php</exclude-pattern> |
| 100 | + </rule> |
| 101 | +</ruleset> |
0 commit comments