Last active
February 20, 2026 10:50
-
-
Save JohnnyWalkerDigital/aca5ee0d21c12d31440327079ae40c23 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0"?> | |
| <ruleset name="PHP_CodeSniffer"> | |
| <description>PSR-12 CodeSniffer configuration for Laravel projects</description> | |
| <!-- Base --> | |
| <rule ref="PSR12"/> | |
| <!-- Disallow dangerous / debug functions --> | |
| <rule ref="Generic.PHP.ForbiddenFunctions"> | |
| <properties> | |
| <property name="forbiddenFunctions" type="array"> | |
| <element key="eval" value="null"/> | |
| <element key="die" value="null"/> | |
| <element key="exit" value="null"/> | |
| <element key="dd" value="null"/> | |
| <element key="dump" value="null"/> | |
| <element key="var_dump" value="null"/> | |
| <element key="print_r" value="null"/> | |
| <element key="sizeof" value="count"/> | |
| <element key="delete" value="unset"/> | |
| <element key="print" value="echo"/> | |
| <element key="create_function" value="null"/> | |
| </property> | |
| </properties> | |
| </rule> | |
| <!-- Complexity --> | |
| <rule ref="Generic.Metrics.CyclomaticComplexity"> | |
| <properties> | |
| <property name="complexity" value="10"/> | |
| </properties> | |
| </rule> | |
| <rule ref="Generic.Metrics.NestingLevel"> | |
| <properties> | |
| <property name="nestingLevel" value="3"/> | |
| <property name="absoluteNestingLevel" value="4"/> | |
| </properties> | |
| </rule> | |
| <!-- Style/Naming --> | |
| <rule ref="Squiz.NamingConventions.ValidVariableName.NotCamelCaps"/> | |
| <rule ref="Squiz.NamingConventions.ValidVariableName.StringNotCamelCaps"/> | |
| <rule ref="Squiz.Strings.DoubleQuoteUsage.ContainsVar"> | |
| <type>warning</type> | |
| </rule> | |
| <rule ref="Squiz.Strings.DoubleQuoteUsage.NotRequired"/> | |
| <rule ref="PSR1.Methods.CamelCapsMethodName"> | |
| <exclude-pattern>tests/*</exclude-pattern> | |
| </rule> | |
| <rule ref="SlevomatCodingStandard.Arrays.TrailingArrayComma"/> | |
| <rule ref="SlevomatCodingStandard.Arrays.ArrayAccess"/> | |
| <rule ref="SlevomatCodingStandard.Arrays.DisallowImplicitArrayCreation"/> | |
| <rule ref="SlevomatCodingStandard.Arrays.MultiLineArrayEndBracketPlacement"/> | |
| <rule ref="SlevomatCodingStandard.Arrays.TrailingArrayComma"/> | |
| <rule ref="SlevomatCodingStandard.Attributes.AttributeAndTargetSpacing"/> | |
| <rule ref="SlevomatCodingStandard.Attributes.DisallowAttributesJoining"/> | |
| <rule ref="SlevomatCodingStandard.Attributes.DisallowMultipleAttributesPerLine"/> | |
| <rule ref="SlevomatCodingStandard.Attributes.RequireAttributeAfterDocComment"/> | |
| <rule ref="SlevomatCodingStandard.Classes.BackedEnumTypeSpacing"> | |
| <properties> | |
| <property name="spacesCountBeforeColon" value="0" /> | |
| <property name="spacesCountBeforeType" value="1" /> | |
| </properties> | |
| </rule> | |
| <rule ref="SlevomatCodingStandard.Classes.ClassConstantVisibility" /> | |
| <rule ref="SlevomatCodingStandard.Classes.ClassLength"> | |
| <exclude-pattern>tests/*</exclude-pattern> | |
| </rule> | |
| <rule ref="SlevomatCodingStandard.Classes.ClassMemberSpacing"> | |
| <properties> | |
| <property name="linesCountBetweenMembers" value="1" /> | |
| </properties> | |
| </rule> | |
| <rule ref="SlevomatCodingStandard.Classes.ClassStructure"> | |
| <properties> | |
| <property name="methodGroups" type="array"> | |
| <element key="inject method" value="inject"/> | |
| <element key="inject methods" value="inject*"/> | |
| <element key="laravel special" value="getRouteKeyName, authorize, handle" /> | |
| <element key="laravel relationships" value="@relation"/> | |
| <element key="laravel scopes" value="#Illuminate\Database\Eloquent\Attributes\Scope"/> | |
| <element key="laravel attributes" value="@attribute"/> | |
| <element key="phpunit before" value="setUp, @before, #PHPUnit\Framework\Attributes\Before"/> | |
| <element key="phpunit data provider" value="*DataProvider"/> | |
| </property> | |
| <property name="groups" type="array"> | |
| <element value="uses"/> | |
| <element value="enum cases"/> | |
| <element value="public constants"/> | |
| <element value="protected constants"/> | |
| <element value="private constants"/> | |
| <element value="static properties"/> | |
| <element value="public properties"/> | |
| <element value="protected properties"/> | |
| <element value="private properties"/> | |
| <!-- Constructor is first --> | |
| <element value="constructor"/> | |
| <element value="static constructors"/> | |
| <element value="destructor"/> | |
| <!-- Then inject method followed by all other inject methods based on their prefix using a custom method group regardless their visibility --> | |
| <element value="inject method"/> | |
| <element value="inject methods"/> | |
| <!-- PHPUnit's before hooks are placed before all other public methods using a custom method group --> | |
| <element value="phpunit before"/> | |
| <element value="laravel special"/> | |
| <element value="laravel relationships"/> | |
| <element value="laravel scopes"/> | |
| <element value="laravel attributes"/> | |
| <!-- Then all public methods, followed by protected/private methods --> | |
| <element value="all public methods"/> | |
| <element value="all protected methods"/> | |
| <element value="all private methods"/> | |
| <!-- PHPUnit's data providers are placed after all other public methods using a custom method group --> | |
| <element value="phpunit data provider"/> | |
| <!-- Magic methods are last --> | |
| <element value="magic methods"/> | |
| </property> | |
| </properties> | |
| </rule> | |
| <rule ref="SlevomatCodingStandard.Classes.DisallowLateStaticBindingForConstants" /> | |
| <rule ref="SlevomatCodingStandard.Classes.DisallowMultiConstantDefinition" /> | |
| <rule ref="SlevomatCodingStandard.Classes.DisallowMultiPropertyDefinition" /> | |
| <rule ref="SlevomatCodingStandard.Classes.MethodSpacing"> | |
| <properties> | |
| <property name="minLinesCount" value="1" /> | |
| <property name="maxLinesCount" value="1" /> | |
| </properties> | |
| </rule> | |
| <rule ref="SlevomatCodingStandard.Classes.PropertyDeclaration" /> | |
| <rule ref="SlevomatCodingStandard.Classes.UselessLateStaticBinding" /> | |
| <rule ref="SlevomatCodingStandard.ControlStructures.AssignmentInCondition" /> | |
| <rule ref="SlevomatCodingStandard.ControlStructures.BlockControlStructureSpacing"> | |
| <properties> | |
| <property name="linesCountBefore" value="1" /> | |
| <property name="linesCountAfter" value="1" /> | |
| </properties> | |
| </rule> | |
| <rule ref="SlevomatCodingStandard.ControlStructures.DisallowContinueWithoutIntegerOperandInSwitch" /> | |
| <rule ref="SlevomatCodingStandard.ControlStructures.DisallowEmpty"/> | |
| <rule ref="SlevomatCodingStandard.ControlStructures.DisallowYodaComparison" /> | |
| <rule ref="SlevomatCodingStandard.ControlStructures.UselessIfConditionWithReturn" /> | |
| <rule ref="SlevomatCodingStandard.ControlStructures.UselessTernaryOperator" /> | |
| <rule ref="SlevomatCodingStandard.Functions.DisallowEmptyFunction" /> | |
| <rule ref="SlevomatCodingStandard.Functions.FunctionLength"> | |
| <exclude-pattern>tests/*</exclude-pattern> | |
| <properties> | |
| <property name="maxLinesLength" value="100" /> | |
| </properties> | |
| </rule> | |
| <rule ref="SlevomatCodingStandard.Functions.NamedArgumentSpacing" /> | |
| <rule ref="SlevomatCodingStandard.Functions.StrictCall" /> | |
| <rule ref="SlevomatCodingStandard.Functions.UnusedInheritedVariablePassedToClosure" /> | |
| <rule ref="SlevomatCodingStandard.Functions.UnusedParameter"> | |
| <properties> | |
| <property name="allowedParameterPatterns" type="array"> | |
| <element value="/^attribute$/" /> | |
| <element value="/^attributes$/" /> | |
| <element value="/^value$/" /> | |
| <element value="/^exceptions$/" /> | |
| <element value="/^user$/" /> | |
| </property> | |
| </properties> | |
| </rule> | |
| <rule ref="SlevomatCodingStandard.Functions.UselessParameterDefaultValue" /> | |
| <rule ref="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses" /> | |
| <rule ref="SlevomatCodingStandard.Namespaces.DisallowGroupUse" /> | |
| <rule ref="SlevomatCodingStandard.Namespaces.UseDoesNotStartWithBackslash" /> | |
| <rule ref="SlevomatCodingStandard.Namespaces.UseFromSameNamespace" /> | |
| <rule ref="SlevomatCodingStandard.Namespaces.UseSpacing"> | |
| <properties> | |
| <property name="linesCountBeforeFirstUse" value="1" /> | |
| <property name="linesCountBetweenUseTypes" value="0" /> | |
| <property name="linesCountAfterLastUse" value="1" /> | |
| </properties> | |
| </rule> | |
| <rule ref="SlevomatCodingStandard.Operators.DisallowEqualOperators" /> | |
| <rule ref="SlevomatCodingStandard.PHP.TypeCast" /> | |
| <rule ref="SlevomatCodingStandard.PHP.UselessParentheses" /> | |
| <rule ref="SlevomatCodingStandard.PHP.UselessSemicolon" /> | |
| <rule ref="SlevomatCodingStandard.TypeHints.ClassConstantTypeHint" /> | |
| <rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes"> | |
| <exclude-pattern>tests/*</exclude-pattern> | |
| <properties> | |
| <property name="linesCountBeforeDeclare" value="1" /> | |
| <property name="linesCountAfterDeclare" value="1" /> | |
| <property name="spacesCountAroundEqualsSign" value="0" /> | |
| </properties> | |
| </rule> | |
| <rule ref="SlevomatCodingStandard.TypeHints.DisallowArrayTypeHintSyntax" /> | |
| <rule ref="SlevomatCodingStandard.TypeHints.DNFTypeHintFormat"> | |
| <properties> | |
| <property name="withSpacesAroundOperators" value="no" /> | |
| <property name="withSpacesInsideParentheses" value="no" /> | |
| <property name="nullPosition" value="last" /> | |
| </properties> | |
| </rule> | |
| <rule ref="SlevomatCodingStandard.TypeHints.LongTypeHints" /> | |
| <rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint" /> | |
| <rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHintSpacing" /> | |
| <rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint" /> | |
| <rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing" /> | |
| <rule ref="SlevomatCodingStandard.TypeHints.UselessConstantTypeHint" /> | |
| <rule ref="SlevomatCodingStandard.Variables.DisallowSuperGlobalVariable" /> | |
| <rule ref="SlevomatCodingStandard.Variables.DisallowVariableVariable" /> | |
| <rule ref="SlevomatCodingStandard.Variables.DuplicateAssignmentToVariable" /> | |
| <rule ref="SlevomatCodingStandard.Variables.UnusedVariable" /> | |
| <rule ref="SlevomatCodingStandard.Variables.UselessVariable" /> | |
| <file>app</file> | |
| <file>bootstrap</file> | |
| <file>config</file> | |
| <file>database</file> | |
| <file>resources</file> | |
| <file>routes</file> | |
| <file>tests</file> | |
| <exclude-pattern>bootstrap/cache/*</exclude-pattern> | |
| <exclude-pattern>bootstrap/autoload.php</exclude-pattern> | |
| <exclude-pattern>*/migrations/*</exclude-pattern> | |
| <exclude-pattern>*/seeds/*</exclude-pattern> | |
| <exclude-pattern>*.blade.php</exclude-pattern> | |
| <exclude-pattern>*.js</exclude-pattern> | |
| <!-- Event progression --> | |
| <arg name="colors"/> | |
| <arg value="p"/> | |
| <!-- <arg value="s"/> If you need the specific rule displayed --> | |
| </ruleset> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment