Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="UTF-8"?>
- <ruleset name="Hyra">
- <description>
- Extends PSR2 which extends PSR1.
- Built with help from the PHP Coding Standards Generator https://edorian.github.io/php-coding-standard-generator/#phpcs
- The Generator doesn't show every option, you'll need to check the PHP_Codesniffer repo to find all the sniffs and their options:
- https://github.com/squizlabs/PHP_CodeSniffer
- </description>
- <exclude-pattern>src/Migrations/*</exclude-pattern>
- <arg name="tab-width" value="4" />
- <rule ref="PSR2" />
- <rule ref="Generic">
- <!-- Short array syntax is da bomb -->
- <exclude name="Generic.Arrays.DisallowShortArraySyntax" />
- <!-- Need to allow unused parameters for overriding/implementing methods from parent classes -->
- <exclude name="Generic.CodeAnalysis.UnusedFunctionParameter" />
- <!-- Class opening braces should be on the next line -->
- <exclude name="Generic.Classes.OpeningBraceSameLine.BraceOnNewLine" />
- <!-- Complains about @var comments on instance variables -->
- <exclude name="Generic.Commenting.DocComment.MissingShort" />
- <!-- Complains about single line `/** @var */` comments on instance variables -->
- <exclude name="Generic.Commenting.DocComment.ContentAfterOpen" />
- <exclude name="Generic.Commenting.DocComment.ContentBeforeClose" />
- <exclude name="Generic.Commenting.DocComment.SpacingBeforeTags" />
- <!-- Complains about docblocks with Doctrine annotations -->
- <exclude name="Generic.Commenting.DocComment.TagValueIndent" />
- <!-- Filenames should not be lower case -->
- <exclude name="Generic.Files.LowercasedFilename" />
- <!-- Files should end with a newline -->
- <exclude name="Generic.Files.EndFileNoNewline" />
- <!-- Symfony says we want a space after casting -->
- <exclude name="Generic.Formatting.NoSpaceAfterCast" />
- <!-- Handled by php-cs-fixer -->
- <exclude name="Generic.Formatting.MultipleStatementAlignment" />
- <!-- This is extended by Squiz to handle multi line function calls -->
- <exclude name="Generic.Functions.OpeningFunctionBraceBsdAllman.BraceOnSameLine" />
- <!-- We don't want the opening curly brace on the same line as the function definition -->
- <exclude name="Generic.Functions.OpeningFunctionBraceKernighanRitchie.BraceOnNewLine" />
- <!-- We want lower case for true, false and null -->
- <exclude name="Generic.PHP.UpperCaseConstant" />
- <!-- Opening PHP tags don't need closing PHP tags -->
- <exclude name="Generic.PHP.ClosingPHPTag" />
- <!-- Spaces, not tabs. We're not animals -->
- <exclude name="Generic.WhiteSpace.DisallowSpaceIndent" />
- </rule>
- <rule ref="MySource">
- <!-- Functions should be allowed to return the result of another function -->
- <exclude name="MySource.PHP.ReturnFunctionValue" />
- <!-- Functions don't need comments if they're typed properly -->
- <exclude name="MySource.Commenting.FunctionComment" />
- <!-- We shouldn't be including anything, that's for the autoloader -->
- <exclude name="MySource.Channels.IncludeSystem" />
- </rule>
- <rule ref="PEAR">
- <!-- The PEAR standard for comments is crazy -->
- <exclude name="PEAR.Commenting.ClassComment" />
- <exclude name="PEAR.Commenting.FileComment" />
- <exclude name="PEAR.Commenting.FunctionComment" />
- <!-- Use PSR-2 function call signature -->
- <exclude name="PEAR.Functions.FunctionCallSignature" />
- <!-- Private variables shouldn't have an underscore -->
- <exclude name="PEAR.NamingConventions.ValidVariableName.PrivateNoUnderscore" />
- <!-- Private functions shouldn't have an underscore -->
- <exclude name="PEAR.NamingConventions.ValidFunctionName.PrivateNoUnderscore" />
- <!-- PEAR switch/case indentation sucks and conflicts with generic -->
- <exclude name="PEAR.WhiteSpace.ScopeIndent.IncorrectExact"/>
- </rule>
- <rule ref="Squiz">
- <!-- Allow arrays with single value to be multi-line -->
- <exclude name="Squiz.Arrays.ArrayDeclaration.MultiLineNotAllowed" />
- <!-- Handled better by cs-fixer -->
- <exclude name="Squiz.Arrays.ArrayDeclaration.DoubleArrowNotAligned" />
- <!-- Allow `/** @var */` comments -->
- <exclude name="Squiz.Commenting.BlockComment.WrongStart" />
- <exclude name="Squiz.Commenting.InlineComment.DocBlock" />
- <!-- Classes don't need comments -->
- <exclude name="Squiz.Commenting.ClassComment" />
- <!-- Files don't need comments -->
- <exclude name="Squiz.Commenting.FileComment" />
- <!-- Functions don't need comments if they're typed properly -->
- <exclude name="Squiz.Commenting.FunctionComment" />
- <!-- Sometimes you want a comment at the end of a line -->
- <exclude name="Squiz.Commenting.PostStatementComment.Found" />
- <!-- If the inline if needs brackets, it shouldn't be an inline if -->
- <exclude name="Squiz.ControlStructures.InlineIfDeclaration.NoBrackets" />
- <!-- No need to comment for closed functions, WTF? -->
- <exclude name="Squiz.Commenting.ClosingDeclarationComment" />
- <!-- Complains about Doctrine annotations -->
- <exclude name="Squiz.Commenting.VariableComment.TagNotAllowed" />
- <!-- Inline comments don't need to end with full-stops, exclamation marks or question marks -->
- <exclude name="Squiz.Commenting.InlineComment.InvalidEndChar" />
- <!-- We don't want classes and interfaces in ".inc" files -->
- <exclude name="Squiz.Files.FileExtension" />
- <!-- Missing brackets are allowed, difficulty to understand should be picked up in PR -->
- <exclude name="Squiz.Formatting.OperatorBracket" />
- <!-- Private variables shouldn't have an underscore -->
- <exclude name="Squiz.NamingConventions.ValidVariableName.PrivateNoUnderscore" />
- <!-- Private functions shouldn't have an underscore -->
- <exclude name="Squiz.NamingConventions.ValidFunctionName.PrivateNoUnderscore" />
- <!-- Should be able to pass new object directly into function call -->
- <exclude name="Squiz.Objects.ObjectInstantiation.NotAssigned" />
- <!-- cs-fixer picks up implicit true better -->
- <exclude name="Squiz.Operators.ComparisonOperatorUsage.ImplicitTrue" />
- <!-- We want to be able to assign comparisons: $permission = $isAdmin || $canView -->
- <exclude name="Squiz.PHP.DisallowComparisonAssignment" />
- <!-- Boolean conditions in a return are fine -->
- <exclude name="Squiz.PHP.DisallowBooleanStatement" />
- <!-- We want to use ternary's sometimes -->
- <exclude name="Squiz.PHP.DisallowInlineIf" />
- <!-- Complains about semicolons on the next line for multiline function calls -->
- <exclude name="Squiz.WhiteSpace.SemicolonSpacing" />
- <!-- Don't need a space before closing curly's -->
- <exclude name="Squiz.WhiteSpace.FunctionClosingBraceSpace.SpacingBeforeClose" />
- <!-- Don't worry about function spacing -->
- <exclude name="Squiz.WhiteSpace.FunctionSpacing" />
- <!-- This argues with php-cs-fixer about int vs integer -->
- <exclude name="Squiz.Commenting.VariableComment.IncorrectVarType" />
- <!-- This is the indentation of break in a switch and conflicts with other rules -->
- <exclude name="Squiz.ControlStructures.SwitchDeclaration.BreakIndent" />
- <!-- We don't want to add //end switch to the end of long switch statements -->
- <exclude name="Squiz.Commenting.LongConditionClosingComment.Missing" />
- </rule>
- <rule ref="Zend">
- <!-- Zend naming conventions are crazy -->
- <exclude name="Zend.NamingConventions" />
- </rule>
- <!-- Special rules go down the bottom, to make sure they're overriding all of the above -->
- <!-- Generic -->
- <!-- Function name must be camel case -->
- <rule ref="Generic.NamingConventions.CamelCapsFunctionName">
- <properties>
- <!-- Allow 2 capitals next to each other -->
- <property name="strict" value="false" />
- </properties>
- </rule>
- <!-- PSR-2 says no hard limit, soft limit 120 -->
- <rule ref="Generic.Files.LineLength">
- <properties>
- <property name="lineLimit" value="120"/>
- <property name="absoluteLineLimit" value="0"/>
- </properties>
- </rule>
- <!-- Squiz -->
- <!-- Object operators (->) are allowed to be on the next line -->
- <rule ref="Squiz.WhiteSpace.ObjectOperatorSpacing">
- <properties>
- <property name="ignoreNewlines" value="true"/>
- </properties>
- </rule>
- <!-- No new lines required before the first instance variable -->
- <rule ref="Squiz.WhiteSpace.MemberVarSpacing">
- <properties>
- <property name="spacingBeforeFirst" value="0"/>
- </properties>
- </rule>
- </ruleset>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement