Documentation

CodeCoverage
in package

Provides collection functionality for PHP code coverage information.

Table of Contents

UNCOVERED_FILES  = 'UNCOVERED_FILES'
$analyser  : FileAnalyser|null
$cacheDirectory  : string|null
$checkForUnintentionallyCoveredCode  : bool
$currentId  : PhptTestCase|string|TestCase
$data  : ProcessedCodeCoverageData
Code coverage data.
$driver  : Driver
$filter  : Filter
$ignoreDeprecatedCode  : bool
$includeUncoveredFiles  : bool
$parentClassesExcludedFromUnintentionallyCoveredCodeCheck  : mixed
$processUncoveredFiles  : bool
$tests  : array<string|int, mixed>
Test data.
$useAnnotationsForIgnoringCode  : bool
$wizard  : Wizard
__construct()  : mixed
append()  : void
Appends code coverage data.
cacheDirectory()  : string
cachesStaticAnalysis()  : bool
cacheStaticAnalysis()  : void
clear()  : void
Clears collected code coverage data.
collectsBranchAndPathCoverage()  : bool
detectsDeadCode()  : bool
disableAnnotationsForIgnoringCode()  : void
disableBranchAndPathCoverage()  : void
disableCheckForUnintentionallyCoveredCode()  : void
doNotCacheStaticAnalysis()  : void
doNotIgnoreDeprecatedCode()  : void
doNotProcessUncoveredFiles()  : void
enableAnnotationsForIgnoringCode()  : void
enableBranchAndPathCoverage()  : void
enableCheckForUnintentionallyCoveredCode()  : void
excludeSubclassesOfThisClassFromUnintentionallyCoveredCodeCheck()  : void
excludeUncoveredFiles()  : void
filter()  : Filter
Returns the filter object used.
getData()  : ProcessedCodeCoverageData
Returns the collected code coverage data.
getReport()  : Directory
Returns the code coverage information as a graph of node objects.
getTests()  : array<string|int, mixed>
Returns the test data.
ignoreDeprecatedCode()  : void
includeUncoveredFiles()  : void
merge()  : void
Merges the data from another instance.
processUncoveredFiles()  : void
setData()  : void
Sets the coverage data.
setTests()  : void
Sets the test data.
start()  : void
Start collection of code coverage information.
stop()  : RawCodeCoverageData
Stop collection of code coverage information.
addUncoveredFilesFromFilter()  : void
analyser()  : FileAnalyser
applyCoversAnnotationFilter()  : void
Applies the @covers annotation filtering.
applyExecutableLinesFilter()  : void
applyFilter()  : void
applyIgnoredLinesFilter()  : void
getAllowedLines()  : array<string|int, mixed>
performUnintentionallyCoveredCodeCheck()  : void
processUncoveredFilesFromFilter()  : void
processUnintentionallyCoveredUnits()  : array<string|int, mixed>

Constants

UNCOVERED_FILES

private mixed UNCOVERED_FILES = 'UNCOVERED_FILES'

Properties

$checkForUnintentionallyCoveredCode

private bool $checkForUnintentionallyCoveredCode = false

$data

Code coverage data.

private ProcessedCodeCoverageData $data

$ignoreDeprecatedCode

private bool $ignoreDeprecatedCode = false

$includeUncoveredFiles

private bool $includeUncoveredFiles = true

$parentClassesExcludedFromUnintentionallyCoveredCodeCheck

private mixed $parentClassesExcludedFromUnintentionallyCoveredCodeCheck = []
Tags
psalm-var

list

$processUncoveredFiles

private bool $processUncoveredFiles = false

$tests

Test data.

private array<string|int, mixed> $tests = []

$useAnnotationsForIgnoringCode

private bool $useAnnotationsForIgnoringCode = true

Methods

__construct()

public __construct(Driver $driver, Filter $filter) : mixed
Parameters
$driver : Driver
$filter : Filter
Return values
mixed

append()

Appends code coverage data.

public append(RawCodeCoverageData $rawData[, PhptTestCase|string|TestCase $id = null ][, bool $append = true ][, array<string|int, mixed>|false $linesToBeCovered = [] ][, array<string|int, mixed> $linesToBeUsed = [] ]) : void
Parameters
$rawData : RawCodeCoverageData
$id : PhptTestCase|string|TestCase = null
$append : bool = true
$linesToBeCovered : array<string|int, mixed>|false = []
$linesToBeUsed : array<string|int, mixed> = []
Tags
throws
ReflectionException
throws
TestIdMissingException
throws
UnintentionallyCoveredCodeException
Return values
void

cachesStaticAnalysis()

public cachesStaticAnalysis() : bool
Tags
psalm-assert-if-true

!null $this->cacheDirectory

Return values
bool

cacheStaticAnalysis()

public cacheStaticAnalysis(string $directory) : void
Parameters
$directory : string
Return values
void

clear()

Clears collected code coverage data.

public clear() : void
Return values
void

collectsBranchAndPathCoverage()

public collectsBranchAndPathCoverage() : bool
Return values
bool

detectsDeadCode()

public detectsDeadCode() : bool
Return values
bool

disableAnnotationsForIgnoringCode()

public disableAnnotationsForIgnoringCode() : void
Return values
void

disableBranchAndPathCoverage()

public disableBranchAndPathCoverage() : void
Return values
void

disableCheckForUnintentionallyCoveredCode()

public disableCheckForUnintentionallyCoveredCode() : void
Return values
void

doNotCacheStaticAnalysis()

public doNotCacheStaticAnalysis() : void
Return values
void

doNotIgnoreDeprecatedCode()

public doNotIgnoreDeprecatedCode() : void
Return values
void

doNotProcessUncoveredFiles()

public doNotProcessUncoveredFiles() : void
Return values
void

enableAnnotationsForIgnoringCode()

public enableAnnotationsForIgnoringCode() : void
Return values
void

enableBranchAndPathCoverage()

public enableBranchAndPathCoverage() : void
Return values
void

enableCheckForUnintentionallyCoveredCode()

public enableCheckForUnintentionallyCoveredCode() : void
Return values
void

excludeSubclassesOfThisClassFromUnintentionallyCoveredCodeCheck()

public excludeSubclassesOfThisClassFromUnintentionallyCoveredCodeCheck(string $className) : void
Parameters
$className : string
Tags
psalm-param

class-string $className

Return values
void

excludeUncoveredFiles()

public excludeUncoveredFiles() : void
Return values
void

getData()

Returns the collected code coverage data.

public getData([bool $raw = false ]) : ProcessedCodeCoverageData
Parameters
$raw : bool = false
Return values
ProcessedCodeCoverageData

getReport()

Returns the code coverage information as a graph of node objects.

public getReport() : Directory
Return values
Directory

getTests()

Returns the test data.

public getTests() : array<string|int, mixed>
Return values
array<string|int, mixed>

ignoreDeprecatedCode()

public ignoreDeprecatedCode() : void
Return values
void

includeUncoveredFiles()

public includeUncoveredFiles() : void
Return values
void

merge()

Merges the data from another instance.

public merge(self $that) : void
Parameters
$that : self
Return values
void

processUncoveredFiles()

public processUncoveredFiles() : void
Return values
void

setData()

Sets the coverage data.

public setData(ProcessedCodeCoverageData $data) : void
Parameters
$data : ProcessedCodeCoverageData
Return values
void

setTests()

Sets the test data.

public setTests(array<string|int, mixed> $tests) : void
Parameters
$tests : array<string|int, mixed>
Return values
void

start()

Start collection of code coverage information.

public start(PhptTestCase|string|TestCase $id[, bool $clear = false ]) : void
Parameters
$id : PhptTestCase|string|TestCase
$clear : bool = false
Return values
void

stop()

Stop collection of code coverage information.

public stop([bool $append = true ][, array<string|int, mixed>|false $linesToBeCovered = [] ][, array<string|int, mixed> $linesToBeUsed = [] ]) : RawCodeCoverageData
Parameters
$append : bool = true
$linesToBeCovered : array<string|int, mixed>|false = []
$linesToBeUsed : array<string|int, mixed> = []
Return values
RawCodeCoverageData

analyser()

private analyser() : FileAnalyser
Return values
FileAnalyser

applyCoversAnnotationFilter()

Applies the @covers annotation filtering.

private applyCoversAnnotationFilter(RawCodeCoverageData $rawData, array<string|int, mixed>|false $linesToBeCovered, array<string|int, mixed> $linesToBeUsed) : void
Parameters
$rawData : RawCodeCoverageData
$linesToBeCovered : array<string|int, mixed>|false
$linesToBeUsed : array<string|int, mixed>
Tags
throws
ReflectionException
throws
UnintentionallyCoveredCodeException
Return values
void

applyExecutableLinesFilter()

private applyExecutableLinesFilter(RawCodeCoverageData $data) : void
Parameters
$data : RawCodeCoverageData
Return values
void

applyFilter()

private applyFilter(RawCodeCoverageData $data) : void
Parameters
$data : RawCodeCoverageData
Return values
void

applyIgnoredLinesFilter()

private applyIgnoredLinesFilter(RawCodeCoverageData $data) : void
Parameters
$data : RawCodeCoverageData
Return values
void

getAllowedLines()

private getAllowedLines(array<string|int, mixed> $linesToBeCovered, array<string|int, mixed> $linesToBeUsed) : array<string|int, mixed>
Parameters
$linesToBeCovered : array<string|int, mixed>
$linesToBeUsed : array<string|int, mixed>
Return values
array<string|int, mixed>

performUnintentionallyCoveredCodeCheck()

private performUnintentionallyCoveredCodeCheck(RawCodeCoverageData $data, array<string|int, mixed> $linesToBeCovered, array<string|int, mixed> $linesToBeUsed) : void
Parameters
$data : RawCodeCoverageData
$linesToBeCovered : array<string|int, mixed>
$linesToBeUsed : array<string|int, mixed>
Tags
throws
ReflectionException
throws
UnintentionallyCoveredCodeException
Return values
void

processUnintentionallyCoveredUnits()

private processUnintentionallyCoveredUnits(array<string|int, mixed> $unintentionallyCoveredUnits) : array<string|int, mixed>
Parameters
$unintentionallyCoveredUnits : array<string|int, mixed>
Tags
throws
ReflectionException
Return values
array<string|int, mixed>

Search results