Skip to content
On this page

PSR12 Sniffs

AnonClassDeclaration

Checks that the declaration of an anon class is correct.

ClassInstantiation

Verifies that classes are instantiated with parentheses.

ClosingBrace

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

OpeningBraceSpace

Verifies that opening braces are not followed by blank lines.

BooleanOperatorPlacement

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

ControlStructureSpacing

Checks that control structures have the correct spacing.

DeclareStatement

Checks the format of the declare statements.

FileHeader

Checks the format of the file header.

ImportStatement

Verifies that import statements are defined correctly.

OpenTag

Checks that the open tag is defined correctly.

NullableTypeDeclaration

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

ReturnTypeDeclaration

Ensure return types are defined correctly for functions and closures.

ShortFormTypeKeywords

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

CompoundNamespaceDepth

Verifies that compound namespaces are not defined too deep.

OperatorSpacing

Verifies that operators have valid spacing surrounding them.

ConstantVisibility

Verifies that all class constants have their visibility set.

UseDeclaration

Verifies that trait import statements are defined correctly.

Released under the MIT License.