Skip to content

Instantly share code, notes, and snippets.

@marcmascort
Last active June 30, 2020 11:29
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save marcmascort/fa2a6f5d5d0aa9a3866f4fe76f857606 to your computer and use it in GitHub Desktop.
Save marcmascort/fa2a6f5d5d0aa9a3866f4fe76f857606 to your computer and use it in GitHub Desktop.
phpcs compatible to phpinsights
<ruleset name="PHP_Codeer" xsi:noNamespaceSchemaLocation="phpcs.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<description>The coding standard for PHP_Codeer itself.</description>
<!-- Files -->
<file>bin</file>
<file>src</file>
<!-- Excludes -->
<exclude-pattern>vendor/</exclude-pattern>
<!-- Arguments -->
<arg name="basepath" value="."/>
<arg name="tab-width" value="4"/>
<arg name="colors"/>
<arg name="parallel" value="75"/>
<arg value="p"/>
<ini name="memory_limit" value="128M"/>
<!-- Configs -->
<config name="installed_paths" value="vendor/slevomat/coding-standard"/>
<!-- Internal -->
<rule ref="Internal.Tokenizer.Exception">
<type>error</type>
</rule>
<!-- Style -->
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
<rule ref="Generic.Files.ByteOrderMark"/>
<rule ref="Generic.Files.LineEndings"/>
<rule ref="Generic.Files.LineLength"/>
<rule ref="Generic.Formatting.SpaceAfterCast"/>
<rule ref="Generic.Formatting.SpaceAfterNot"/>
<rule ref="Generic.Functions.FunctionCallArgumentSpacing"/>
<rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
<rule ref="Generic.PHP.BacktickOperator"/>
<rule ref="Generic.PHP.CharacterBeforePHPOpeningTag"/>
<rule ref="Generic.PHP.DisallowAlternativePHPTags"/>
<rule ref="Generic.PHP.DisallowShortOpenTag"/>
<rule ref="Generic.PHP.ForbiddenFunctions"/>
<rule ref="Generic.PHP.LowerCaseConstant"/>
<rule ref="Generic.PHP.LowerCaseKeyword"/>
<rule ref="Generic.PHP.LowerCaseType"/>
<rule ref="Generic.PHP.SAPIUsage"/>
<rule ref="Generic.PHP.Syntax"/>
<rule ref="Generic.VersionControl.GitMergeConflict"/>
<rule ref="Generic.WhiteSpace.ArbitraryParenthesesSpacing"/>
<rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
<rule ref="Generic.WhiteSpace.IncrementDecrementSpacing"/>
<rule ref="PEAR.WhiteSpace.ObjectOperatorIndent"/>
<rule ref="PEAR.WhiteSpace.ScopeClosingBrace"/>
<rule ref="PSR1.Files.SideEffects"/>
<rule ref="PSR1.Methods.CamelCapsMethodName"/>
<rule ref="PSR2.ControlStructures.ElseIfDeclaration"/>
<rule ref="PSR2.ControlStructures.SwitchDeclaration"/>
<rule ref="PSR2.Files.ClosingTag"/>
<rule ref="PSR2.Files.EndFileNewline"/>
<rule ref="PSR2.Methods.FunctionClosingBrace"/>
<rule ref="PSR12.Classes.ClassInstantiation"/>
<rule ref="Squiz.WhiteSpace.LanguageConstructSpacing"/>
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"/>
<rule ref="SlevomatCodingStandard.Arrays.TrailingArrayComma"/>
<rule ref="SlevomatCodingStandard.Commenting.DocCommentSpacing">
<properties>
<property name="linesCountBetweenDifferentAnnotationsTypes" value="1"/>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses"/>
<rule ref="SlevomatCodingStandard.Namespaces.NamespaceSpacing"/>
<rule ref="SlevomatCodingStandard.Namespaces.RequireOneNamespaceInFile"/>
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses"/>
<rule ref="SlevomatCodingStandard.Namespaces.UseDoesNotStartWithBackslash"/>
<rule ref="SlevomatCodingStandard.Namespaces.UseSpacing"/>
<rule ref="SlevomatCodingStandard.Operators.SpreadOperatorSpacing"/>
<rule ref="SlevomatCodingStandard.PHP.ShortList"/>
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHintSpacing"/>
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing"/>
<!-- Code > Classes -->
<rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/>
<rule ref="PSR2.Classes.PropertyDeclaration"/>
<rule ref="SlevomatCodingStandard.Classes.ClassConstantVisibility"/>
<rule ref="SlevomatCodingStandard.Classes.DisallowLateStaticBindingForConstants"/>
<rule ref="SlevomatCodingStandard.Classes.ModernClassNameReference"/>
<rule ref="SlevomatCodingStandard.Classes.UnusedPrivateElements"/>
<rule ref="SlevomatCodingStandard.Classes.UselessLateStaticBinding"/>
<!-- Code > Code -->
<rule ref="Generic.Arrays.ArrayIndent"/>
<rule ref="Generic.CodeAnalysis.EmptyPHPStatement"/>
<rule ref="Generic.CodeAnalysis.EmptyStatement"/>
<rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop"/>
<rule ref="Generic.CodeAnalysis.ForLoopWithTestFunctionCall"/>
<rule ref="Generic.CodeAnalysis.JumbledIncrementer"/>
<rule ref="Generic.CodeAnalysis.UnconditionalIfStatement"/>
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/>
<rule ref="Generic.ControlStructures.InlineControlStructure"/>
<rule ref="Generic.Formatting.DisallowMultipleStatements"/>
<rule ref="Generic.PHP.BacktickOperator"/>
<rule ref="Generic.PHP.DiscourageGoto"/>
<rule ref="Generic.PHP.NoSilencedErrors"/>
<rule ref="Generic.Strings.UnnecessaryStringConcat"/>
<rule ref="PSR2.ControlStructures.SwitchDeclaration"/>
<rule ref="PSR12.Keywords.ShortFormTypeKeywords"/>
<rule ref="Squiz.PHP.Eval"/>
<rule ref="Squiz.WhiteSpace.LanguageConstructSpacing"/>
<rule ref="Zend.Debug.CodeAnalyzer"/>
<rule ref="SlevomatCodingStandard.Arrays.DisallowImplicitArrayCreation"/>
<rule ref="SlevomatCodingStandard.ControlStructures.AssignmentInCondition"/>
<rule ref="SlevomatCodingStandard.ControlStructures.DisallowContinueWithoutIntegerOperandInSwitch"/>
<rule ref="SlevomatCodingStandard.ControlStructures.DisallowEmpty"/>
<rule ref="SlevomatCodingStandard.ControlStructures.DisallowShortTernaryOperator"/>
<rule ref="SlevomatCodingStandard.ControlStructures.DisallowYodaComparison"/>
<rule ref="SlevomatCodingStandard.ControlStructures.LanguageConstructWithParentheses"/>
<rule ref="SlevomatCodingStandard.Exceptions.DeadCatch"/>
<rule ref="SlevomatCodingStandard.Functions.UnusedInheritedVariablePassedToClosure"/>
<rule ref="SlevomatCodingStandard.Functions.UnusedParameter"/>
<rule ref="SlevomatCodingStandard.Functions.UselessParameterDefaultValue"/>
<rule ref="SlevomatCodingStandard.Namespaces.FullyQualifiedExceptions"/>
<rule ref="SlevomatCodingStandard.Namespaces.UseFromSameNamespace"/>
<rule ref="SlevomatCodingStandard.Namespaces.UselessAlias"/>
<rule ref="SlevomatCodingStandard.Operators.DisallowEqualOperators"/>
<rule ref="SlevomatCodingStandard.Operators.RequireCombinedAssignmentOperator"/>
<rule ref="SlevomatCodingStandard.Operators.RequireOnlyStandaloneIncrementAndDecrementOperators"/>
<rule ref="SlevomatCodingStandard.PHP.OptimizedFunctionsWithoutUnpacking"/>
<rule ref="SlevomatCodingStandard.PHP.TypeCast"/>
<rule ref="SlevomatCodingStandard.PHP.UselessParentheses"/>
<rule ref="SlevomatCodingStandard.PHP.UselessSemicolon"/>
<rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes">
<properties>
<property name="newlinesCountBetweenOpenTagAndDeclare" value="2"/>
<property name="spacesCountAroundEqualsSign" value="0"/>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Variables.DuplicateAssignmentToVariable"/>
<rule ref="SlevomatCodingStandard.Variables.UnusedVariable"/>
<rule ref="SlevomatCodingStandard.Variables.UselessVariable"/>
<!-- Code > Comments -->
<rule ref="Generic.Commenting.Fixme"/>
<rule ref="Generic.Commenting.Todo"/>
<rule ref="SlevomatCodingStandard.Commenting.EmptyComment"/>
<rule ref="SlevomatCodingStandard.Commenting.ForbiddenComments"/>
<rule ref="SlevomatCodingStandard.Commenting.InlineDocCommentDeclaration"/>
<rule ref="SlevomatCodingStandard.Commenting.UselessInheritDocComment"/>
<rule ref="SlevomatCodingStandard.TypeHints.DisallowArrayTypeHintSyntax"/>
<rule ref="SlevomatCodingStandard.TypeHints.DisallowMixedTypeHint"/>
<rule ref="SlevomatCodingStandard.TypeHints.LongTypeHints"/>
<rule ref="SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue"/>
<rule ref="SlevomatCodingStandard.TypeHints.NullTypeHintOnLastPosition"/>
<rule ref="SlevomatCodingStandard.TypeHints.TypeHintDeclaration">
<exclude phpcbf-only="true" name="SlevomatCodingStandard.TypeHints.TypeHintDeclaration"/>
</rule>-->
<rule ref="SlevomatCodingStandard.TypeHints.UselessConstantTypeHint"/>
<!-- Code > Functions -->
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter"/>
<rule ref="Generic.Functions.CallTimePassByReference"/>
<rule ref="Generic.PHP.DeprecatedFunctions"/>
<rule ref="Generic.PHP.ForbiddenFunctions"/>
<rule ref="PSR12.Functions.NullableTypeDeclaration"/>
<rule ref="SlevomatCodingStandard.Functions.StaticClosure"/>
<rule ref="SlevomatCodingStandard.Functions.UnusedInheritedVariablePassedToClosure"/>
<!-- Code > Globally -->
<rule ref="Squiz.PHP.GlobalKeyword"/>
<!-- Architecture > Classes -->
<rule ref="Generic.Files.OneClassPerFile"/>
<rule ref="PSR1.Classes.ClassDeclaration"/>
<rule ref="Squiz.Classes.ValidClassName"/>
<rule ref="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming"/>
<rule ref="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming"/>
<!-- Architecture > Files -->
<rule ref="SlevomatCodingStandard.Classes.SuperfluousExceptionNaming"/>
<!-- Architecture > Functions -->
<!-- -->
<!-- Architecture > Globally -->
<!-- -->
<!-- Architecture > Interfaces -->
<rule ref="Generic.Files.OneInterfacePerFile"/>
<!-- Architecture > Namespaces -->
<rule ref="PSR12.Namespaces.CompoundNamespaceDepth"/>
<rule ref="SlevomatCodingStandard.Namespaces.NamespaceDeclaration"/>
<rule ref="SlevomatCodingStandard.Namespaces.UselessAlias"/>
<!-- Architecture > Traits -->
<rule ref="Generic.Files.OneTraitPerFile"/>
<rule ref="SlevomatCodingStandard.Classes.SuperfluousTraitNaming"/>
<!-- Complexity -->
<!-- -->
<!-- Object calisthenics -->
<rule ref="vendor/object-calisthenics/phpcs-calisthenics-rules/src/ObjectCalisthenics/ruleset.xml">
<exclude name="ObjectCalisthenics.ControlStructures.NoElse"/>
<exclude name="ObjectCalisthenics.CodeAnalysis.OneObjectOperatorPerLine"/>
<!-- Code > Classes -->
<exclude name="ObjectCalisthenics.Classes.ForbiddenPublicProperty"/>
<exclude name="ObjectCalisthenics.NamingConventions.NoSetter"/>
<!-- Code > Code -->
<exclude name="ObjectCalisthenics.Metrics.MaxNestingLevel"/>
<exclude name="ObjectCalisthenics.NamingConventions.ElementNameMinimalLength"/>
<!-- Architecture > Classes -->
<exclude name="ObjectCalisthenics.Files.ClassTraitAndInterfaceLength"/>
<exclude name="ObjectCalisthenics.Metrics.MethodPerClassLimit"/>
<exclude name="ObjectCalisthenics.Metrics.PropertyPerClassLimit"/>
<!-- Architecture > Functions -->
<exclude name="ObjectCalisthenics.Files.FunctionLength"/>
</rule>
</ruleset>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment