Documentation

ConfigDouble extends Config
in package

FinalYes

Stores the configuration used to run PHPCS and PHPCBF.

Table of Contents

Constants

DEFAULT_REPORT_WIDTH  = 80
Default report width when no report width is provided and 'auto' does not yield a valid width.
STABILITY  = 'stable'
Package stability; either stable, beta or alpha.
VERSION  = '3.10.2'
The current version.

Properties

$annotations  : bool
$basepath  : string
$bootstrap  : array<string|int, string>
$cache  : bool
$cacheFile  : string
$colors  : bool
$dieOnUnknownArg  : bool
Whether or not to kill the process when an unknown command line arg is found.
$encoding  : string
$errorSeverity  : int
$exclude  : array<string|int, string>
$explain  : bool
$extensions  : array<string, string>
$files  : array<string|int, string>
$filter  : string
$generator  : string
$ignored  : array<string|int, string>
$interactive  : bool
$local  : bool
$parallel  : int
$quiet  : bool
$recordErrors  : bool
$reportFile  : string
$reports  : array<string, string|null>
$reportWidth  : int|string
$showProgress  : bool
$showSources  : bool
$sniffs  : array<string|int, string>
$standards  : array<string|int, string>
$stdin  : bool
$stdinContent  : string
$stdinPath  : string
$suffix  : string
$tabWidth  : int
$trackTime  : bool
$unknown  : array<string|int, string>
$verbosity  : int
$warningSeverity  : int
$skipSettingStandard  : bool
Whether or not the setting of a standard should be skipped.

Methods

__construct()  : void
Creates a clean Config object and populates it with command line values.
__get()  : mixed
Get the value of an inaccessible property.
__isset()  : bool
Check if the value of an inaccessible property is set.
__set()  : void
Set the value of an inaccessible property.
__unset()  : void
Unset the value of an inaccessible property.
getAllConfigData()  : array<string, string>
Get all config data.
getConfigData()  : string|null
Get a single config value.
getExecutablePath()  : string|null
Get the path to an executable utility.
getSettings()  : array<string, mixed>
Get the array of all config settings.
printConfigData()  : void
Prints out the gathered config data.
printPHPCBFUsage()  : void
Prints out the usage information for PHPCBF.
printPHPCSUsage()  : void
Prints out the usage information for PHPCS.
printShortUsage()  : string|void
Prints out the short usage information for this script.
printUsage()  : void
Prints out the usage information for this script.
processFilePath()  : void
Processes a file path and add it to the file list.
processLongArgument()  : void
Processes a long (--example) command-line argument.
processShortArgument()  : void
Processes a short (-e) command line argument.
processUnknownArgument()  : void
Processes an unknown command line argument.
restoreDefaults()  : void
Restore default values for all possible command line arguments.
setCommandLineValues()  : void
Sets the command line values and optionally prevents a file system search for a custom ruleset.
setConfigData()  : bool
Set a single config value.
setSettings()  : void
Set the array of all config settings.
getStaticConfigProperty()  : mixed
Helper function to retrieve the value of a private static property on the Config class.
preventAutoDiscoveryScreenWidth()  : void
Prevent a call to stty to figure out the screen width, but only if the test being run doesn't set a report width itself.
preventReadingCodeSnifferConfFile()  : void
Prevent the values in a potentially available user-specific `CodeSniffer.conf` file from influencing the tests.
preventSearchingForRuleset()  : void
Prevent searching for a custom ruleset by setting a standard, but only if the test being run doesn't set a standard itself.
resetSelectProperties()  : void
Reset a few properties on the Config class to their default values.
setStaticConfigProperty()  : void
Helper function to set the value of a private static property on the Config class.

Constants

DEFAULT_REPORT_WIDTH

Default report width when no report width is provided and 'auto' does not yield a valid width.

public int DEFAULT_REPORT_WIDTH = 80

STABILITY

Package stability; either stable, beta or alpha.

public string STABILITY = 'stable'

VERSION

The current version.

public string VERSION = '3.10.2'

Properties

$annotations

public bool $annotations

Process phpcs: annotations.

$basepath

public string $basepath

A file system location to strip from the paths of files shown in reports.

$bootstrap

public array<string|int, string> $bootstrap

One of more files to include before the run begins.

$cache

public bool $cache

Enable the use of the file cache.

$cacheFile

public string $cacheFile

Path to the file where the cache data should be written

$colors

public bool $colors

Display colours in output.

$dieOnUnknownArg

Whether or not to kill the process when an unknown command line arg is found.

public bool $dieOnUnknownArg

If FALSE, arguments that are not command line options or file/directory paths will be ignored and execution will continue. These values will be stored in $this->unknown.

$encoding

public string $encoding

The encoding of the files being checked.

$errorSeverity

public int $errorSeverity

The minimum severity an error must have to be displayed.

$exclude

public array<string|int, string> $exclude

The sniffs that should be excluded from checking. If empty, all sniffs in the supplied standards will be used.

$explain

public bool $explain

Explain the coding standards.

$extensions

public array<string, string> $extensions

File extensions that should be checked, and what tokenizer to use. E.g., array('inc' => 'PHP');

$files

public array<string|int, string> $files

The files and directories to check.

$filter

public string $filter

The filter to use for the run.

$generator

public string $generator

The documentation generator to use.

$ignored

public array<string|int, string> $ignored

Regular expressions used to ignore files and folders during checking.

$interactive

public bool $interactive

Enable interactive checking mode.

$local

public bool $local

Process local files in directories only (no recursion).

$parallel

public int $parallel

Check files in parallel.

$quiet

public bool $quiet

Quiet mode; disables progress and verbose output.

$recordErrors

public bool $recordErrors

Record the content of error messages as well as error counts.

$reportFile

public string $reportFile

A file where the report output should be written.

$reports

public array<string, string|null> $reports

The reports to use for printing output after the run. The format of the array is: array( 'reportName1' => 'outputFile', 'reportName2' => null, ); If the array value is NULL, the report will be written to the screen.

$reportWidth

public int|string $reportWidth

The maximum number of columns that reports should use for output. Set to "auto" for have this value changed to the width of the terminal.

$showProgress

public bool $showProgress

Show basic progress information while running.

$showSources

public bool $showSources

Show sniff source codes in report output.

$sniffs

public array<string|int, string> $sniffs

The sniffs that should be used for checking. If empty, all sniffs in the supplied standards will be used.

$standards

public array<string|int, string> $standards

The standards being used for checking.

$stdin

public bool $stdin

Read content from STDIN instead of supplied files.

$stdinContent

public string $stdinContent

Content passed directly to PHPCS on STDIN.

$stdinPath

public string $stdinPath

The path to use for content passed on STDIN.

$suffix

public string $suffix

A suffix to add to fixed files.

$tabWidth

public int $tabWidth

How many spaces each tab is worth.

$trackTime

public bool $trackTime

Whether or not to track sniff run time.

$unknown

public array<string|int, string> $unknown

Any arguments gathered on the command line that are unknown to us. E.g., using phpcs -c will give array('c');

$verbosity

public int $verbosity

How verbose the output should be. 0: no unnecessary output 1: basic output for files being checked 2: ruleset and file parsing output 3: sniff execution output

$warningSeverity

public int $warningSeverity

The minimum severity a warning must have to be displayed.

$skipSettingStandard

Whether or not the setting of a standard should be skipped.

private bool $skipSettingStandard = false

Methods

__construct()

Creates a clean Config object and populates it with command line values.

public __construct([array<string|int, string> $cliArgs = [] ][, bool $skipSettingStandard = false ][, bool $skipSettingReportWidth = false ]) : void
Parameters
$cliArgs : array<string|int, string> = []

An array of values gathered from CLI args.

$skipSettingStandard : bool = false

Whether to skip setting a standard to prevent the Config class trying to auto-discover a ruleset file. Should only be set to true for tests which actually test the ruleset auto-discovery. Note: there is no need to set this to true when a standard is being passed via the $cliArgs. Those settings will always respected. Defaults to false. Will result in the standard being set to "PSR1" if not provided via $cliArgs.

$skipSettingReportWidth : bool = false

Whether to skip setting a report-width to prevent the Config class trying to auto-discover the screen width. Should only be set to true for tests which actually test the screen width auto-discovery. Note: there is no need to set this to true when a report-width is being passed via the $cliArgs. Those settings will always respected. Defaults to false. Will result in the reportWidth being set to "80" if not provided via $cliArgs.

__get()

Get the value of an inaccessible property.

public __get(string $name) : mixed
Parameters
$name : string

The name of the property.

Tags
throws
RuntimeException

If the setting name is invalid.

__isset()

Check if the value of an inaccessible property is set.

public __isset(string $name) : bool
Parameters
$name : string

The name of the property.

Return values
bool

__set()

Set the value of an inaccessible property.

public __set(string $name, mixed $value) : void
Parameters
$name : string

The name of the property.

$value : mixed

The value of the property.

Tags
throws
RuntimeException

If the setting name is invalid.

__unset()

Unset the value of an inaccessible property.

public __unset(string $name) : void
Parameters
$name : string

The name of the property.

getAllConfigData()

Get all config data.

public static getAllConfigData() : array<string, string>
Tags
see
getConfigData()
throws
DeepExitException

If the config file could not be read.

Return values
array<string, string>

getConfigData()

Get a single config value.

public static getConfigData(string $key) : string|null
Parameters
$key : string

The name of the config value.

Tags
see
setConfigData()
see
getAllConfigData()
Return values
string|null

getExecutablePath()

Get the path to an executable utility.

public static getExecutablePath(string $name) : string|null
Parameters
$name : string

The name of the executable utility.

Tags
see
getConfigData()
Return values
string|null

getSettings()

Get the array of all config settings.

public getSettings() : array<string, mixed>
Return values
array<string, mixed>

printConfigData()

Prints out the gathered config data.

public printConfigData(array<string|int, mixed> $data) : void
Parameters
$data : array<string|int, mixed>

The config data to print.

printPHPCBFUsage()

Prints out the usage information for PHPCBF.

public printPHPCBFUsage() : void

printPHPCSUsage()

Prints out the usage information for PHPCS.

public printPHPCSUsage() : void

printShortUsage()

Prints out the short usage information for this script.

public printShortUsage([bool $return = false ]) : string|void
Parameters
$return : bool = false

If TRUE, the usage string is returned instead of output to screen.

Return values
string|void

printUsage()

Prints out the usage information for this script.

public printUsage() : void

processFilePath()

Processes a file path and add it to the file list.

public processFilePath(string $path) : void
Parameters
$path : string

The path to the file to add.

Tags
throws
DeepExitException

processLongArgument()

Processes a long (--example) command-line argument.

public processLongArgument(string $arg, int $pos) : void
Parameters
$arg : string

The command line argument.

$pos : int

The position of the argument on the command line.

Tags
throws
DeepExitException

processShortArgument()

Processes a short (-e) command line argument.

public processShortArgument(string $arg, int $pos) : void
Parameters
$arg : string

The command line argument.

$pos : int

The position of the argument on the command line.

Tags
throws
DeepExitException

processUnknownArgument()

Processes an unknown command line argument.

public processUnknownArgument(string $arg, int $pos) : void

Assumes all unknown arguments are files and folders to check.

Parameters
$arg : string

The command line argument.

$pos : int

The position of the argument on the command line.

Tags
throws
DeepExitException

restoreDefaults()

Restore default values for all possible command line arguments.

public restoreDefaults() : void

setCommandLineValues()

Sets the command line values and optionally prevents a file system search for a custom ruleset.

public setCommandLineValues(array<string|int, string> $args) : void
Parameters
$args : array<string|int, string>

An array of command line arguments to set.

setConfigData()

Set a single config value.

public static setConfigData(string $key, string|null $value[, bool $temp = false ]) : bool
Parameters
$key : string

The name of the config value.

$value : string|null

The value to set. If null, the config entry is deleted, reverting it to the default value.

$temp : bool = false

Set this config data temporarily for this script run. This will not write the config data to the config file.

Tags
see
getConfigData()
throws
DeepExitException

If the config file can not be written.

Return values
bool

setSettings()

Set the array of all config settings.

public setSettings(array<string, mixed> $settings) : void
Parameters
$settings : array<string, mixed>

The array of config settings.

getStaticConfigProperty()

Helper function to retrieve the value of a private static property on the Config class.

private getStaticConfigProperty(string $name) : mixed
Parameters
$name : string

The name of the property to retrieve.

preventAutoDiscoveryScreenWidth()

Prevent a call to stty to figure out the screen width, but only if the test being run doesn't set a report width itself.

private preventAutoDiscoveryScreenWidth() : void

preventReadingCodeSnifferConfFile()

Prevent the values in a potentially available user-specific `CodeSniffer.conf` file from influencing the tests.

private preventReadingCodeSnifferConfFile() : void

This also prevents some file system calls which can influence the test runtime.

preventSearchingForRuleset()

Prevent searching for a custom ruleset by setting a standard, but only if the test being run doesn't set a standard itself.

private preventSearchingForRuleset() : void

This also prevents some file system calls which can influence the test runtime.

The standard being set is the smallest one available so the ruleset initialization will be the fastest possible.

resetSelectProperties()

Reset a few properties on the Config class to their default values.

private resetSelectProperties() : void

setStaticConfigProperty()

Helper function to set the value of a private static property on the Config class.

private setStaticConfigProperty(string $name, mixed $value) : void
Parameters
$name : string

The name of the property to set.

$value : mixed

The value to set the property to.


        
On this page

Search results