Menu

## CodeCoverage
in package

CodeCoverage.php : 43

Provides collection functionality for PHP code coverage information.

### Table of Contents

UNCOVERED_FILES = 'UNCOVERED_FILES'
$cacheDirectory : string|null
$checkForUnintentionallyCoveredCode : bool
$coveredFileAnalyser : CoveredFileAnalyser|null
$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.
$uncoveredFileAnalyser : UncoveredFileAnalyser|null
$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
applyCoversAnnotationFilter() : void
  Applies the @covers annotation filtering.
applyFilter() : void
applyIgnoredLinesFilter() : void
coveredFileAnalyser() : CoveredFileAnalyser
getAllowedLines() : array<string|int, mixed>
performUnintentionallyCoveredCodeCheck() : void
processUncoveredFilesFromFilter() : void
processUnintentionallyCoveredUnits() : array<string|int, mixed>
uncoveredFileAnalyser() : UncoveredFileAnalyser

### Constants

#### UNCOVERED_FILES

CodeCoverage.php : 45
`private mixed UNCOVERED_FILES = 'UNCOVERED_FILES'`

### Properties

#### $cacheDirectory

CodeCoverage.php : 124
`private string|null $cacheDirectory`

#### $checkForUnintentionallyCoveredCode

CodeCoverage.php : 65
`private bool $checkForUnintentionallyCoveredCode = false`

#### $coveredFileAnalyser

CodeCoverage.php : 114
`private CoveredFileAnalyser|null $coveredFileAnalyser`

#### $currentId

CodeCoverage.php : 85
`private PhptTestCase|string|TestCase $currentId`

#### $data

CodeCoverage.php : 92

Code coverage data.

`private ProcessedCodeCoverageData $data`

#### $driver

CodeCoverage.php : 50
`private Driver $driver`

#### $filter

CodeCoverage.php : 55
`private Filter $filter`

#### $ignoreDeprecatedCode

CodeCoverage.php : 80
`private bool $ignoreDeprecatedCode = false`

#### $includeUncoveredFiles

CodeCoverage.php : 70
`private bool $includeUncoveredFiles = true`

#### $parentClassesExcludedFromUnintentionallyCoveredCodeCheck

CodeCoverage.php : 109
`private mixed $parentClassesExcludedFromUnintentionallyCoveredCodeCheck = []`

##### Tags

psalm-var

  list

#### $processUncoveredFiles

CodeCoverage.php : 75
`private bool $processUncoveredFiles = false`

#### $tests

CodeCoverage.php : 104

Test data.

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

#### $uncoveredFileAnalyser

CodeCoverage.php : 119
`private UncoveredFileAnalyser|null $uncoveredFileAnalyser`

#### $useAnnotationsForIgnoringCode

CodeCoverage.php : 97
`private bool $useAnnotationsForIgnoringCode = true`

#### $wizard

CodeCoverage.php : 60
`private Wizard $wizard`

### Methods

#### __construct()

CodeCoverage.php : 126
`public __construct(Driver $driver, Filter $filter) : mixed`

##### Parameters

$driver : Driver
$filter : Filter

##### Return values

mixed —

#### append()

CodeCoverage.php : 249

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 —

#### cacheDirectory()

CodeCoverage.php : 397
`public cacheDirectory() : string`

##### Tags

throws
  StaticAnalysisCacheNotConfiguredException

##### Return values

string —

#### cachesStaticAnalysis()

CodeCoverage.php : 379
`public cachesStaticAnalysis() : bool`

##### Tags

psalm-assert-if-true

  !null $this->cacheDirectory

##### Return values

bool —

#### cacheStaticAnalysis()

CodeCoverage.php : 384
`public cacheStaticAnalysis(string $directory) : void`

##### Parameters

$directory : string

##### Return values

void —

#### clear()

CodeCoverage.php : 145

Clears collected code coverage data.

`public clear() : void`

##### Return values

void —

#### collectsBranchAndPathCoverage()

CodeCoverage.php : 426
`public collectsBranchAndPathCoverage() : bool`

##### Return values

bool —

#### detectsDeadCode()

CodeCoverage.php : 431
`public detectsDeadCode() : bool`

##### Return values

bool —

#### disableAnnotationsForIgnoringCode()

CodeCoverage.php : 361
`public disableAnnotationsForIgnoringCode() : void`

##### Return values

void —

#### disableBranchAndPathCoverage()

CodeCoverage.php : 421
`public disableBranchAndPathCoverage() : void`

##### Return values

void —

#### disableCheckForUnintentionallyCoveredCode()

CodeCoverage.php : 331
`public disableCheckForUnintentionallyCoveredCode() : void`

##### Return values

void —

#### doNotCacheStaticAnalysis()

CodeCoverage.php : 389
`public doNotCacheStaticAnalysis() : void`

##### Return values

void —

#### doNotIgnoreDeprecatedCode()

CodeCoverage.php : 371
`public doNotIgnoreDeprecatedCode() : void`

##### Return values

void —

#### doNotProcessUncoveredFiles()

CodeCoverage.php : 351
`public doNotProcessUncoveredFiles() : void`

##### Return values

void —

#### enableAnnotationsForIgnoringCode()

CodeCoverage.php : 356
`public enableAnnotationsForIgnoringCode() : void`

##### Return values

void —

#### enableBranchAndPathCoverage()

CodeCoverage.php : 416
`public enableBranchAndPathCoverage() : void`

##### Return values

void —

#### enableCheckForUnintentionallyCoveredCode()

CodeCoverage.php : 326
`public enableCheckForUnintentionallyCoveredCode() : void`

##### Return values

void —

#### excludeSubclassesOfThisClassFromUnintentionallyCoveredCodeCheck()

CodeCoverage.php : 411
`public excludeSubclassesOfThisClassFromUnintentionallyCoveredCodeCheck(string $className) : void`

##### Parameters

$className : string

##### Tags

psalm-param

  class-string $className

##### Return values

void —

#### excludeUncoveredFiles()

CodeCoverage.php : 341
`public excludeUncoveredFiles() : void`

##### Return values

void —

#### filter()

CodeCoverage.php : 155

Returns the filter object used.

`public filter() : Filter`

##### Return values

Filter —

#### getData()

CodeCoverage.php : 163

Returns the collected code coverage data.

`public getData([bool $raw = false ]) : ProcessedCodeCoverageData`

##### Parameters

$raw : bool = false

##### Return values

ProcessedCodeCoverageData —

#### getReport()

CodeCoverage.php : 137

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

`public getReport() : Directory`

##### Return values

Directory —

#### getTests()

CodeCoverage.php : 189

Returns the test data.

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

##### Return values

array<string|int, mixed> —

#### ignoreDeprecatedCode()

CodeCoverage.php : 366
`public ignoreDeprecatedCode() : void`

##### Return values

void —

#### includeUncoveredFiles()

CodeCoverage.php : 336
`public includeUncoveredFiles() : void`

##### Return values

void —

#### merge()

CodeCoverage.php : 315

Merges the data from another instance.

`public merge(self $that) : void`

##### Parameters

$that : self

##### Return values

void —

#### processUncoveredFiles()

CodeCoverage.php : 346
`public processUncoveredFiles() : void`

##### Return values

void —

#### setData()

CodeCoverage.php : 181

Sets the coverage data.

`public setData(ProcessedCodeCoverageData $data) : void`

##### Parameters

$data : ProcessedCodeCoverageData

##### Return values

void —

#### setTests()

CodeCoverage.php : 197

Sets the test data.

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

##### Parameters

$tests : array<string|int, mixed>

##### Return values

void —

#### start()

CodeCoverage.php : 207

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()

CodeCoverage.php : 223

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 —

#### addUncoveredFilesFromFilter()

CodeCoverage.php : 506
`private addUncoveredFilesFromFilter() : void`

##### Tags

throws
  UnintentionallyCoveredCodeException

##### Return values

void —

#### applyCoversAnnotationFilter()

CodeCoverage.php : 444

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 —

#### applyFilter()

CodeCoverage.php : 476
`private applyFilter(RawCodeCoverageData $data) : void`

##### Parameters

$data : RawCodeCoverageData

##### Return values

void —

#### applyIgnoredLinesFilter()

CodeCoverage.php : 489
`private applyIgnoredLinesFilter(RawCodeCoverageData $data) : void`

##### Parameters

$data : RawCodeCoverageData

##### Return values

void —

#### coveredFileAnalyser()

CodeCoverage.php : 649
`private coveredFileAnalyser() : CoveredFileAnalyser`

##### Return values

CoveredFileAnalyser —

#### getAllowedLines()

CodeCoverage.php : 577
`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()

CodeCoverage.php : 551
`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 —

#### processUncoveredFilesFromFilter()

CodeCoverage.php : 529
`private processUncoveredFilesFromFilter() : void`

##### Tags

throws
  UnintentionallyCoveredCodeException

##### Return values

void —

#### processUnintentionallyCoveredUnits()

CodeCoverage.php : 615
`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> —

#### uncoveredFileAnalyser()

CodeCoverage.php : 670
`private uncoveredFileAnalyser() : UncoveredFileAnalyser`

##### Return values

UncoveredFileAnalyser —

## Search results