Skip to content

Instantly share code, notes, and snippets.

@jacurtis
Created January 26, 2019 20:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jacurtis/1cc81e5bf4eefaebea87258445995834 to your computer and use it in GitHub Desktop.
Save jacurtis/1cc81e5bf4eefaebea87258445995834 to your computer and use it in GitHub Desktop.
The PHP Code Sniffer configuration file I use for Laravel Applications. I had to remove PSR2 code just because it causes lots of problems with magic function in route files and models and stuff. But otherwise a good basic code sniffer config to use in Laravel projects.
<?xml version="1.0"?>
<ruleset name="Laravel Standards">
<description>Laravel Coding Standards</description>
<rule ref="Generic.Classes.DuplicateClassName"/>
<rule ref="Generic.CodeAnalysis.EmptyStatement"/>
<rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop"/>
<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.DisallowMultipleStatements"/>
<rule ref="Generic.Formatting.MultipleStatementAlignment">
<properties>
<property name="error" value="false"/>
</properties>
</rule>
<rule ref="Generic.Formatting.NoSpaceAfterCast"/>
<rule ref="Generic.Functions.CallTimePassByReference"/>
<rule ref="Generic.Functions.FunctionCallArgumentSpacing"/>
<rule ref="Generic.Metrics.NestingLevel"/>
<rule ref="Generic.NamingConventions.ConstructorName"/>
<rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
<rule ref="Generic.NamingConventions.CamelCapsFunctionName"/>
<rule ref="Generic.PHP.DeprecatedFunctions"/>
<rule ref="Generic.PHP.ForbiddenFunctions"/>
<rule ref="Generic.PHP.LowerCaseConstant"/>
<rule ref="Generic.Strings.UnnecessaryStringConcat"/>
<rule ref="PEAR.Classes.ClassDeclaration">
<properties>
<property name="indent" value="2"/>
</properties>
</rule>
<rule ref="PEAR.NamingConventions.ValidClassName"/>
<rule ref="PEAR.NamingConventions.ValidFunctionName"/>
<file>app</file>
<file>config</file>
<file>public</file>
<file>resources</file>
<file>routes</file>
<file>tests</file>
<exclude-pattern>*/database/*</exclude-pattern>
<exclude-pattern>*/cache/*</exclude-pattern>
<exclude-pattern>*/*.js</exclude-pattern>
<exclude-pattern>*/*.css</exclude-pattern>
<exclude-pattern>*/*.xml</exclude-pattern>
<exclude-pattern>*/*.blade.php</exclude-pattern>
<exclude-pattern>*/autoload.php</exclude-pattern>
<exclude-pattern>*/storage/*</exclude-pattern>
<exclude-pattern>*/docs/*</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern>*/migrations/*</exclude-pattern>
<exclude-pattern>*/config/*</exclude-pattern>
<exclude-pattern>*/public/index.php</exclude-pattern>
<exclude-pattern>*/*.blade.php</exclude-pattern>
<exclude-pattern>*/Middleware/*</exclude-pattern>
<exclude-pattern>*/Console/Kernel.php</exclude-pattern>
<exclude-pattern>*/Exceptions/Handler.php</exclude-pattern>
<exclude-pattern>*/Http/Kernel.php</exclude-pattern>
<exclude-pattern>*/Providers/*</exclude-pattern>
<arg name="colors"/>
<arg value="spvnl"/>
<ini name="memory_limit" value="128M"/>
</ruleset>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment