Skip to content

Instantly share code, notes, and snippets.

@JBlond
Created July 11, 2018 14:57
Show Gist options
  • Save JBlond/d44883595667e185ee45af4eda29570e to your computer and use it in GitHub Desktop.
Save JBlond/d44883595667e185ee45af4eda29570e to your computer and use it in GitHub Desktop.
php code sniffer config
<?xml version="1.0" encoding="UTF-8"?>
<!--suppress XmlUnboundNsPrefix, XmlUnboundNsPrefix -->
<ruleset name="overview">
<description>overview</description>
<rule ref="Generic.Classes.DuplicateClassName"/>
<rule ref="Generic.CodeAnalysis.EmptyStatement"/>
<rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop"/>
<rule ref="Generic.CodeAnalysis.ForLoopWithTestFunctionCall"/>
<rule ref="Generic.CodeAnalysis.UnconditionalIfStatement"/>
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/>
<rule ref="Generic.Functions.CallTimePassByReference"/>
<rule ref="Generic.Metrics.CyclomaticComplexity"/>
<rule ref="Generic.NamingConventions.ConstructorName">
<properties>
<property name="error" value="false"/>
</properties>
</rule>
<rule ref="Generic.PHP.DeprecatedFunctions"/>
<rule ref="Generic.PHP.DisallowShortOpenTag"/>
<rule ref="Generic.PHP.ForbiddenFunctions">
<properties>
<property name="error" value="false"/>
</properties>
</rule>
<rule ref="Generic.PHP.LowerCaseConstant"/>
<rule ref="Generic.Metrics.CyclomaticComplexity.TooHigh">
<properties>
<property name="severity" value="0"/>
</properties>
</rule>
<rule ref="Generic">
<exclude name="Generic.Metrics.CyclomaticComplexity.TooHigh"/>
<exclude name="Generic.Commenting.DocComment.ContentAfterOpen" />
<exclude name="Generic.Commenting.DocComment.ContentBeforeClose" />
<exclude name="Generic.Commenting.DocComment.SpacingBeforeTags"/>
<exclude name="Generic.Classes.OpeningBraceSameLine.BraceOnNewLine" />
<exclude name="Generic.Classes.PropertyDeclaration.Underscore"/>
<exclude name="Generic.Files.LineEndings.InvalidEOLChar"/>
<exclude name="Generic.Files.LowercasedFilename.NotFound" />
<exclude name="Generic.Formatting.DisallowMultipleStatements.SameLine"/>
<exclude name="Generic.Formatting.MultipleStatementAlignment.NotSame"/>
<exclude name="Generic.Functions.FunctionCallArgumentSpacing.NoSpaceAfterComma"/>
<exclude name="Generic.Functions.OpeningFunctionBraceKernighanRitchie.SpaceBeforeBrace"/>
<exclude name="Generic.PHP.ClosingPHPTag.NotFound"/>
<exclude name="Generic.PHP.UpperCaseConstant.Found"/>
<exclude name="Generic.Methods.MethodDeclaration.Underscore"/>
<exclude name="Generic.NamingConventions.CamelCapsFunctionName.MethodDoubleUnderscore"/>
<exclude name="Generic.NamingConventions.CamelCapsFunctionName.ScopeNotCamelCaps"/>
<exclude name="Generic.NamingConventions.CamelCapsFunctionName.NotCamelCaps"/>
<exclude name="Generic.Functions.OpeningFunctionBraceBsdAllman.BraceOnSameLine"/>
<exclude name="Generic.WhiteSpace.DisallowTabIndent.TabsUsed"/>
<exclude name="Generic.Commenting.DocComment.ShortNotCapital"/>
<exclude name="Generic.Files.EndFileNoNewline.Found"/>
<exclude name="Generic.Files.LineLength.TooLong"/>
<exclude name="Generic.Commenting.DocComment.MissingShort"/>
<exclude name="Generic.Formatting.SpaceAfterNot.Incorrect"/>
<exclude name="Generic.Arrays.DisallowLongArraySyntax.Found"/>
<exclude name="Generic.Strings.UnnecessaryStringConcat.Found"/>
<exclude name="Generic.WhiteSpace.ScopeIndent.IncorrectExact"/>
<exclude name="Generic.Classes.OpeningBraceSameLine.SpaceBeforeBrace"/>
<exclude name="Generic.Commenting.DocComment.Empty"/>
<exclude name="Generic.Formatting.NoSpaceAfterCast.SpaceFound"/>
<exclude name="Generic.Commenting.DocComment.TagValueIndent"/>
<exclude name="Generic.Commenting.DocComment.ParamGroup"/>
<exclude name="Generic.Commenting.DocComment.NonParamGroup"/>
<exclude name="Generic.WhiteSpace.ScopeIndent.Incorrect"/>
<exclude name="Generic.WhiteSpace.DisallowTabIndent.NonIndentTabsUsed"/>
<exclude name="Generic.ControlStructures.InlineControlStructure.Discouraged"/>
<exclude name="Generic.Metrics.NestingLevel.TooHigh"/>
</rule>
<rule ref="Squiz.PHP.Eval"/>
<rule ref="Squiz.PHP.LowercasePHPFunctions"/>
<rule ref="Squiz.PHP.NonExecutableCode"/>
<rule ref="Squiz.ControlStructures.SwitchDeclaration.EmptyDefault">
<properties>
<property name="severity" value="0"/>
</properties>
</rule>
<rule ref="Squiz">
<exclude name="Squiz.NamingConventions.ValidVariableName.NotCamelCaps"/>
<exclude name="Squiz.NamingConventions.ValidVariableName.StringNotCamelCaps"/>
<exclude name="Squiz.NamingConventions.ValidFunctionName.NotCamelCaps"/>
<exclude name="Squiz.PHP.NonExecutableCode.Unreachable"/>
<exclude name="Squiz.Classes.ClassFileName.NoMatch"/>
<exclude name="Squiz.Commenting.BlockComment.WrongStart" />
<exclude name="Squiz.Commenting.ClosingDeclarationComment.Missing"/>
<exclude name="Squiz.Commenting.FunctionComment.EmptyThrows" />
<exclude name="Squiz.Commenting.FunctionComment.ScalarTypeHintMissing"/>
<exclude name="Squiz.Commenting.ClassComment.TagNotAllowed"/>
<exclude name="Squiz.Commenting.LongConditionClosingComment.Missing"/>
<exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace"/>
<exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseParenthesis"/>
<exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterKeyword"/>
<exclude name="Squiz.Classes.ValidClassName.NotCamelCaps"/>
<exclude name="Squiz.PHP.ForbiddenFunctions.Found"/>
<exclude name="Squiz.Files.FileExtension.ClassFound"/>
<exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterOpen"/>
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine"/>
<exclude name="Squiz.NamingConventions.ValidFunctionName.MethodDoubleUnderscore"/>
<exclude name="Squiz.NamingConventions.ValidVariableName.StringNotCamelCaps"/>
<exclude name="Squiz.NamingConventions.ValidVariableName.NotCamelCaps"/>
<exclude name="Squiz.NamingConventions.ValidFunctionName.PrivateNoUnderscore"/>
<exclude name="Squiz.NamingConventions.ValidFunctionName.ScopeNotCamelCaps"/>
<exclude name="Squiz.NamingConventions.ValidVariableName.PrivateNoUnderscore" />
<exclude name="Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps"/>
<exclude name="Squiz.Operators.ComparisonOperatorUsage.NotAllowed"/>
<exclude name="Squiz.Operators.ComparisonOperatorUsage.ImplicitTrue"/>
<exclude name="Squiz.Strings.ConcatenationSpacing.PaddingFound"/>
<exclude name="Squiz.Strings.DoubleQuoteUsage.ContainsVar"/>
<exclude name="Squiz.ControlStructures.SwitchDeclaration.BreakIndent"/>
<exclude name="Squiz.WhiteSpace.FunctionClosingBraceSpace.SpacingBeforeClose"/>
<exclude name="Squiz.WhiteSpace.FunctionSpacing.After"/>
<exclude name="Squiz.WhiteSpace.LogicalOperatorSpacing.NoSpaceAfter"/>
<exclude name="Squiz.Commenting.FileComment.Missing"/>
<exclude name="Squiz.Commenting.InlineComment.InvalidEndChar"/>
<exclude name="Squiz.Commenting.InlineComment.NotCapital"/>
<exclude name="Squiz.Commenting.FunctionComment.SpacingAfterParamType"/>
<exclude name="Squiz.Commenting.PostStatementComment.Found"/>
<exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpaceAfterDefault"/>
<exclude name="Squiz.Commenting.FunctionComment.IncorrectParamVarName"/>
<exclude name="Squiz.Commenting.FunctionComment.InvalidReturn"/>
<exclude name="Squiz.Commenting.FunctionComment.MissingReturn"/>
<exclude name="Squiz.Commenting.FunctionComment.MissingParamComment"/>
<exclude name="Squiz.Strings.DoubleQuoteUsage.NotRequired"/>
<exclude name="Squiz.PHP.DisallowMultipleAssignments.Found"/>
<exclude name="Squiz.Commenting.FunctionComment.ThrowsNoFullStop"/>
<exclude name="Squiz.ControlStructures.SwitchDeclaration.SpacingAfterBreak"/>
<exclude name="Squiz.Classes.ClassDeclaration.OpenBraceNewLine"/>
<exclude name="Squiz.WhiteSpace.MemberVarSpacing.Incorrect"/>
<exclude name="Squiz.Commenting.VariableComment.EmptyVar"/>
<exclude name="Squiz.WhiteSpace.FunctionSpacing.Before"/>
<exclude name="Squiz.Commenting.FunctionComment.TypeHintMissing"/>
<exclude name="Squiz.WhiteSpace.ControlStructureSpacing.SpacingAfterOpen"/>
<exclude name="Squiz.Arrays.ArrayDeclaration.ValueNoNewline"/>
<exclude name="Squiz.Arrays.ArrayDeclaration.NoCommaAfterLast"/>
<exclude name="Squiz.Arrays.ArrayDeclaration.FirstValueNoNewline"/>
<exclude name="Squiz.Arrays.ArrayDeclaration.SingleLineNotAllowed"/>
<exclude name="Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose"/>
<exclude name="Squiz.Arrays.ArrayDeclaration.ValueNotAligned"/>
<exclude name="Squiz.Commenting.InlineComment.NoSpaceBefore"/>
<exclude name="Squiz.PHP.Heredoc.NotAllowed"/>
<exclude name="Squiz.ControlStructures.ElseIfDeclaration.NotAllowed"/>
<exclude name="Squiz.PHP.CommentedOutCode.Found"/>
<exclude name="Squiz.Formatting.OperatorBracket.MissingBrackets"/>
<exclude name="Squiz.Arrays.ArrayDeclaration.CloseBraceNotAligned"/>
<exclude name="Squiz.Commenting.BlockComment.FirstLineIndent"/>
<exclude name="Squiz.Commenting.BlockComment.LastLineIndent"/>
<exclude name="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceBeforeClose"/>
<exclude name="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceAfterOpen"/>
<exclude name="Squiz.PHP.DiscouragedFunctions.Discouraged"/>
<exclude name="Squiz.Functions.GlobalFunction.Found"/>
<exclude name="Generic.NamingConventions.CamelCapsFunctionName.NotCamelCaps"/>
<exclude name="Squiz.Commenting.BlockComment.SingleLine"/>
<exclude name="Squiz.NamingConventions.ValidFunctionName.NotCamelCaps"/>
<exclude name="Squiz.Commenting.FunctionComment.ParamCommentNotCapital"/>
<exclude name="Squiz.Commenting.FunctionComment.ParamCommentFullStop"/>
<exclude name="Squiz.Arrays.ArrayDeclaration.KeyNotAligned"/>
<exclude name="Squiz.Commenting.FunctionComment.SpacingAfterParamName"/>
<exclude name="Squiz.Commenting.DocCommentAlignment.SpaceBeforeStar"/>
<exclude name="Squiz.ControlStructures.SwitchDeclaration.CaseIndent"/>
<exclude name="Squiz.Commenting.FunctionCommentThrowTag.Missing"/>
<exclude name="Squiz.ControlStructures.SwitchDeclaration.EmptyDefault"/>
<exclude name="Squiz.Objects.ObjectInstantiation.NotAssigned"/>
</rule>
<rule ref="PEAR">
<exclude name="PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps"/>
<exclude name="PEAR.NamingConventions.ValidFunctionName.NotCamelCaps"/>
<exclude name="PEAR.ControlStructures.MultiLineCondition.SpaceBeforeOpenBrace"/>
<exclude name="PEAR.ControlStructures.ControlSignature"/>
<exclude name="PEAR.Files.IncludingFile.UseInclude"/>
<exclude name="PEAR.Functions.FunctionDeclaration.BraceOnSameLine"/>
<exclude name="PEAR.NamingConventions.ValidFunctionName.MethodDoubleUnderscore"/>
<exclude name="PEAR.NamingConventions.ValidFunctionName.PrivateNoUnderscore"/>
<exclude name="PEAR.Commenting.ClassComment.InvalidPackage"/>
<exclude name="PEAR.Commenting.ClassComment.MissingCategoryTag"/>
<exclude name="PEAR.Commenting.ClassComment.MissingAuthorTag"/>
<exclude name="PEAR.Commenting.ClassComment.MissingLicenseTag"/>
<exclude name="PEAR.Commenting.ClassComment.MissingLinkTag"/>
<exclude name="PEAR.NamingConventions.ValidClassName.StartWithCapital"/>
<exclude name="PEAR.Functions.FunctionCallSignature.SpaceBeforeCloseBracket"/>
<exclude name="PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps"/>
<exclude name="PEAR.Classes.ClassDeclaration.OpenBraceNewLine"/>
<exclude name="PEAR.Commenting.FileComment.Missing"/>
<exclude name="PEAR.Functions.FunctionCallSignature.SpaceAfterOpenBracket"/>
<exclude name="PEAR.ControlStructures.MultiLineCondition.SpacingAfterOpenBrace"/>
<exclude name="PEAR.Commenting.FunctionComment.SpacingAfterParamType"/>
<exclude name="PEAR.Commenting.FunctionComment.MissingReturn"/>
<exclude name="PEAR.Commenting.FunctionComment.MissingParamComment"/>
<exclude name="PEAR.WhiteSpace.ScopeIndent.IncorrectExact"/>
<exclude name="PEAR.NamingConventions.ValidVariableName.PrivateNoUnderscore"/>
<exclude name="PEAR.ControlStructures.MultiLineCondition.NewlineBeforeOpenBrace"/>
<exclude name="PEAR.NamingConventions.ValidClassName.Invalid"/>
<exclude name="PEAR.NamingConventions.ValidFunctionName.FunctionNoCapital"/>
<exclude name="PEAR.Commenting.ClassComment.InvalidAuthors"/>
<exclude name="PEAR.Functions.FunctionCallSignature.CloseBracketLine"/>
<exclude name="PEAR.Functions.FunctionCallSignature.MultipleArguments"/>
<exclude name="PEAR.Commenting.FunctionComment.SpacingAfterParamName"/>
<exclude name="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket"/>
<exclude name="PEAR.Commenting.ClassComment.IncompleteCopyright"/>
</rule>
<rule ref="PSR1">
<exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace"/>
<exclude name="PSR1.Methods.CamelCapsMethodName.NotCamelCaps"/>
<exclude name="PSR1.Files.SideEffects"/>
</rule>
<rule ref="PSR2">
<exclude name="PSR1.Methods.CamelCapsMethodName.NotCamelCaps"/>
<exclude name="PSR2.Classes.PropertyDeclaration.Underscore"/>
<exclude name="PSR2.Methods.MethodDeclaration.Underscore"/>
<exclude name="PSR2.Namespaces.NamespaceDeclaration.BlankLineAfter"/>
<exclude name="PSR2.Methods.FunctionCallSignature.SpaceAfterOpenBracket"/>
<exclude name="PSR2.Methods.FunctionCallSignature.SpaceBeforeCloseBracket"/>
<exclude name="PSR2.Classes.ClassDeclaration.OpenBraceNewLine"/>
<exclude name="PSR2.ControlStructures.ControlStructureSpacing.SpacingAfterOpenBrace"/>
<exclude name="PSR2.ControlStructures.ControlStructureSpacing.SpaceBeforeCloseBrace"/>
<exclude name="PSR2.ControlStructures.SwitchDeclaration.BreakIndent"/>
</rule>
</ruleset>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment