Skip to content

Instantly share code, notes, and snippets.

@nelson6e65
Last active November 4, 2022 20:23
Show Gist options
  • Save nelson6e65/fef49f4ea2e077bf22f9d6d060d11904 to your computer and use it in GitHub Desktop.
Save nelson6e65/fef49f4ea2e077bf22f9d6d060d11904 to your computer and use it in GitHub Desktop.
PHP CodeSniffer config for Laravel
<?xml version="1.0" encoding="UTF-8" ?>
<ruleset name="Default">
<description>Coding standard configuration.</description>
<rule ref="PSR12" />
<rule ref="PEAR.Functions.ValidDefaultValue" />
<rule ref="PEAR.Commenting.InlineComment" />
<rule ref="Squiz.Operators.ValidLogicalOperators" />
<rule ref="Squiz.PHP.CommentedOutCode">
<properties>
<property name="maxPercentage" value="50" />
</properties>
</rule>
<rule ref="Squiz.PHP.LowercasePHPFunctions" />
<rule ref="Squiz.PHP.NonExecutableCode" />
<rule ref="Squiz.Strings.DoubleQuoteUsage" />
<rule ref="Squiz.WhiteSpace.SemicolonSpacing" />
<rule ref="Squiz.Arrays.ArrayDeclaration">
<exclude name="Squiz.Arrays.ArrayDeclaration.ValueNotAligned" />
<exclude name="Squiz.Arrays.ArrayDeclaration.KeyNotAligned" />
<!-- <exclude name="Squiz.Arrays.ArrayDeclaration.DoubleArrowNotAligned" /> -->
<!-- <exclude name="Squiz.Arrays.ArrayDeclaration.ValueNotAligned" /> -->
<exclude name="Squiz.Arrays.ArrayDeclaration.CloseBraceNotAligned" />
<exclude name="Squiz.Arrays.ArrayDeclaration.ValueNoNewline" />
<exclude name="Squiz.Arrays.ArrayDeclaration.MultiLineNotAllowed" />
<exclude name="Squiz.Arrays.ArrayDeclaration.SingleLineNotAllowed" />
</rule>
<rule ref="Generic.Arrays.ArrayIndent" />
<rule ref="Generic.CodeAnalysis.AssignmentInCondition" />
<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.UnnecessaryFinalModifier" />
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter" />
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod" />
<rule ref="Generic.Formatting.MultipleStatementAlignment" />
<rule ref="Generic.NamingConventions.CamelCapsFunctionName">
<exclude-pattern>tests/</exclude-pattern>
</rule>
<rule ref="Generic.NamingConventions.ConstructorName" />
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
<property name="indent" value="4" />
<property name="exact" value="true" />
</properties>
</rule>
<rule ref="PSR1.Classes.ClassDeclaration.MissingNamespace">
<exclude-pattern>database/</exclude-pattern>
</rule>
<!-- <config name="encoding" value="utf-8"/> -->
<exclude-pattern type="relative">^.git/*</exclude-pattern>
<exclude-pattern type="relative">^node_modules/*</exclude-pattern>
<exclude-pattern type="relative">^bootstrap/cache/*</exclude-pattern>
<exclude-pattern type="relative">^public/*</exclude-pattern>
<exclude-pattern type="relative">^resources/*</exclude-pattern>
<exclude-pattern type="relative">^storage/*</exclude-pattern>
<exclude-pattern type="relative">^vendor/*</exclude-pattern>
<exclude-pattern type="relative">^_ide_helper.php</exclude-pattern>
<arg name="colors" />
<arg name="extensions" value="php" />
<arg name="encoding" value="utf-8" />
</ruleset>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment