623 lines
31 KiB
XML
623 lines
31 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<ruleset name="SeptCodingStandard">
|
|
<description>September first coding standard.</description>
|
|
|
|
<rule ref="PSR12">
|
|
<exclude name="Generic.Files.LineLength"/>
|
|
|
|
<!-- checked by SlevomatCodingStandard.Namespaces.UseSpacing -->
|
|
<exclude name="PSR2.Namespaces.UseDeclaration.SpaceAfterLastUse"/>
|
|
<exclude name="PSR12.Files.FileHeader"/>
|
|
<!-- checked by SlevomatCodingStandard.Namespaces.NamespaceSpacing -->
|
|
<exclude name="PSR2.Namespaces.NamespaceDeclaration.BlankLineAfter"/>
|
|
<!-- checked by SlevomatCodingStandard.Operators.SpreadOperatorSpacing -->
|
|
<exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterVariadic"/>
|
|
<!-- checked by SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing -->
|
|
<exclude name="PSR12.Functions.ReturnTypeDeclaration"/>
|
|
<!-- checked by SlevomatCodingStandard.Classes.TraitUseSpacing -->
|
|
<exclude name="PSR12.Traits.UseDeclaration"/>
|
|
<!-- checked by SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing.WhitespaceAfterNullabilitySymbol -->
|
|
<exclude name="PSR12.Functions.NullableTypeDeclaration.WhitespaceFound"/>
|
|
<!-- checked by PSR12.ControlStructures.ControlStructureSpacing -->
|
|
<exclude name="PSR2.ControlStructures.ControlStructureSpacing.SpacingAfterOpenBrace"/>
|
|
<!-- checked by Zend.NamingConventions.ValidVariableName.NotCamelCaps -->
|
|
<!-- <exclude name="Squiz.NamingConventions.ValidVariableName.NotCamelCaps"/> -->
|
|
</rule>
|
|
|
|
|
|
<!-- All SlevomatCodingStandard snifs https://github.com/slevomat/coding-standard?tab=readme-ov-file#fixing-errors-automatically -->
|
|
<rule ref="vendor/slevomat/coding-standard/SlevomatCodingStandard/ruleset.xml">
|
|
<!-- sniffs to exclude -->
|
|
|
|
<exclude name="SlevomatCodingStandard.Arrays.AlphabeticallySortedByKeys.IncorrectKeyOrder" />
|
|
|
|
<exclude name="SlevomatCodingStandard.Attributes.AttributesOrder" />
|
|
<exclude name="SlevomatCodingStandard.Attributes.RequireAttributeAfterDocComment.AttributeBeforeDocComment" />
|
|
|
|
<exclude name="SlevomatCodingStandard.Classes.ClassLength.ClassTooLong" />
|
|
<exclude name="SlevomatCodingStandard.Classes.DisallowConstructorPropertyPromotion.DisallowedConstructorPropertyPromotion" />
|
|
<exclude name="SlevomatCodingStandard.Classes.ForbiddenPublicProperty.ForbiddenPublicProperty" />
|
|
<exclude name="SlevomatCodingStandard.Classes.RequireAbstractOrFinal.ClassNeitherAbstractNorFinal" />
|
|
<exclude name="SlevomatCodingStandard.Classes.RequireSingleLineMethodSignature.RequiredSingleLineSignature" />
|
|
|
|
<exclude name="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming.SuperfluousPrefix" />
|
|
<exclude name="SlevomatCodingStandard.Classes.SuperfluousExceptionNaming.SuperfluousSuffix" />
|
|
<exclude name="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming.SuperfluousSuffix" />
|
|
<exclude name="SlevomatCodingStandard.Classes.SuperfluousTraitNaming.SuperfluousSuffix" />
|
|
|
|
<exclude name="SlevomatCodingStandard.Commenting.DeprecatedAnnotationDeclaration.MissingDescription" />
|
|
<exclude name="SlevomatCodingStandard.Commenting.DisallowCommentAfterCode.DisallowedCommentAfterCode" />
|
|
<exclude name="SlevomatCodingStandard.Commenting.DisallowOneLinePropertyDocComment.OneLinePropertyComment" />
|
|
<exclude name="SlevomatCodingStandard.Commenting.InlineDocCommentDeclaration.InvalidFormat" />
|
|
<exclude name="SlevomatCodingStandard.Commenting.RequireOneLineDocComment.MultiLineDocComment" />
|
|
<exclude name="SlevomatCodingStandard.Commenting.RequireOneLinePropertyDocComment.MultiLinePropertyComment" />
|
|
|
|
<exclude name="SlevomatCodingStandard.Complexity.Cognitive.ComplexityTooHigh" />
|
|
|
|
<exclude name="SlevomatCodingStandard.ControlStructures.DisallowNullSafeObjectOperator.DisallowedNullSafeObjectOperator" />
|
|
<exclude name="SlevomatCodingStandard.ControlStructures.DisallowYodaComparison.DisallowedYodaComparison" />
|
|
<exclude name="SlevomatCodingStandard.ControlStructures.NewWithoutParentheses.UselessParentheses" />
|
|
<exclude name="SlevomatCodingStandard.ControlStructures.RequireTernaryOperator.TernaryOperatorNotUsed" />
|
|
<exclude name="SlevomatCodingStandard.ControlStructures.NewWithParentheses.MissingParentheses" />
|
|
|
|
<exclude name="SlevomatCodingStandard.Exceptions.DisallowNonCapturingCatch.DisallowedNonCapturingCatch" />
|
|
|
|
<exclude name="SlevomatCodingStandard.Files.FileLength.FileTooLong" />
|
|
<exclude name="SlevomatCodingStandard.Files.LineLength.LineTooLong" />
|
|
<exclude name="SlevomatCodingStandard.Files.TypeNameMatchesFileName.NoMatchBetweenTypeNameAndFileName" />
|
|
|
|
<exclude name="SlevomatCodingStandard.Functions.DisallowArrowFunction.DisallowedArrowFunction" />
|
|
<exclude name="SlevomatCodingStandard.Functions.DisallowEmptyFunction.EmptyFunction" />
|
|
<exclude name="SlevomatCodingStandard.Functions.DisallowNamedArguments.DisallowedNamedArgument" />
|
|
<exclude name="SlevomatCodingStandard.Functions.FunctionLength.FunctionLength" />
|
|
<exclude name="SlevomatCodingStandard.Functions.RequireArrowFunction.RequiredArrowFunction" />
|
|
<exclude name="SlevomatCodingStandard.Functions.RequireMultiLineCall.RequiredMultiLineCall" />
|
|
<exclude name="SlevomatCodingStandard.Functions.RequireSingleLineCall.RequiredSingleLineCall" />
|
|
<exclude name="SlevomatCodingStandard.Functions.UnusedParameter.UnusedParameter" />
|
|
|
|
<exclude name="SlevomatCodingStandard.Namespaces.FullyQualifiedClassNameInAnnotation.NonFullyQualifiedClassName" />
|
|
<exclude name="SlevomatCodingStandard.Namespaces.FullyQualifiedExceptions.NonFullyQualifiedException" />
|
|
<exclude name="SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalConstants.NonFullyQualified" />
|
|
<exclude name="SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalFunctions.NonFullyQualified" />
|
|
<exclude name="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly.ReferenceViaFullyQualifiedName" />
|
|
<exclude name="SlevomatCodingStandard.Namespaces.UseOnlyWhitelistedNamespaces.NonFullyQualified" />
|
|
|
|
<exclude name="SlevomatCodingStandard.Numbers.RequireNumericLiteralSeparator.RequiredNumericLiteralSeparator" />
|
|
|
|
<exclude name="SlevomatCodingStandard.Operators.DisallowIncrementAndDecrementOperators.DisallowedPreDecrementOperator" />
|
|
<exclude name="SlevomatCodingStandard.Operators.DisallowIncrementAndDecrementOperators.DisallowedPreIncrementOperator" />
|
|
|
|
<exclude name="SlevomatCodingStandard.TypeHints.DisallowMixedTypeHint.DisallowedMixedTypeHint" />
|
|
<exclude name="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingTraversableTypeHintSpecification" />
|
|
<exclude name="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingTraversableTypeHintSpecification" />
|
|
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification" />
|
|
<!-- This sniff has been deprecated since Slevomat Coding Standard 8.16.0 and will be removed in Slevomat Coding Standard 9.0.0. Use SlevomatCodingStandard.TypeHints.DNFTypeHintFormat instead. -->
|
|
<exclude name="SlevomatCodingStandard.TypeHints.UnionTypeHintFormat" />
|
|
|
|
<exclude name="SlevomatCodingStandard.Whitespaces.DuplicateSpaces.DuplicateSpaces" />
|
|
|
|
</rule>
|
|
|
|
|
|
|
|
<!-- Force array element indentation with 4 spaces -->
|
|
<rule ref="Generic.Arrays.ArrayIndent"/>
|
|
<!-- Forbid `array(...)` -->
|
|
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
|
|
<!-- Forbid duplicate classes -->
|
|
<rule ref="Generic.Classes.DuplicateClassName"/>
|
|
<!-- Forbid empty statements -->
|
|
<rule ref="Generic.CodeAnalysis.EmptyStatement">
|
|
<!-- But allow empty catch -->
|
|
<exclude name="Generic.CodeAnalysis.EmptyStatement.DetectedCatch"/>
|
|
</rule>
|
|
<!-- Forbid final methods in final classes -->
|
|
<rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/>
|
|
<!-- Forbid useless empty method overrides -->
|
|
<!-- <rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/> -->
|
|
<!-- Forbid inline HTML in PHP code -->
|
|
<rule ref="Generic.Files.InlineHTML"/>
|
|
<!-- Align corresponding assignment statement tokens -->
|
|
<!-- <rule ref="Generic.Formatting.MultipleStatementAlignment">
|
|
<properties>
|
|
<property name="error" value="true"/>
|
|
</properties>
|
|
</rule> -->
|
|
<!-- Force whitespace after a type cast -->
|
|
<rule ref="Generic.Formatting.SpaceAfterCast">
|
|
<properties>
|
|
<property name="spacing" value="1"/>
|
|
</properties>
|
|
</rule>
|
|
<!-- Force whitespace after `!` -->
|
|
<!-- <rule ref="Generic.Formatting.SpaceAfterNot"/> -->
|
|
<!-- Forbid PHP 4 constructors -->
|
|
<rule ref="Generic.NamingConventions.ConstructorName"/>
|
|
<!-- Forbid any content before opening tag -->
|
|
<rule ref="Generic.PHP.CharacterBeforePHPOpeningTag"/>
|
|
<!-- Forbid deprecated functions -->
|
|
<rule ref="Generic.PHP.DeprecatedFunctions"/>
|
|
<!-- Forbid alias functions, i.e. `sizeof()`, `delete()` -->
|
|
<rule ref="Generic.PHP.ForbiddenFunctions">
|
|
<properties>
|
|
<property name="forbiddenFunctions" type="array">
|
|
<element key="chop" value="rtrim"/>
|
|
<element key="close" value="closedir"/>
|
|
<element key="compact" value="null"/>
|
|
<element key="delete" value="unset"/>
|
|
<element key="doubleval" value="floatval"/>
|
|
<element key="extract" value="null"/>
|
|
<element key="fputs" value="fwrite"/>
|
|
<element key="ini_alter" value="ini_set"/>
|
|
<element key="is_double" value="is_float"/>
|
|
<element key="is_integer" value="is_int"/>
|
|
<element key="is_long" value="is_int"/>
|
|
<element key="is_null" value="null"/>
|
|
<element key="is_real" value="is_float"/>
|
|
<element key="is_writeable" value="is_writable"/>
|
|
<element key="join" value="implode"/>
|
|
<element key="key_exists" value="array_key_exists"/>
|
|
<element key="pos" value="current"/>
|
|
<element key="settype" value="null"/>
|
|
<element key="show_source" value="highlight_file"/>
|
|
<element key="sizeof" value="count"/>
|
|
<element key="strchr" value="strstr"/>
|
|
<element key="user_error" value="trigger_error"/>
|
|
</property>
|
|
</properties>
|
|
</rule>
|
|
<!-- Forbid useless inline string concatenation -->
|
|
<rule ref="Generic.Strings.UnnecessaryStringConcat">
|
|
<!-- But multiline is useful for readability -->
|
|
<properties>
|
|
<property name="allowMultiline" value="true"/>
|
|
</properties>
|
|
</rule>
|
|
<!-- Forbid backtick operator -->
|
|
<rule ref="Generic.PHP.BacktickOperator"/>
|
|
<!-- Force PHP 7 param and return types to be lowercased -->
|
|
<rule ref="Generic.PHP.LowerCaseType"/>
|
|
<!-- Forbid `php_sapi_name()` function -->
|
|
<rule ref="Generic.PHP.SAPIUsage"/>
|
|
<!-- Forbid comments starting with # -->
|
|
<rule ref="PEAR.Commenting.InlineComment"/>
|
|
<!-- Disallow else if in favor of elseif -->
|
|
<rule ref="PSR2.ControlStructures.ElseIfDeclaration.NotAllowed">
|
|
<type>error</type>
|
|
</rule>
|
|
|
|
<!-- Require presence of constant visibility -->
|
|
<rule ref="SlevomatCodingStandard.Classes.ClassConstantVisibility">
|
|
<properties>
|
|
<property name="fixable" value="true"/>
|
|
</properties>
|
|
</rule>
|
|
|
|
<!-- Forbid empty lines around type declarations -->
|
|
<rule ref="SlevomatCodingStandard.Classes.EmptyLinesAroundClassBraces">
|
|
<properties>
|
|
<property name="linesCountAfterOpeningBrace" value="0"/>
|
|
<property name="linesCountBeforeClosingBrace" value="0"/>
|
|
</properties>
|
|
</rule>
|
|
|
|
<!-- Ensure that there are consistent blank lines between properties. -->
|
|
<rule ref="SlevomatCodingStandard.Classes.PropertySpacing">
|
|
<properties>
|
|
<property name="minLinesCountBeforeWithComment" value="0" />
|
|
</properties>
|
|
</rule>
|
|
|
|
<!-- https://github.com/slevomat/coding-standard#slevomatcodingstandardclassespropertydeclaration- -->
|
|
<rule ref="SlevomatCodingStandard.Classes.PropertyDeclaration">
|
|
<properties>
|
|
<property name="checkPromoted" value="true"/>
|
|
<property name="enableMultipleSpacesBetweenModifiersCheck" value="true"/>
|
|
</properties>
|
|
</rule>
|
|
|
|
<!-- Require no spaces before trait use, between trait uses and one space after trait uses -->
|
|
<rule ref="SlevomatCodingStandard.Classes.TraitUseSpacing">
|
|
<properties>
|
|
<property name="linesCountAfterLastUse" value="1"/>
|
|
<property name="linesCountAfterLastUseWhenLastInClass" value="0"/>
|
|
<property name="linesCountBeforeFirstUse" value="0"/>
|
|
<property name="linesCountBetweenUses" value="0"/>
|
|
</properties>
|
|
</rule>
|
|
|
|
<!-- Require specific order of phpDoc annotations with empty newline between specific groups -->
|
|
<rule ref="SlevomatCodingStandard.Commenting.DocCommentSpacing">
|
|
<properties>
|
|
<property name="linesCountBeforeFirstContent" value="0"/>
|
|
<property name="linesCountAfterLastContent" value="0"/>
|
|
<property name="linesCountBetweenDescriptionAndAnnotations" value="1"/>
|
|
<property name="linesCountBetweenAnnotationsGroups" value="1"/>
|
|
<property name="annotationsGroups" type="array">
|
|
<element value="
|
|
@internal,
|
|
@deprecated,
|
|
"/>
|
|
<element value="
|
|
@link,
|
|
@see,
|
|
@uses,
|
|
"/>
|
|
<element value="
|
|
@ORM\,
|
|
@ODM\,
|
|
@PHPCR\,
|
|
"/>
|
|
<element value="
|
|
@param,
|
|
@psalm-param,
|
|
@phpstan-param,
|
|
"/>
|
|
<element value="
|
|
@return,
|
|
@psalm-return,
|
|
@phpstan-return,
|
|
"/>
|
|
<element value="@throws"/>
|
|
</property>
|
|
</properties>
|
|
</rule>
|
|
<!-- Forbid useless annotations - Git and LICENCE file provide more accurate information -->
|
|
<rule ref="SlevomatCodingStandard.Commenting.ForbiddenAnnotations">
|
|
<properties>
|
|
<property name="forbiddenAnnotations" type="array">
|
|
<element value="@api"/>
|
|
<element value="@author"/>
|
|
<element value="@category"/>
|
|
<element value="@copyright"/>
|
|
<element value="@created"/>
|
|
<element value="@license"/>
|
|
<element value="@package"/>
|
|
<element value="@since"/>
|
|
<element value="@subpackage"/>
|
|
<element value="@version"/>
|
|
</property>
|
|
</properties>
|
|
</rule>
|
|
<!-- Forbid useless comments -->
|
|
<rule ref="SlevomatCodingStandard.Commenting.ForbiddenComments">
|
|
<properties>
|
|
<property name="forbiddenCommentPatterns" type="array">
|
|
<element value="~^(?:(?!private|protected|static)\S+ )?(?:con|de)structor\.\z~i"/>
|
|
<element value="~^Created by .+\.\z~i"/>
|
|
<element value="~^(User|Date|Time): \S+\z~i"/>
|
|
<element value="~^\S+ [gs]etter\.\z~i"/>
|
|
<element value="~^(Class|Interface|Trait) \S+\z~i"/>
|
|
</property>
|
|
</properties>
|
|
</rule>
|
|
|
|
<!-- Require consistent spacing for block structures -->
|
|
<rule ref="SlevomatCodingStandard.ControlStructures.BlockControlStructureSpacing">
|
|
<exclude name="SlevomatCodingStandard.ControlStructures.BlockControlStructureSpacing.IncorrectLinesCountBeforeControlStructure" />
|
|
<exclude name="SlevomatCodingStandard.ControlStructures.BlockControlStructureSpacing.IncorrectLinesCountBeforeFirstControlStructure" />
|
|
<properties>
|
|
<property name="controlStructures" type="array">
|
|
<element value="if" />
|
|
<element value="do" />
|
|
<element value="while" />
|
|
<element value="for" />
|
|
<element value="foreach" />
|
|
<element value="switch" />
|
|
<element value="try" />
|
|
<element value="default" />
|
|
</property>
|
|
</properties>
|
|
</rule>
|
|
|
|
<!-- Require consistent spacing for jump statements -->
|
|
<rule ref="SlevomatCodingStandard.ControlStructures.JumpStatementsSpacing">
|
|
<properties>
|
|
<property name="linesCountBeforeWhenFirstInCaseOrDefault" value="0"/>
|
|
<property name="linesCountAfterWhenLastInCaseOrDefault" value="1"/>
|
|
<property name="linesCountAfterWhenLastInLastCaseOrDefault" value="0"/>
|
|
<property name="jumpStatements" type="array">
|
|
<element value="return" />
|
|
<element value="throw" />
|
|
<element value="yield" />
|
|
<element value="yield_from" />
|
|
</property>
|
|
</properties>
|
|
</rule>
|
|
|
|
<!-- Ensure Arrow Functions declaration format -->
|
|
<rule ref="SlevomatCodingStandard.Functions.ArrowFunctionDeclaration">
|
|
<properties>
|
|
<property name="spacesCountAfterKeyword" value="1"/>
|
|
<property name="spacesCountBeforeArrow" value="1"/>
|
|
<property name="spacesCountAfterArrow" value="1"/>
|
|
</properties>
|
|
</rule>
|
|
<!-- Disallow trailing commas in single line function calls -->
|
|
<rule ref="SlevomatCodingStandard.Functions.DisallowTrailingCommaInCall">
|
|
<properties>
|
|
<property name="onlySingleLine" value="true" />
|
|
</properties>
|
|
</rule>
|
|
<!-- Disallow trailing commas in single line closure use -->
|
|
<rule ref="SlevomatCodingStandard.Functions.DisallowTrailingCommaInClosureUse">
|
|
<properties>
|
|
<property name="onlySingleLine" value="true" />
|
|
</properties>
|
|
</rule>
|
|
<!-- Disallow trailing commas in single line function declarations -->
|
|
<rule ref="SlevomatCodingStandard.Functions.DisallowTrailingCommaInDeclaration">
|
|
<properties>
|
|
<property name="onlySingleLine" value="true" />
|
|
</properties>
|
|
</rule>
|
|
|
|
<!-- Forbid using absolute class name references (except global ones) -->
|
|
<!-- <rule ref="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly">
|
|
<properties>
|
|
<property name="allowFallbackGlobalConstants" value="false"/>
|
|
<property name="allowFallbackGlobalFunctions" value="false"/>
|
|
<property name="allowFullyQualifiedGlobalClasses" value="false"/>
|
|
<property name="allowFullyQualifiedGlobalConstants" value="false"/>
|
|
<property name="allowFullyQualifiedGlobalFunctions" value="false"/>
|
|
<property name="allowFullyQualifiedNameForCollidingClasses" value="true"/>
|
|
<property name="allowFullyQualifiedNameForCollidingConstants" value="true"/>
|
|
<property name="allowFullyQualifiedNameForCollidingFunctions" value="true"/>
|
|
<property name="searchAnnotations" value="true"/>
|
|
</properties>
|
|
</rule> -->
|
|
<!-- Forbid unused use statements -->
|
|
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses">
|
|
<properties>
|
|
<property name="searchAnnotations" value="true"/>
|
|
</properties>
|
|
</rule>
|
|
|
|
<!-- Require empty newlines before and after uses -->
|
|
<rule ref="SlevomatCodingStandard.Namespaces.UseSpacing">
|
|
<properties>
|
|
<property name="linesCountAfterLastUse" value="1"/>
|
|
<property name="linesCountBeforeFirstUse" value="1"/>
|
|
<property name="linesCountBetweenUseTypes" value="1"/>
|
|
</properties>
|
|
</rule>
|
|
|
|
<!-- Require presence of declare(strict_types=1) -->
|
|
<rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes">
|
|
<properties>
|
|
<property
|
|
name="declareOnFirstLine"
|
|
value="false"
|
|
/>
|
|
<property
|
|
name="linesCountBeforeDeclare"
|
|
value="1"
|
|
/>
|
|
<property
|
|
name="spacesCountAroundEqualsSign"
|
|
value="0"
|
|
/>
|
|
<property
|
|
name="linesCountAfterDeclare"
|
|
value="1"
|
|
/>
|
|
</properties>
|
|
</rule>
|
|
|
|
<!-- Require /* @var type $foo */ and similar simple inline annotations to be replaced by assert() -->
|
|
<rule ref="SlevomatCodingStandard.PHP.RequireExplicitAssertion">
|
|
<properties>
|
|
<property name="enableAdvancedStringTypes" value="true"/>
|
|
<property name="enableIntegerRanges" value="true"/>
|
|
</properties>
|
|
</rule>
|
|
|
|
<!-- Require space around colon in return types -->
|
|
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing">
|
|
<properties>
|
|
<property name="spacesCountBeforeColon" value="0"/>
|
|
</properties>
|
|
</rule>
|
|
<!-- Require types to be written as natively if possible;
|
|
require iterable types to specify phpDoc with their content;
|
|
forbid useless/duplicated information in phpDoc -->
|
|
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint">
|
|
<properties>
|
|
<property name="traversableTypeHints" type="array">
|
|
<element value="Traversable"/>
|
|
<element value="Iterator"/>
|
|
<element value="IteratorAggregate"/>
|
|
<element value="Doctrine\Common\Collections\Collection"/>
|
|
</property>
|
|
</properties>
|
|
</rule>
|
|
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint">
|
|
<properties>
|
|
<property name="traversableTypeHints" type="array">
|
|
<element value="Traversable"/>
|
|
<element value="Iterator"/>
|
|
<element value="IteratorAggregate"/>
|
|
<element value="Doctrine\Common\Collections\Collection"/>
|
|
</property>
|
|
</properties>
|
|
</rule>
|
|
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint">
|
|
<properties>
|
|
<property name="traversableTypeHints" type="array">
|
|
<element value="Traversable"/>
|
|
<element value="Iterator"/>
|
|
<element value="IteratorAggregate"/>
|
|
<element value="Doctrine\Common\Collections\Collection"/>
|
|
</property>
|
|
</properties>
|
|
</rule>
|
|
<!-- Define DNF style -->
|
|
<rule ref="SlevomatCodingStandard.TypeHints.DNFTypeHintFormat">
|
|
<properties>
|
|
<property name="withSpacesAroundOperators" value="no" />
|
|
<property name="withSpacesInsideParentheses" value="no" />
|
|
<property name="nullPosition" value="last" />
|
|
</properties>
|
|
</rule>
|
|
|
|
<!-- Forbid useless phpDocs for functions -->
|
|
<rule ref="SlevomatCodingStandard.Commenting.UselessFunctionDocComment">
|
|
<properties>
|
|
<property name="traversableTypeHints" type="array">
|
|
<element value="Traversable"/>
|
|
<element value="Iterator"/>
|
|
<element value="IteratorAggregate"/>
|
|
<element value="Doctrine\Common\Collections\Collection"/>
|
|
</property>
|
|
</properties>
|
|
</rule>
|
|
|
|
<!-- Forbid spaces around square brackets -->
|
|
<rule ref="Squiz.Arrays.ArrayBracketSpacing"/>
|
|
<!-- Force array declaration structure -->
|
|
<rule ref="Squiz.Arrays.ArrayDeclaration">
|
|
<!-- Disable arrow alignment -->
|
|
<exclude name="Squiz.Arrays.ArrayDeclaration.DoubleArrowNotAligned"/>
|
|
<!-- Uses indentation of only single space -->
|
|
<exclude name="Squiz.Arrays.ArrayDeclaration.KeyNotAligned"/>
|
|
<!-- Allow multiple values on a single line -->
|
|
<exclude name="Squiz.Arrays.ArrayDeclaration.SingleLineNotAllowed"/>
|
|
<!-- Disable alignment of braces -->
|
|
<exclude name="Squiz.Arrays.ArrayDeclaration.CloseBraceNotAligned"/>
|
|
<!-- Disable alignment of values with opening brace -->
|
|
<exclude name="Squiz.Arrays.ArrayDeclaration.ValueNotAligned"/>
|
|
<!-- Checked by SlevomatCodingStandard.Arrays.TrailingArrayComma.MissingTrailingComma -->
|
|
<exclude name="Squiz.Arrays.ArrayDeclaration.NoCommaAfterLast"/>
|
|
<exclude name="Squiz.Arrays.ArrayDeclaration.NoComma"/>
|
|
|
|
<exclude name="Squiz.Arrays.ArrayDeclaration.MultiLineNotAllowed"/>
|
|
</rule>
|
|
|
|
<!-- Forbid class being in a file with different name -->
|
|
<rule ref="Squiz.Classes.ClassFileName"/>
|
|
<!-- Force `self::` for self-reference, force lower-case self, forbid spaces around `::` -->
|
|
<rule ref="Squiz.Classes.SelfMemberReference"/>
|
|
<!-- Force phpDoc alignment -->
|
|
<rule ref="Squiz.Commenting.DocCommentAlignment">
|
|
<!-- Allow extra spaces after star, i.e. for indented annotations -->
|
|
<exclude name="Squiz.Commenting.DocCommentAlignment.SpaceAfterStar"/>
|
|
</rule>
|
|
|
|
<!-- Force rules for function phpDoc -->
|
|
<rule ref="Squiz.Commenting.FunctionComment">
|
|
<!-- Allow `@throws` without description -->
|
|
<exclude name="Squiz.Commenting.FunctionComment.EmptyThrows"/>
|
|
<!-- Does not work properly with PHP 7 / short-named types -->
|
|
<exclude name="Squiz.Commenting.FunctionComment.IncorrectParamVarName"/>
|
|
<!-- Does not support collections, i.e. `string[]` -->
|
|
<exclude name="Squiz.Commenting.FunctionComment.IncorrectTypeHint"/>
|
|
<!-- Forces incorrect types -->
|
|
<exclude name="Squiz.Commenting.FunctionComment.InvalidReturn"/>
|
|
<!-- Breaks with compound return types, i.e. `string|null` -->
|
|
<exclude name="Squiz.Commenting.FunctionComment.InvalidReturnNotVoid"/>
|
|
<!-- Breaks when all params are not documented -->
|
|
<exclude name="Squiz.Commenting.FunctionComment.InvalidTypeHint"/>
|
|
<!-- Doc comment is not required for every method -->
|
|
<exclude name="Squiz.Commenting.FunctionComment.Missing"/>
|
|
<!-- Do not require comments for `@param` -->
|
|
<exclude name="Squiz.Commenting.FunctionComment.MissingParamComment"/>
|
|
<!-- Do not require `@param` for all parameters -->
|
|
<exclude name="Squiz.Commenting.FunctionComment.MissingParamTag"/>
|
|
<!-- Do not require `@return` for void methods -->
|
|
<exclude name="Squiz.Commenting.FunctionComment.MissingReturn"/>
|
|
<!-- Comments don't have to be sentences -->
|
|
<exclude name="Squiz.Commenting.FunctionComment.ParamCommentFullStop"/>
|
|
<!-- Comments don't have to be sentences -->
|
|
<exclude name="Squiz.Commenting.FunctionComment.ParamCommentNotCapital"/>
|
|
<!-- Breaks when all params are not documented -->
|
|
<exclude name="Squiz.Commenting.FunctionComment.ParamNameNoMatch"/>
|
|
<!-- Doesn't respect inheritance -->
|
|
<exclude name="Squiz.Commenting.FunctionComment.ScalarTypeHintMissing"/>
|
|
<!-- `@throws` lines can often be read as a sentence,
|
|
i.e. `@throws RuntimeException if the file could not be written.` -->
|
|
<exclude name="Squiz.Commenting.FunctionComment.ThrowsNotCapital"/>
|
|
<!-- Doesn't work with self as typehint -->
|
|
<exclude name="Squiz.Commenting.FunctionComment.TypeHintMissing"/>
|
|
<exclude name="Squiz.Commenting.FunctionComment.SpacingAfterParamType"/>
|
|
<exclude name="Squiz.Commenting.FunctionComment.SpacingAfterParamName"/>
|
|
|
|
<exclude name="Squiz.WhiteSpace.ScopeClosingBrace.ContentBefore"/>
|
|
<exclude name="PEAR.WhiteSpace.ScopeClosingBrace.Line"/>
|
|
|
|
<exclude name="Squiz.Commenting.FunctionComment.WrongStyle"/>
|
|
</rule>
|
|
|
|
<!-- Forbid global functions -->
|
|
<rule ref="Squiz.Functions.GlobalFunction"/>
|
|
<!-- Force camelCase variables -->
|
|
<rule ref="Squiz.NamingConventions.ValidVariableName">
|
|
<exclude name="Squiz.NamingConventions.ValidVariableName.PrivateNoUnderscore" />
|
|
</rule>
|
|
<!-- Forbid `AND` and `OR`, require `&&` and `||` -->
|
|
<rule ref="Squiz.Operators.ValidLogicalOperators"/>
|
|
<!-- Forbid `global` -->
|
|
<rule ref="Squiz.PHP.GlobalKeyword"/>
|
|
<!-- Forbid functions inside functions -->
|
|
<rule ref="Squiz.PHP.InnerFunctions"/>
|
|
<!-- Require PHP function calls in lowercase -->
|
|
<rule ref="Squiz.PHP.LowercasePHPFunctions"/>
|
|
<!-- Forbid dead code -->
|
|
<rule ref="Squiz.PHP.NonExecutableCode"/>
|
|
<!-- Forbid `$this` inside static function -->
|
|
<rule ref="Squiz.Scope.StaticThisUsage"/>
|
|
<!-- Force whitespace before and after concatenation -->
|
|
<rule ref="Squiz.Strings.ConcatenationSpacing">
|
|
<properties>
|
|
<property name="spacing" value="1"/>
|
|
<property name="ignoreNewlines" value="true"/>
|
|
</properties>
|
|
</rule>
|
|
|
|
<!-- Forbid strings in `"` unless necessary -->
|
|
<!-- <rule ref="Squiz.Strings.DoubleQuoteUsage"/> -->
|
|
<!-- Forbid braces around string in `echo` -->
|
|
<rule ref="Squiz.Strings.EchoedStrings"/>
|
|
<!-- Forbid spaces in type casts -->
|
|
<rule ref="Squiz.WhiteSpace.CastSpacing"/>
|
|
<!-- Forbid blank line after function opening brace -->
|
|
<rule ref="Squiz.WhiteSpace.FunctionOpeningBraceSpace"/>
|
|
<!-- Require 1 line before and after function, except at the top and bottom -->
|
|
<rule ref="Squiz.WhiteSpace.FunctionSpacing">
|
|
<properties>
|
|
<property name="spacing" value="1" />
|
|
<property name="spacingBeforeFirst" value="0"/>
|
|
<property name="spacingAfterLast" value="0"/>
|
|
</properties>
|
|
</rule>
|
|
|
|
<!-- Require there be no space between increment/decrement operator and its operand -->
|
|
<rule ref="Generic.WhiteSpace.IncrementDecrementSpacing"/>
|
|
<!-- Require space after language constructs -->
|
|
<rule ref="Generic.WhiteSpace.LanguageConstructSpacing"/>
|
|
<!-- Require space around logical operators -->
|
|
<rule ref="Squiz.WhiteSpace.LogicalOperatorSpacing"/>
|
|
<!-- Forbid spaces around `->` operator -->
|
|
<rule ref="Squiz.WhiteSpace.ObjectOperatorSpacing">
|
|
<properties>
|
|
<property name="ignoreNewlines" value="true"/>
|
|
</properties>
|
|
</rule>
|
|
|
|
<!-- Forbid spaces before semicolon `;` -->
|
|
<!-- <rule ref="Squiz.WhiteSpace.SemicolonSpacing"/> -->
|
|
|
|
<!-- Forbid superfluous whitespaces -->
|
|
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
|
|
<properties>
|
|
<!-- turned on by PSR-12 -> turning back off -->
|
|
<property name="ignoreBlankLines" value="false"/>
|
|
</properties>
|
|
</rule>
|
|
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines">
|
|
<!-- turned off by PSR-12 -> turning back on -->
|
|
<severity>5</severity>
|
|
</rule>
|
|
|
|
</ruleset>
|