Skip to content

Instantly share code, notes, and snippets.

Created June 1, 2014 19:41
Show Gist options
  • Save mhujer/1e93face4a9d13648c91 to your computer and use it in GitHub Desktop.
Save mhujer/1e93face4a9d13648c91 to your computer and use it in GitHub Desktop. PHP_CodeSniffer ruleset
<?xml version="1.0"?>
<ruleset name="Shopio Custom Standard">
<rule ref="Zend" />
<!-- Zend includes those
<rule ref="Generic.Functions.FunctionCallArgumentSpacing"/>
<rule ref="Generic.Functions.OpeningFunctionBraceBsdAllman"/>
<rule ref="Generic.PHP.DisallowShortOpenTag"/>
<rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
<rule ref="PEAR.Classes.ClassDeclaration"/>
<rule ref="PEAR.ControlStructures.ControlSignature"/>
<rule ref="PEAR.Functions.FunctionCallSignature"/>
<rule ref="PEAR.Functions.ValidDefaultValue"/>
<rule ref="PEAR.WhiteSpace.ScopeClosingBrace"/>
<rule ref="Squiz.Functions.GlobalFunction"/>
<rule ref="Generic.Files.LineEndings"/>
<rule ref="Generic.Files.LineLength">
<property name="lineLimit" value="250" />
<property name="absoluteLineLimit" value="300" />
<rule ref="PEAR.Functions.FunctionCallSignature.CloseBracketLine">
<rule ref="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket">
<rule ref="Generic.PHP.DisallowShortOpenTag.EchoFound">
<rule ref="Generic.PHP.NoSilencedErrors" />
<!-- PSR1 -->
<rule ref="Generic.Files.ByteOrderMark" />
<rule ref="Generic.NamingConventions.UpperCaseConstantName" />
<!-- PSR2 -->
<!-- PHP keywords MUST be in lower case. -->
<rule ref="Generic.PHP.LowerCaseKeyword" />
<!-- The PHP constants true, false, and null MUST be in lower case. -->
<rule ref="Generic.PHP.LowerCaseConstant" />
<!-- Visibility MUST be declared on all methods. -->
<rule ref="Squiz.Scope.MethodScope" />
<rule ref="Squiz.WhiteSpace.ScopeKeywordSpacing" />
<!-- Method names MUST NOT be declared with a space after the method name. The opening brace MUST go on its own line, and the closing brace MUST go on the next line following the body. There MUST NOT be a space after the opening parenthesis, and there MUST NOT be a space before the closing parenthesis. -->
<rule ref="Squiz.Functions.FunctionDeclaration" />
<rule ref="Squiz.Functions.LowercaseFunctionKeywords" />
<rule ref="Generic.Functions.FunctionCallArgumentSpacing" />
<!-- Method arguments with default values MUST go at the end of the argument list. -->
<rule ref="PEAR.Functions.ValidDefaultValue" />
<!-- The general style rules for control structures are as follows:
There MUST be one space after the control structure keyword
There MUST NOT be a space after the opening parenthesis
There MUST NOT be a space before the closing parenthesis
There MUST be one space between the closing parenthesis and the opening brace
The structure body MUST be indented once
The closing brace MUST be on the next line after the body -->
<rule ref="Squiz.ControlStructures.ControlSignature">
<property name="ignoreComments" value="true" />
<rule ref="Squiz.WhiteSpace.ScopeClosingBrace" />
<rule ref="Squiz.WhiteSpace.FunctionOpeningBraceSpace" />
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration" />
<rule ref="Squiz.ControlStructures.ForLoopDeclaration" />
<rule ref="Squiz.ControlStructures.LowercaseDeclaration" />
<rule ref="PSR2.ControlStructures.ElseIfDeclaration" />
<rule ref="PSR2.Files.EndFileNewline" />
<!-- The Squiz coding standard: -->
<!-- <rule ref="Generic.Commenting.Todo" /> uncomment later -->
<rule ref="Generic.ControlStructures.InlineControlStructure" />
<rule ref="Generic.Formatting.DisallowMultipleStatements" />
<rule ref="Generic.Formatting.SpaceAfterCast" />
<rule ref="Generic.NamingConventions.ConstructorName" />
<rule ref="Generic.PHP.DeprecatedFunctions" />
<rule ref="Generic.Strings.UnnecessaryStringConcat" />
<rule ref="Generic.WhiteSpace.ScopeIndent" />
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace" />
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EndLine"> <!-- enable later -->
<rule ref="Squiz.Arrays.ArrayBracketSpacing" />
<rule ref="Squiz.WhiteSpace.SemicolonSpacing" />
<!-- OTHERS -->
<rule ref="Squiz.PHP.GlobalKeyword" />
<rule ref="Squiz.PHP.LowercasePHPFunctions" />
<!-- <rule ref="Squiz.PHP.NonExecutableCode"/> enable later -->
<rule ref="Generic.PHP.ForbiddenFunctions" />
<!-- enable later
<rule ref="Generic.Metrics.NestingLevel"/>
<rule ref="Generic.Metrics.CyclomaticComplexity"/>
<rule ref="Generic.CodeAnalysis.EmptyStatement" />
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod" />
<rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop" />
<rule ref="Generic.CodeAnalysis.JumbledIncrementer" />
<rule ref="Generic.CodeAnalysis.UnconditionalIfStatement" />
<rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier" />
<rule ref="PEAR.Commenting.InlineComment" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment