Skip to content

Instantly share code, notes, and snippets.

@dakira
Created April 16, 2023 18:11
Show Gist options
  • Save dakira/97d456d1d67ba42359a18bd1f2ddc92b to your computer and use it in GitHub Desktop.
Save dakira/97d456d1d67ba42359a18bd1f2ddc92b to your computer and use it in GitHub Desktop.
All phpcs code sniffs

PEAR.Classes.ClassDeclaration

Checks the declaration of the class is correct.

declared in PHP_CodeSniffer\Standards\PEAR\Sniffs\Classes\ClassDeclarationSniff

PEAR.WhiteSpace.ObjectOperatorIndent

Checks that object operators are indented correctly.

declared in PHP_CodeSniffer\Standards\PEAR\Sniffs\WhiteSpace\ObjectOperatorIndentSniff

PEAR.WhiteSpace.ScopeClosingBrace

Checks that the closing braces of scopes are aligned correctly.

declared in PHP_CodeSniffer\Standards\PEAR\Sniffs\WhiteSpace\ScopeClosingBraceSniff

PEAR.Formatting.MultiLineAssignment

If an assignment goes over two lines, ensure the equal sign is indented.

declared in PHP_CodeSniffer\Standards\PEAR\Sniffs\Formatting\MultiLineAssignmentSniff

PEAR.Files.IncludingFile

Ensure include_once is used in conditional situations and require_once is used elsewhere.

declared in PHP_CodeSniffer\Standards\PEAR\Sniffs\Files\IncludingFileSniff

PEAR.Functions.FunctionCallSignature

Ensures function calls are formatted correctly.

declared in PHP_CodeSniffer\Standards\PEAR\Sniffs\Functions\FunctionCallSignatureSniff

PEAR.Functions.FunctionDeclaration

Ensure single and multi-line function declarations are defined correctly.

declared in PHP_CodeSniffer\Standards\PEAR\Sniffs\Functions\FunctionDeclarationSniff

PEAR.Functions.ValidDefaultValue

Ensures function params with default values are at the end of the declaration.

declared in PHP_CodeSniffer\Standards\PEAR\Sniffs\Functions\ValidDefaultValueSniff

PEAR.ControlStructures.MultiLineCondition

Ensure multi-line IF conditions are defined correctly.

declared in PHP_CodeSniffer\Standards\PEAR\Sniffs\ControlStructures\MultiLineConditionSniff

PEAR.NamingConventions.ValidClassName

Ensures class and interface names start with a capital letter and use _ separators.

declared in PHP_CodeSniffer\Standards\PEAR\Sniffs\NamingConventions\ValidClassNameSniff

PEAR.Commenting.FunctionComment

Parses and verifies the doc comments for functions.

declared in PHP_CodeSniffer\Standards\PEAR\Sniffs\Commenting\FunctionCommentSniff

PEAR.Commenting.InlineComment

Checks that no Perl-style comments are used.

declared in PHP_CodeSniffer\Standards\PEAR\Sniffs\Commenting\InlineCommentSniff

PEAR.Commenting.FileComment

Parses and verifies the doc comments for files.

declared in PHP_CodeSniffer\Standards\PEAR\Sniffs\Commenting\FileCommentSniff

Zend.Files.ClosingTag

Checks that the file does not end with a closing tag.

declared in PHP_CodeSniffer\Standards\Zend\Sniffs\Files\ClosingTagSniff

Zend.Debug.CodeAnalyzer

Runs the Zend Code Analyzer (from Zend Studio) on the file.

declared in PHP_CodeSniffer\Standards\Zend\Sniffs\Debug\CodeAnalyzerSniff

PSR2.Methods.FunctionClosingBrace

Checks that the closing brace of a function goes directly after the body.

declared in PHP_CodeSniffer\Standards\PSR2\Sniffs\Methods\FunctionClosingBraceSniff

PSR2.Namespaces.UseDeclaration

Ensures USE blocks are declared correctly.

declared in PHP_CodeSniffer\Standards\PSR2\Sniffs\Namespaces\UseDeclarationSniff

PSR2.Namespaces.NamespaceDeclaration

Ensures namespaces are declared correctly.

declared in PHP_CodeSniffer\Standards\PSR2\Sniffs\Namespaces\NamespaceDeclarationSniff

PSR2.Files.ClosingTag

Checks that the file does not end with a closing tag.

declared in PHP_CodeSniffer\Standards\PSR2\Sniffs\Files\ClosingTagSniff

PSR2.Files.EndFileNewline

Ensures the file ends with a newline character.

declared in PHP_CodeSniffer\Standards\PSR2\Sniffs\Files\EndFileNewlineSniff

PSR2.ControlStructures.ControlStructureSpacing

Checks that control structures have the correct spacing around brackets.

declared in PHP_CodeSniffer\Standards\PSR2\Sniffs\ControlStructures\ControlStructureSpacingSniff

PSR2.ControlStructures.SwitchDeclaration

Ensures all switch statements are defined correctly.

declared in PHP_CodeSniffer\Standards\PSR2\Sniffs\ControlStructures\SwitchDeclarationSniff

PSR2.ControlStructures.ElseIfDeclaration

Verifies that there are no else if statements (elseif should be used instead).

declared in PHP_CodeSniffer\Standards\PSR2\Sniffs\ControlStructures\ElseIfDeclarationSniff

MySource.Strings.JoinStrings

Ensures that strings are not joined using array.join().

declared in PHP_CodeSniffer\Standards\MySource\Sniffs\Strings\JoinStringsSniff

MySource.CSS.BrowserSpecificStyles

Ensure that browser-specific styles are not used.

declared in PHP_CodeSniffer\Standards\MySource\Sniffs\CSS\BrowserSpecificStylesSniff

MySource.Objects.CreateWidgetTypeCallback

Ensures the create() method of widget types properly uses callbacks.

declared in PHP_CodeSniffer\Standards\MySource\Sniffs\Objects\CreateWidgetTypeCallbackSniff

MySource.Objects.AssignThis

Ensures this is not assigned to any other var but self.

declared in PHP_CodeSniffer\Standards\MySource\Sniffs\Objects\AssignThisSniff

MySource.Objects.DisallowNewWidget

Ensures that widgets are not manually created.

declared in PHP_CodeSniffer\Standards\MySource\Sniffs\Objects\DisallowNewWidgetSniff

MySource.PHP.EvalObjectFactory

Ensures that eval() is not used to create objects.

declared in PHP_CodeSniffer\Standards\MySource\Sniffs\PHP\EvalObjectFactorySniff

MySource.PHP.AjaxNullComparison

Ensures that values submitted via JS are not compared to NULL.

declared in PHP_CodeSniffer\Standards\MySource\Sniffs\PHP\AjaxNullComparisonSniff

MySource.PHP.GetRequestData

Ensures that getRequestData() is used to access super globals.

declared in PHP_CodeSniffer\Standards\MySource\Sniffs\PHP\GetRequestDataSniff

MySource.PHP.ReturnFunctionValue

Warns when function values are returned directly.

declared in PHP_CodeSniffer\Standards\MySource\Sniffs\PHP\ReturnFunctionValueSniff

MySource.Debug.FirebugConsole

Ensures that console is not used for function or var names.

declared in PHP_CodeSniffer\Standards\MySource\Sniffs\Debug\FirebugConsoleSniff

MySource.Debug.DebugCode

Warns about the use of debug code.

declared in PHP_CodeSniffer\Standards\MySource\Sniffs\Debug\DebugCodeSniff

MySource.Channels.DisallowSelfActions

Ensures that self and static are not used to call public methods in action classes.

declared in PHP_CodeSniffer\Standards\MySource\Sniffs\Channels\DisallowSelfActionsSniff

MySource.Channels.IncludeOwnSystem

Ensures that a system does not include itself.

declared in PHP_CodeSniffer\Standards\MySource\Sniffs\Channels\IncludeOwnSystemSniff

MySource.Channels.UnusedSystem

Ensures that systems and asset types are used if they are included.

declared in PHP_CodeSniffer\Standards\MySource\Sniffs\Channels\UnusedSystemSniff

Generic.Metrics.NestingLevel

Checks the nesting level for methods.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\Metrics\NestingLevelSniff

Generic.Metrics.CyclomaticComplexity

Checks the cyclomatic complexity (McCabe) for functions.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\Metrics\CyclomaticComplexitySniff

Generic.Strings.UnnecessaryStringConcat

Checks that two strings are not concatenated together; suggests using one string instead.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\Strings\UnnecessaryStringConcatSniff

Generic.Classes.DuplicateClassName

Reports errors if the same class or interface name is used in multiple files.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\Classes\DuplicateClassNameSniff

Generic.Classes.OpeningBraceSameLine

Checks that the opening brace of a class/interface/trait is on the same line as the class declaration.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\Classes\OpeningBraceSameLineSniff

Generic.CodeAnalysis.UnusedFunctionParameter

Checks for unused function parameters.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis\UnusedFunctionParameterSniff

Generic.CodeAnalysis.UselessOverridingMethod

Detects unnecessary overridden methods that simply call their parent.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis\UselessOverridingMethodSniff

Generic.CodeAnalysis.UnnecessaryFinalModifier

Detects unnecessary final modifiers inside of final classes.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis\UnnecessaryFinalModifierSniff

Generic.CodeAnalysis.ForLoopShouldBeWhileLoop

Detects for-loops that can be simplified to a while-loop.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis\ForLoopShouldBeWhileLoopSniff

Generic.CodeAnalysis.JumbledIncrementer

Detects incrementer jumbling in for loops.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis\JumbledIncrementerSniff

Generic.CodeAnalysis.AssignmentInCondition

Detects variable assignments being made within conditions.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis\AssignmentInConditionSniff

Generic.CodeAnalysis.EmptyPHPStatement

Checks against empty PHP statements.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis\EmptyPHPStatementSniff

Generic.CodeAnalysis.UnconditionalIfStatement

Detects unconditional if- and elseif-statements.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis\UnconditionalIfStatementSniff

Generic.CodeAnalysis.ForLoopWithTestFunctionCall

Detects for-loops that use a function call in the test expression.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis\ForLoopWithTestFunctionCallSniff

Generic.CodeAnalysis.EmptyStatement

This sniff class detected empty statement.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis\EmptyStatementSniff

Generic.PHP.ForbiddenFunctions

Discourages the use of alias functions.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\ForbiddenFunctionsSniff

Generic.PHP.CharacterBeforePHPOpeningTag

Checks that the opening PHP tag is the first content in a file.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\CharacterBeforePHPOpeningTagSniff

Generic.PHP.Syntax

Ensures PHP believes the syntax is clean.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\SyntaxSniff

Generic.PHP.LowerCaseType

Checks that all PHP types are lowercase.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\LowerCaseTypeSniff

Generic.PHP.ClosingPHPTag

Checks that open PHP tags are paired with closing tags.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\ClosingPHPTagSniff

Generic.PHP.RequireStrictTypes

Checks that the strict_types has been declared.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\RequireStrictTypesSniff

Generic.PHP.DisallowShortOpenTag

Makes sure that shorthand PHP open tags are not used.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\DisallowShortOpenTagSniff

Generic.PHP.DisallowRequestSuperglobal

Ensures the $_REQUEST superglobal is not used

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\DisallowRequestSuperglobalSniff

Generic.PHP.LowerCaseConstant

Checks that all uses of true, false and null are lowercase.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\LowerCaseConstantSniff

Generic.PHP.DiscourageGoto

Discourage the use of the PHP goto language construct.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\DiscourageGotoSniff

Generic.PHP.DisallowAlternativePHPTags

Verifies that no alternative PHP tags are used.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\DisallowAlternativePHPTagsSniff

Generic.PHP.SAPIUsage

Ensures the PHP_SAPI constant is used instead of php_sapi_name().

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\SAPIUsageSniff

Generic.PHP.BacktickOperator

Bans the use of the backtick execution operator.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\BacktickOperatorSniff

Generic.PHP.LowerCaseKeyword

Checks that all PHP keywords are lowercase.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\LowerCaseKeywordSniff

Generic.PHP.NoSilencedErrors

Throws an error or warning when any code prefixed with an asperand is encountered.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\NoSilencedErrorsSniff

Generic.VersionControl.SubversionProperties

Tests that the correct Subversion properties are set.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\VersionControl\SubversionPropertiesSniff

Generic.VersionControl.GitMergeConflict

Check for merge conflict artefacts.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\VersionControl\GitMergeConflictSniff

Generic.WhiteSpace.ScopeIndent

Checks that control structures are defined and indented correctly.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\WhiteSpace\ScopeIndentSniff

Generic.WhiteSpace.ArbitraryParenthesesSpacing

Check & fix whitespace on the inside of arbitrary parentheses.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\WhiteSpace\ArbitraryParenthesesSpacingSniff

Generic.WhiteSpace.DisallowTabIndent

Throws errors if tabs are used for indentation.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\WhiteSpace\DisallowTabIndentSniff

Generic.WhiteSpace.IncrementDecrementSpacing

Verifies spacing between variables and increment/decrement operators.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\WhiteSpace\IncrementDecrementSpacingSniff

Generic.WhiteSpace.LanguageConstructSpacing

Ensures all language constructs contain a single space between themselves and their content.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\WhiteSpace\LanguageConstructSpacingSniff

Generic.WhiteSpace.DisallowSpaceIndent

Throws errors if spaces are used for indentation other than precision indentation.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\WhiteSpace\DisallowSpaceIndentSniff

Generic.WhiteSpace.SpreadOperatorSpacingAfter

Verifies spacing between the spread operator and the variable/function call it applies to.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\WhiteSpace\SpreadOperatorSpacingAfterSniff

Generic.Formatting.DisallowMultipleStatements

Ensures each statement is on a line by itself.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\Formatting\DisallowMultipleStatementsSniff

Generic.Formatting.NoSpaceAfterCast

Ensures there is no space after cast tokens.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\Formatting\NoSpaceAfterCastSniff

Generic.Formatting.SpaceAfterNot

Ensures there is a single space after a NOT operator.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\Formatting\SpaceAfterNotSniff

Generic.Formatting.SpaceAfterCast

Ensures there is a single space after cast tokens.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\Formatting\SpaceAfterCastSniff

Generic.Formatting.SpaceBeforeCast

Ensures there is a single space before cast tokens.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\Formatting\SpaceBeforeCastSniff

Generic.Formatting.MultipleStatementAlignment

Checks alignment of assignments.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\Formatting\MultipleStatementAlignmentSniff

Generic.Arrays.DisallowLongArraySyntax

Bans the use of the PHP long array syntax.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\Arrays\DisallowLongArraySyntaxSniff

Generic.Arrays.DisallowShortArraySyntax

Bans the use of the PHP short array syntax.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\Arrays\DisallowShortArraySyntaxSniff

Generic.Files.LineLength

Checks the length of all lines in a file.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\Files\LineLengthSniff

Generic.Files.ByteOrderMark

A simple sniff for detecting a BOM definition that may corrupt application work.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\Files\ByteOrderMarkSniff

Generic.Files.OneObjectStructurePerFile

Checks that only one object structure is declared per file.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\Files\OneObjectStructurePerFileSniff

Generic.Files.LineEndings

Checks that end of line characters are correct.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\Files\LineEndingsSniff

Generic.Files.OneTraitPerFile

Checks that only one trait is declared per file.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\Files\OneTraitPerFileSniff

Generic.Files.InlineHTML

Ensures the whole file is PHP only, with no whitespace or inline HTML.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\Files\InlineHTMLSniff

Generic.Files.EndFileNoNewline

Ensures the file does not end with a newline character.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\Files\EndFileNoNewlineSniff

Generic.Files.OneInterfacePerFile

Checks that only one interface is declared per file.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\Files\OneInterfacePerFileSniff

Generic.Files.LowercasedFilename

Checks that all file names are lowercased.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\Files\LowercasedFilenameSniff

Generic.Files.OneClassPerFile

Checks that only one class is declared per file.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\Files\OneClassPerFileSniff

Generic.Files.ExecutableFile

Tests that files are not executable.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\Files\ExecutableFileSniff

Generic.Files.EndFileNewline

Ensures the file ends with a newline character.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\Files\EndFileNewlineSniff

Generic.Functions.OpeningFunctionBraceKernighanRitchie

Checks that the opening brace of a function is on the same line as the function declaration.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\Functions\OpeningFunctionBraceKernighanRitchieSniff

Generic.Functions.FunctionCallArgumentSpacing

Checks that calls to methods and functions are spaced correctly.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\Functions\FunctionCallArgumentSpacingSniff

Generic.Functions.CallTimePassByReference

Ensures that variables are not passed by reference when calling a function.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\Functions\CallTimePassByReferenceSniff

Generic.Functions.OpeningFunctionBraceBsdAllman

Checks that the opening brace of a function is on the line after the function declaration.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\Functions\OpeningFunctionBraceBsdAllmanSniff

Generic.ControlStructures.InlineControlStructure

Verifies that inline control statements are not present.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\ControlStructures\InlineControlStructureSniff

Generic.ControlStructures.DisallowYodaConditions

Ban the use of Yoda conditions.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\ControlStructures\DisallowYodaConditionsSniff

Generic.NamingConventions.TraitNameSuffix

Checks that traits are suffixed by Trait.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventions\TraitNameSuffixSniff

Generic.NamingConventions.UpperCaseConstantName

Ensures that constant names are all uppercase.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventions\UpperCaseConstantNameSniff

Generic.NamingConventions.InterfaceNameSuffix

Checks that interfaces are suffixed by Interface.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventions\InterfaceNameSuffixSniff

Generic.NamingConventions.AbstractClassNamePrefix

Checks that abstract classes are prefixed by Abstract.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventions\AbstractClassNamePrefixSniff

Generic.Commenting.DocComment

Ensures doc blocks follow basic formatting.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\Commenting\DocCommentSniff

Generic.Commenting.Todo

Warns about TODO comments.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\Commenting\TodoSniff

Generic.Commenting.Fixme

Warns about FIXME comments.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\Commenting\FixmeSniff

Generic.Debug.CSSLint

Runs csslint on the file.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\Debug\CSSLintSniff

Generic.Debug.ESLint

Runs eslint on the file.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\Debug\ESLintSniff

Generic.Debug.JSHint

Runs jshint.js on the file.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\Debug\JSHintSniff

Generic.Debug.ClosureLinter

Runs gjslint on the file.

declared in PHP_CodeSniffer\Standards\Generic\Sniffs\Debug\ClosureLinterSniff

Squiz.Strings.ConcatenationSpacing

Makes sure there are no spaces around the concatenation operator.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\Strings\ConcatenationSpacingSniff

Squiz.Strings.DoubleQuoteUsage

Makes sure that any use of double quotes strings are warranted.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\Strings\DoubleQuoteUsageSniff

Squiz.Strings.EchoedStrings

Makes sure that any strings that are "echoed" are not enclosed in brackets.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\Strings\EchoedStringsSniff

Squiz.Operators.ComparisonOperatorUsage

A Sniff to enforce the use of IDENTICAL type operators rather than EQUAL operators.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\Operators\ComparisonOperatorUsageSniff

Squiz.Operators.IncrementDecrementUsage

Ensures that the ++ operators are used when possible.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\Operators\IncrementDecrementUsageSniff

Squiz.Operators.ValidLogicalOperators

Ensures logical operators 'and' and 'or' are not used.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\Operators\ValidLogicalOperatorsSniff

Squiz.CSS.DisallowMultipleStyleDefinitions

Ensure that each style definition is on a line by itself.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\CSS\DisallowMultipleStyleDefinitionsSniff

Squiz.CSS.LowercaseStyleDefinition

Ensure that all style definitions are in lowercase.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\CSS\LowercaseStyleDefinitionSniff

Squiz.CSS.ClassDefinitionNameSpacing

Ensure there are no blank lines between the names of classes/IDs.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\CSS\ClassDefinitionNameSpacingSniff

Squiz.CSS.Opacity

Ensure that opacity values start with a 0 if it is not a whole number.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\CSS\OpacitySniff

Squiz.CSS.ClassDefinitionOpeningBraceSpace

Ensure a single space before, and a newline after, the class opening brace

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\CSS\ClassDefinitionOpeningBraceSpaceSniff

Squiz.CSS.ColonSpacing

Ensure there is no space before a colon and one space after it.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\CSS\ColonSpacingSniff

Squiz.CSS.ForbiddenStyles

Bans the use of some styles, such as deprecated or browser-specific styles.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\CSS\ForbiddenStylesSniff

Squiz.CSS.NamedColours

Ensure colour names are not used.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\CSS\NamedColoursSniff

Squiz.CSS.ClassDefinitionClosingBraceSpace

Ensure there is a single blank line after the closing brace of a class definition.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\CSS\ClassDefinitionClosingBraceSpaceSniff

Squiz.CSS.ColourDefinition

Ensure colours are defined in upper-case and use shortcuts where possible.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\CSS\ColourDefinitionSniff

Squiz.CSS.DuplicateClassDefinition

Check for duplicate class definitions that can be merged into one.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\CSS\DuplicateClassDefinitionSniff

Squiz.CSS.EmptyStyleDefinition

Ensure that style definitions are not empty.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\CSS\EmptyStyleDefinitionSniff

Squiz.CSS.EmptyClassDefinition

Ensure that class definitions are not empty.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\CSS\EmptyClassDefinitionSniff

Squiz.CSS.MissingColon

Ensure that all style definitions have a colon.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\CSS\MissingColonSniff

Squiz.CSS.DuplicateStyleDefinition

Check for duplicate style definitions in the same class.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\CSS\DuplicateStyleDefinitionSniff

Squiz.CSS.ShorthandSize

Ensure sizes are defined using shorthand notation where possible.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\CSS\ShorthandSizeSniff

Squiz.CSS.SemicolonSpacing

Ensure each style definition has a semi-colon and it is spaced correctly.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\CSS\SemicolonSpacingSniff

Squiz.CSS.Indentation

Ensures styles are indented 4 spaces.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\CSS\IndentationSniff

Squiz.Classes.ValidClassName

Ensures classes are in camel caps, and the first letter is capitalised.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\Classes\ValidClassNameSniff

Squiz.Classes.DuplicateProperty

Ensures JS classes don't contain duplicate property names.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\Classes\DuplicatePropertySniff

Squiz.Classes.LowercaseClassKeywords

Ensures all class keywords are lowercase.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\Classes\LowercaseClassKeywordsSniff

Squiz.Classes.ClassFileName

Tests that the file name and the name of the class contained within the file match.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\Classes\ClassFileNameSniff

Squiz.Objects.ObjectMemberComma

Ensures the last member of an object is not followed by a comma.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\Objects\ObjectMemberCommaSniff

Squiz.Objects.ObjectInstantiation

Ensures objects are assigned to a variable when instantiated.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\Objects\ObjectInstantiationSniff

Squiz.Objects.DisallowObjectStringIndex

Ensures that object indexes are written in dot notation.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\Objects\DisallowObjectStringIndexSniff

Squiz.PHP.Heredoc

Bans the use of heredocs and nowdocs.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\PHP\HeredocSniff

Squiz.PHP.DisallowMultipleAssignments

Ensures there is only one assignment on a line, and that it is the first thing on the line.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\PHP\DisallowMultipleAssignmentsSniff

Squiz.PHP.InnerFunctions

Ensures that functions within functions are never used.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\PHP\InnerFunctionsSniff

Squiz.PHP.Eval

The use of eval() is discouraged.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\PHP\EvalSniff

Squiz.PHP.GlobalKeyword

Stops the usage of the "global" keyword.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\PHP\GlobalKeywordSniff

Squiz.PHP.DisallowBooleanStatement

Ensures that boolean operators are only used inside control structure conditions.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\PHP\DisallowBooleanStatementSniff

Squiz.PHP.CommentedOutCode

Warn about commented out code.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\PHP\CommentedOutCodeSniff

Squiz.PHP.LowercasePHPFunctions

Ensures all calls to inbuilt PHP functions are lowercase.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\PHP\LowercasePHPFunctionsSniff

Squiz.PHP.DisallowSizeFunctionsInLoops

Bans the use of size-based functions in loop conditions.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\PHP\DisallowSizeFunctionsInLoopsSniff

Squiz.PHP.DisallowInlineIf

Stops inline IF statements from being used.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\PHP\DisallowInlineIfSniff

Squiz.PHP.DisallowComparisonAssignment

Ensures that the value of a comparison is not assigned to a variable.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\PHP\DisallowComparisonAssignmentSniff

Squiz.PHP.EmbeddedPhp

Checks the indentation of embedded PHP code segments.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\PHP\EmbeddedPhpSniff

Squiz.PHP.NonExecutableCode

Warns about code that can never been executed.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\PHP\NonExecutableCodeSniff

Squiz.WhiteSpace.PropertyLabelSpacing

Ensures that a property or label colon has a single space after it and no space before it.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\WhiteSpace\PropertyLabelSpacingSniff

Squiz.WhiteSpace.ControlStructureSpacing

Checks that control structures have the correct spacing around brackets.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\WhiteSpace\ControlStructureSpacingSniff

Squiz.WhiteSpace.FunctionSpacing

Checks the separation between functions and methods.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\WhiteSpace\FunctionSpacingSniff

Squiz.WhiteSpace.CastSpacing

Ensure cast statements don't contain whitespace.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\WhiteSpace\CastSpacingSniff

Squiz.WhiteSpace.FunctionClosingBraceSpace

Checks that there is one empty line before the closing brace of a function.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\WhiteSpace\FunctionClosingBraceSpaceSniff

Squiz.WhiteSpace.OperatorSpacing

Verifies that operators have valid spacing surrounding them.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\WhiteSpace\OperatorSpacingSniff

Squiz.WhiteSpace.ObjectOperatorSpacing

Ensure there is no whitespace before/after an object operator.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\WhiteSpace\ObjectOperatorSpacingSniff

Squiz.WhiteSpace.LogicalOperatorSpacing

Verifies that operators have valid spacing surrounding them.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\WhiteSpace\LogicalOperatorSpacingSniff

Squiz.WhiteSpace.ScopeClosingBrace

Checks that the closing braces of scopes are aligned correctly.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\WhiteSpace\ScopeClosingBraceSniff

Squiz.WhiteSpace.SuperfluousWhitespace

Checks for unneeded whitespace.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\WhiteSpace\SuperfluousWhitespaceSniff

Squiz.WhiteSpace.LanguageConstructSpacing

Ensures all language constructs contain a single space between themselves and their content.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\WhiteSpace\LanguageConstructSpacingSniff

Squiz.WhiteSpace.FunctionOpeningBraceSpace

Checks that there is no empty line after the opening brace of a function.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\WhiteSpace\FunctionOpeningBraceSpaceSniff

Squiz.WhiteSpace.ScopeKeywordSpacing

Ensure there is a single space after scope keywords.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\WhiteSpace\ScopeKeywordSpacingSniff

Squiz.WhiteSpace.SemicolonSpacing

Ensure there is no whitespace before a semicolon.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\WhiteSpace\SemicolonSpacingSniff

Squiz.Formatting.OperatorBracket

Tests that all arithmetic operations are bracketed.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\Formatting\OperatorBracketSniff

Squiz.Arrays.ArrayDeclaration

Ensures that arrays conform to the array coding standard.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\Arrays\ArrayDeclarationSniff

Squiz.Arrays.ArrayBracketSpacing

Ensure that there are no spaces around square brackets.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\Arrays\ArrayBracketSpacingSniff

Squiz.Files.FileExtension

Tests that classes and interfaces are not declared in .php files.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\Files\FileExtensionSniff

Squiz.Functions.GlobalFunction

Tests for functions outside of classes.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\Functions\GlobalFunctionSniff

Squiz.Functions.FunctionDeclarationArgumentSpacing

Checks that arguments in function declarations are spaced correctly.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\Functions\FunctionDeclarationArgumentSpacingSniff

Squiz.Functions.FunctionDuplicateArgument

Checks that duplicate arguments are not used in function declarations.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\Functions\FunctionDuplicateArgumentSniff

Squiz.Functions.LowercaseFunctionKeywords

Ensures all function keywords are lowercase.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\Functions\LowercaseFunctionKeywordsSniff

Squiz.ControlStructures.ForLoopDeclaration

Verifies that there is a space between each condition of for loops.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\ControlStructures\ForLoopDeclarationSniff

Squiz.ControlStructures.LowercaseDeclaration

Ensures all control structure keywords are lowercase.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\ControlStructures\LowercaseDeclarationSniff

Squiz.ControlStructures.ControlSignature

Verifies that control statements conform to their coding standards.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\ControlStructures\ControlSignatureSniff

Squiz.ControlStructures.SwitchDeclaration

Enforces switch statement formatting.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\ControlStructures\SwitchDeclarationSniff

Squiz.ControlStructures.InlineIfDeclaration

Tests the spacing of shorthand IF statements.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\ControlStructures\InlineIfDeclarationSniff

Squiz.ControlStructures.ForEachLoopDeclaration

Verifies that there is a space between each condition of foreach loops.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\ControlStructures\ForEachLoopDeclarationSniff

Squiz.ControlStructures.ElseIfDeclaration

Ensures the use of else if over elseif.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\ControlStructures\ElseIfDeclarationSniff

Squiz.Commenting.PostStatementComment

Checks to ensure that there are no comments after statements.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\Commenting\PostStatementCommentSniff

Squiz.Commenting.ClosingDeclarationComment

Checks the //end ... comments on classes, interfaces and functions.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\Commenting\ClosingDeclarationCommentSniff

Squiz.Commenting.DocCommentAlignment

Tests that the stars in a doc comment align correctly.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\Commenting\DocCommentAlignmentSniff

Squiz.Commenting.LongConditionClosingComment

Ensures long conditions have a comment at the end.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\Commenting\LongConditionClosingCommentSniff

Squiz.Commenting.InlineComment

Checks that there is adequate spacing between comments.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\Commenting\InlineCommentSniff

Squiz.Commenting.ClassComment

Parses and verifies the class doc comment.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\Commenting\ClassCommentSniff

Squiz.Commenting.FileComment

