Documentation

Standards
in package

Table of Contents

getInstalledStandardDetails()  : array<string|int, mixed>
Get the details of all coding standards installed.
getInstalledStandardPath()  : string|null
Return the path of an installed coding standard.
getInstalledStandardPaths()  : array<string|int, mixed>
Get a list of paths where standards are installed.
getInstalledStandards()  : array<string|int, mixed>
Get a list of all coding standards installed.
isInstalledStandard()  : bool
Determine if a standard is installed.
printInstalledStandards()  : void
Prints out a list of installed coding standards.

Methods

getInstalledStandardDetails()

Get the details of all coding standards installed.

public static getInstalledStandardDetails([bool $includeGeneric = false ][, string $standardsDir = '' ]) : array<string|int, mixed>

Coding standards are directories located in the CodeSniffer/Standards directory. Valid coding standards include a Sniffs subdirectory.

The details returned for each standard are:

  • path: the path to the coding standard's main directory
  • name: the name of the coding standard, as sourced from the ruleset.xml file
  • namespace: the namespace used by the coding standard, as sourced from the ruleset.xml file

If you only need the paths to the installed standards, use getInstalledStandardPaths() instead as it performs less work to retrieve coding standard names.

Parameters
$includeGeneric : bool = false

If true, the special "Generic" coding standard will be included if installed.

$standardsDir : string = ''

A specific directory to look for standards in. If not specified, PHP_CodeSniffer will look in its default locations.

Tags
see
getInstalledStandardPaths()
Return values
array<string|int, mixed>

getInstalledStandardPath()

Return the path of an installed coding standard.

public static getInstalledStandardPath(string $standard) : string|null

Coding standards are directories located in the CodeSniffer/Standards directory. Valid coding standards include a ruleset.xml file.

Parameters
$standard : string

The name of the coding standard.

Return values
string|null

getInstalledStandardPaths()

Get a list of paths where standards are installed.

public static getInstalledStandardPaths() : array<string|int, mixed>

Unresolvable relative paths will be excluded from the results.

Return values
array<string|int, mixed>

getInstalledStandards()

Get a list of all coding standards installed.

public static getInstalledStandards([bool $includeGeneric = false ][, string $standardsDir = '' ]) : array<string|int, mixed>

Coding standards are directories located in the CodeSniffer/Standards directory. Valid coding standards include a Sniffs subdirectory.

Parameters
$includeGeneric : bool = false

If true, the special "Generic" coding standard will be included if installed.

$standardsDir : string = ''

A specific directory to look for standards in. If not specified, PHP_CodeSniffer will look in its default locations.

Tags
see
isInstalledStandard()
Return values
array<string|int, mixed>

isInstalledStandard()

Determine if a standard is installed.

public static isInstalledStandard(string $standard) : bool

Coding standards are directories located in the CodeSniffer/Standards directory. Valid coding standards include a ruleset.xml file.

Parameters
$standard : string

The name of the coding standard.

Tags
see
getInstalledStandards()
Return values
bool

printInstalledStandards()

Prints out a list of installed coding standards.

public static printInstalledStandards() : void
Return values
void

Search results