|
| 1 | +<?xml version="1.0"?> |
| 2 | +<ruleset name="Proton"> |
| 3 | + <description> |
| 4 | + Proton PHP Coding Standard |
| 5 | + </description> |
| 6 | + |
| 7 | + <rule ref="PSR2" /> |
| 8 | + <rule ref="PSR2.Namespaces.UseDeclaration"> |
| 9 | + <!-- Allows compound namespaces --> |
| 10 | + <exclude-pattern>*</exclude-pattern> |
| 11 | + </rule> |
| 12 | + <rule ref="PSR12.Namespaces.CompoundNamespaceDepth"/> |
| 13 | + |
| 14 | + <rule ref="Generic.Commenting.Todo"/> |
| 15 | + <rule ref="Generic.PHP.LowerCaseKeyword"/> |
| 16 | + <rule ref="Generic.PHP.DeprecatedFunctions"/> |
| 17 | + <rule ref="Generic.Formatting.SpaceAfterCast"/> |
| 18 | + <rule ref="Generic.Arrays.DisallowLongArraySyntax"/> |
| 19 | + <rule ref="Generic.CodeAnalysis.UnusedFunctionParameter"/> |
| 20 | + <rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/> |
| 21 | + <rule ref="Generic.CodeAnalysis.UnconditionalIfStatement"/> |
| 22 | + |
| 23 | + <!-- All PHP files MUST use the Unix LF (linefeed) line ending only. --> |
| 24 | + <rule ref="Generic.Files.LineEndings"> |
| 25 | + <properties> |
| 26 | + <property name="eolChar" value="\n"/> |
| 27 | + </properties> |
| 28 | + </rule> |
| 29 | + |
| 30 | + <!-- Ban some functions --> |
| 31 | + <rule ref="Generic.PHP.ForbiddenFunctions"> |
| 32 | + <properties> |
| 33 | + <property name="forbiddenFunctions" type="array"> |
| 34 | + <element key="sizeof" value="count"/> |
| 35 | + <element key="delete" value="unset"/> |
| 36 | + <element key="print" value="echo"/> |
| 37 | + <element key="phpinfo" value="null"/> |
| 38 | + <element key="create_function" value="null"/> |
| 39 | + |
| 40 | + <!-- Use `::class` keyword --> |
| 41 | + <element key="get_called_class" value="`static::class`"/> |
| 42 | + <element key="__CLASS__" value="`self::class`"/> |
| 43 | + |
| 44 | + <!-- Use casting instead of functions --> |
| 45 | + <element key="strval" value="(string)"/> |
| 46 | + <element key="intval" value="(int)"/> |
| 47 | + <element key="boolval" value="(bool)"/> |
| 48 | + </property> |
| 49 | + </properties> |
| 50 | + </rule> |
| 51 | + |
| 52 | + <rule ref="Generic.Files.LineLength"> |
| 53 | + <properties> |
| 54 | + <property name="lineLimit" value="120"/> |
| 55 | + <property name="absoluteLineLimit" value="0"/> |
| 56 | + </properties> |
| 57 | + </rule> |
| 58 | + |
| 59 | + <rule ref="Generic.Metrics.NestingLevel"> |
| 60 | + <properties> |
| 61 | + <property name="nestingLevel" value="5" /> |
| 62 | + <property name="absoluteNestingLevel" value="11" /> |
| 63 | + </properties> |
| 64 | + </rule> |
| 65 | + |
| 66 | + <rule ref="Squiz.PHP.NonExecutableCode"/> |
| 67 | + <rule ref="Squiz.PHP.LowercasePHPFunctions"/> |
| 68 | + |
| 69 | + <!-- <rule ref="Squiz.Strings.ConcatenationSpacing"> |
| 70 | + <properties> |
| 71 | + <property name="spacing" value="1" /> |
| 72 | + <property name="ignoreNewlines" value="true" /> |
| 73 | + </properties> |
| 74 | + </rule> --> |
| 75 | + |
| 76 | + <!-- # Slevomat Coding Standard --> |
| 77 | + <!-- https://github.com/slevomat/coding-standard --> |
| 78 | + <config name="installed_paths" value="../../slevomat/coding-standard"/> |
| 79 | + |
| 80 | + <rule ref="SlevomatCodingStandard.Classes.UselessLateStaticBinding"/> |
| 81 | + <rule ref="SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator"/> |
| 82 | + <rule ref="SlevomatCodingStandard.Classes.UnusedPrivateElements"/> |
| 83 | + <rule ref="SlevomatCodingStandard.Functions.UnusedInheritedVariablePassedToClosure"/> |
| 84 | + <rule ref="SlevomatCodingStandard.Functions.UselessParameterDefaultValue"/> |
| 85 | + <rule ref="SlevomatCodingStandard.PHP.UselessSemicolon"/> |
| 86 | + <rule ref="SlevomatCodingStandard.Variables.DuplicateAssignmentToVariable"/> |
| 87 | + <rule ref="SlevomatCodingStandard.Variables.UselessVariable"/> |
| 88 | + <rule ref="SlevomatCodingStandard.Exceptions.DeadCatch"/> |
| 89 | + <rule ref="SlevomatCodingStandard.Classes.ModernClassNameReference"/> |
| 90 | + <rule ref="SlevomatCodingStandard.Namespaces.NamespaceDeclaration"/> |
| 91 | + <rule ref="SlevomatCodingStandard.Namespaces.NamespaceSpacing"/> |
| 92 | + <rule ref="SlevomatCodingStandard.TypeHints.LongTypeHints"/> |
| 93 | + <rule ref="SlevomatCodingStandard.PHP.ShortList"/> |
| 94 | + <rule ref="SlevomatCodingStandard.PHP.TypeCast"/> |
| 95 | + <rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing"/> |
| 96 | + <rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHintSpacing"/> |
| 97 | + <rule ref="SlevomatCodingStandard.Namespaces.UseDoesNotStartWithBackslash"/> |
| 98 | + <rule ref="SlevomatCodingStandard.Types.EmptyLinesAroundTypeBraces"> |
| 99 | + <properties> |
| 100 | + <property name="linesCountAfterOpeningBrace" value="0" /> |
| 101 | + <property name="linesCountBeforeClosingBrace" value="0" /> |
| 102 | + </properties> |
| 103 | + </rule> |
| 104 | + <rule ref="SlevomatCodingStandard.Commenting.ForbiddenComments"/> |
| 105 | + <rule ref="SlevomatCodingStandard.Commenting.InlineDocCommentDeclaration"/> |
| 106 | + <rule ref="SlevomatCodingStandard.ControlStructures.UselessConditionWithReturn"/> |
| 107 | + |
| 108 | + <!--<rule ref="SlevomatCodingStandard.Operators.RequireCombinedAssignmentOperator"/>--> |
| 109 | + <!--<rule ref="SlevomatCodingStandard.Namespaces.FullyQualifiedClassNameInAnnotation"/>--> |
| 110 | + <!--<rule ref="SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue"/>--> |
| 111 | + <!--<rule ref="SlevomatCodingStandard.Namespaces.UseFromSameNamespace"/>--> |
| 112 | + <!--<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses"/>--> |
| 113 | + <!--<rule ref="SlevomatCodingStandard.Functions.UnusedParameter"/>--> |
| 114 | + <!--<rule ref="SlevomatCodingStandard.ControlStructures.DisallowContinueWithoutIntegerOperandInSwitch"/>--> |
| 115 | + |
| 116 | + <!-- |
| 117 | + If you want to completely disable an error message in a sniff |
| 118 | + but you don't want to exclude the whole sniff, you can |
| 119 | + change the severity of the message to 0. In this case, we |
| 120 | + want the Squiz DoubleQuoteUsage sniff to be included in our |
| 121 | + standard, but we don't want the ContainsVar error message to |
| 122 | + ever be displayed. |
| 123 | + --> |
| 124 | + <rule ref="Squiz.PHP.CommentedOutCode"> |
| 125 | + <severity>1</severity> |
| 126 | + </rule> |
| 127 | + |
| 128 | + <exclude-pattern>*/node_modules/*</exclude-pattern> |
| 129 | + <exclude-pattern>*/vendor/*</exclude-pattern> |
| 130 | + <exclude-pattern>*/reports/*</exclude-pattern> |
| 131 | +</ruleset> |
0 commit comments