Parses and verifies the file doc comment.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\Commenting\FileCommentSniff

Squiz.Commenting.EmptyCatchComment

Checks for empty catch clause without a comment.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\Commenting\EmptyCatchCommentSniff

Squiz.Commenting.FunctionCommentThrowTag

Verifies that a @throws tag exists for each exception type a function throws.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\Commenting\FunctionCommentThrowTagSniff

Squiz.Commenting.BlockComment

Verifies that block comments are used appropriately.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\Commenting\BlockCommentSniff

Squiz.Debug.JSLint

Runs jslint.js on the file.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\Debug\JSLintSniff

Squiz.Debug.JavaScriptLint

Runs JavaScript Lint on the file.

declared in PHP_CodeSniffer\Standards\Squiz\Sniffs\Debug\JavaScriptLintSniff

PSR1.Classes.ClassDeclaration

Checks the declaration of the class is correct.

declared in PHP_CodeSniffer\Standards\PSR1\Sniffs\Classes\ClassDeclarationSniff

PSR1.Files.SideEffects

Ensures a file declares new symbols and causes no other side effects, or executes logic with side effects, but not both.

declared in PHP_CodeSniffer\Standards\PSR1\Sniffs\Files\SideEffectsSniff

PSR12.Traits.UseDeclaration

Verifies that trait import statements are defined correctly.

declared in PHP_CodeSniffer\Standards\PSR12\Sniffs\Traits\UseDeclarationSniff

PSR12.Classes.OpeningBraceSpace

Verifies that opening braces are not followed by blank lines.

declared in PHP_CodeSniffer\Standards\PSR12\Sniffs\Classes\OpeningBraceSpaceSniff

PSR12.Classes.ClosingBrace

Verifies that closing braces are the last content on a line.

declared in PHP_CodeSniffer\Standards\PSR12\Sniffs\Classes\ClosingBraceSniff

PSR12.Classes.ClassInstantiation

Verifies that classes are instantiated with parentheses.

declared in PHP_CodeSniffer\Standards\PSR12\Sniffs\Classes\ClassInstantiationSniff

PSR12.Namespaces.CompoundNamespaceDepth

Verifies that compound namespaces are not defined too deep.

declared in PHP_CodeSniffer\Standards\PSR12\Sniffs\Namespaces\CompoundNamespaceDepthSniff

PSR12.Properties.ConstantVisibility

Verifies that all class constants have their visibility set.

declared in PHP_CodeSniffer\Standards\PSR12\Sniffs\Properties\ConstantVisibilitySniff

PSR12.Files.ImportStatement

Verifies that import statements are defined correctly.

declared in PHP_CodeSniffer\Standards\PSR12\Sniffs\Files\ImportStatementSniff

PSR12.Files.FileHeader

Checks the format of the file header.

declared in PHP_CodeSniffer\Standards\PSR12\Sniffs\Files\FileHeaderSniff

PSR12.Files.OpenTag

Checks that the open tag is defined correctly.

declared in PHP_CodeSniffer\Standards\PSR12\Sniffs\Files\OpenTagSniff

PSR12.Files.DeclareStatement

Checks the format of the declare statements.

declared in PHP_CodeSniffer\Standards\PSR12\Sniffs\Files\DeclareStatementSniff

PSR12.Functions.NullableTypeDeclaration

Verifies that nullable typehints are lacking superfluous whitespace, e.g. ?int

declared in PHP_CodeSniffer\Standards\PSR12\Sniffs\Functions\NullableTypeDeclarationSniff

PSR12.Functions.ReturnTypeDeclaration

Ensure return types are defined correctly for functions and closures.

declared in PHP_CodeSniffer\Standards\PSR12\Sniffs\Functions\ReturnTypeDeclarationSniff

PSR12.ControlStructures.ControlStructureSpacing

Checks that control structures have the correct spacing.

declared in PHP_CodeSniffer\Standards\PSR12\Sniffs\ControlStructures\ControlStructureSpacingSniff

PSR12.ControlStructures.BooleanOperatorPlacement

Checks that control structures have boolean operators in the correct place.

declared in PHP_CodeSniffer\Standards\PSR12\Sniffs\ControlStructures\BooleanOperatorPlacementSniff

PSR12.Keywords.ShortFormTypeKeywords

Verifies that the short form of type keywords is used (e.g., int, bool).

declared in PHP_CodeSniffer\Standards\PSR12\Sniffs\Keywords\ShortFormTypeKeywordsSniff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment