DeprecationErrorHandler
in package
Catch deprecation notices and print a summary report at the end of the test suite.
Tags
Table of Contents
Constants
- MODE_DISABLED = 'disabled'
- MODE_STRICT = 'max[total]=0'
- MODE_WEAK = 'max[total]=999999&verbose=0'
Properties
- $configuration : mixed
- $deprecationGroups : array<string|int, DeprecationGroup>
- $errorHandler : mixed
- $isRegistered : mixed
- $mode : mixed
Methods
- __construct() : mixed
- collectDeprecations() : mixed
- register() : mixed
- Registers and configures the deprecation handler.
- colorize() : string
- displayDeprecations() : mixed
- getConfiguration() : mixed
- getPhpUnitErrorHandler() : callable
- hasColorSupport() : bool
- Returns true if STDOUT is defined and supports colorization.
- resetDeprecationGroups() : mixed
Constants
MODE_DISABLED
public
mixed
MODE_DISABLED
= 'disabled'
MODE_STRICT
public
mixed
MODE_STRICT
= 'max[total]=0'
MODE_WEAK
public
mixed
MODE_WEAK
= 'max[total]=999999&verbose=0'
Properties
$configuration
private
mixed
$configuration
$deprecationGroups
private
array<string|int, DeprecationGroup>
$deprecationGroups
= []
$errorHandler
private
static mixed
$errorHandler
$isRegistered
private
static mixed
$isRegistered
= false
$mode
private
mixed
$mode
Methods
__construct()
public
__construct() : mixed
collectDeprecations()
public
static collectDeprecations(mixed $outputFile) : mixed
Parameters
- $outputFile : mixed
register()
Registers and configures the deprecation handler.
public
static register([int|string|false $mode = 0 ]) : mixed
The mode is a query string with options:
- "disabled" to enable/disable the deprecation handler
- "verbose" to enable/disable displaying the deprecation report
- "quiet" to disable displaying the deprecation report only for some groups (i.e. quiet[]=other)
- "max" to configure the number of deprecations to allow before exiting with a non-zero status code; it's an array with keys "total", "self", "direct" and "indirect"
The default mode is "max[total]=0&verbose=1".
The mode can alternatively be "/some-regexp/" to stop the test suite whenever a deprecation message matches the given regular expression.
Parameters
- $mode : int|string|false = 0
-
The reporting mode, defaults to not allowing any deprecations
colorize()
private
static colorize(string $str, bool $red) : string
Parameters
- $str : string
- $red : bool
Return values
stringdisplayDeprecations()
private
displayDeprecations(array<string|int, string> $groups, Configuration $configuration) : mixed
Parameters
- $groups : array<string|int, string>
- $configuration : Configuration
Tags
getConfiguration()
private
getConfiguration() : mixed
getPhpUnitErrorHandler()
private
static getPhpUnitErrorHandler() : callable
Return values
callablehasColorSupport()
Returns true if STDOUT is defined and supports colorization.
private
static hasColorSupport() : bool
Reference: Composer\XdebugHandler\Process::supportsColor https://github.com/composer/xdebug-handler
Return values
boolresetDeprecationGroups()
private
resetDeprecationGroups() : mixed