This commit is contained in:
2025-05-12 14:25:25 +02:00
parent ab2db755ef
commit 9e378ca2b7
2719 changed files with 46505 additions and 60181 deletions

View File

@@ -2,6 +2,36 @@
All notable changes are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
## [10.1.16] - 2024-08-22
### Changed
* Updated dependencies (so that users that install using Composer's `--prefer-lowest` CLI option also get recent versions)
## [10.1.15] - 2024-06-29
### Fixed
* [#967](https://github.com/sebastianbergmann/php-code-coverage/issues/967): Identification of executable lines for `match` expressions does not work correctly
## [10.1.14] - 2024-03-12
### Fixed
* [#1033](https://github.com/sebastianbergmann/php-code-coverage/issues/1033): `@codeCoverageIgnore` annotation does not work on `enum`
## [10.1.13] - 2024-03-09
### Changed
* [#1032](https://github.com/sebastianbergmann/php-code-coverage/pull/1032): Pad lines in code coverage report only when colors are shown
## [10.1.12] - 2024-03-02
### Changed
* Do not use implicitly nullable parameters
## [10.1.11] - 2023-12-21
### Changed
@@ -83,6 +113,11 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
* The `SebastianBergmann\CodeCoverage\Filter::includeDirectory()`, `SebastianBergmann\CodeCoverage\Filter::excludeDirectory()`, and `SebastianBergmann\CodeCoverage\Filter::excludeFile()` methods are now deprecated
[10.1.16]: https://github.com/sebastianbergmann/php-code-coverage/compare/10.1.15...10.1.16
[10.1.15]: https://github.com/sebastianbergmann/php-code-coverage/compare/10.1.14...10.1.15
[10.1.14]: https://github.com/sebastianbergmann/php-code-coverage/compare/10.1.13...10.1.14
[10.1.13]: https://github.com/sebastianbergmann/php-code-coverage/compare/10.1.12...10.1.13
[10.1.12]: https://github.com/sebastianbergmann/php-code-coverage/compare/10.1.11...10.1.12
[10.1.11]: https://github.com/sebastianbergmann/php-code-coverage/compare/10.1.10...10.1.11
[10.1.10]: https://github.com/sebastianbergmann/php-code-coverage/compare/10.1.9...10.1.10
[10.1.9]: https://github.com/sebastianbergmann/php-code-coverage/compare/10.1.8...10.1.9

View File

@@ -1,6 +1,6 @@
BSD 3-Clause License
Copyright (c) 2009-2023, Sebastian Bergmann
Copyright (c) 2009-2024, Sebastian Bergmann
All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@@ -33,15 +33,15 @@
"ext-dom": "*",
"ext-libxml": "*",
"ext-xmlwriter": "*",
"nikic/php-parser": "^4.18 || ^5.0",
"phpunit/php-file-iterator": "^4.0",
"phpunit/php-text-template": "^3.0",
"sebastian/code-unit-reverse-lookup": "^3.0",
"sebastian/complexity": "^3.0",
"sebastian/environment": "^6.0",
"sebastian/lines-of-code": "^2.0",
"sebastian/version": "^4.0",
"theseer/tokenizer": "^1.2.0"
"nikic/php-parser": "^4.19.1 || ^5.1.0",
"phpunit/php-file-iterator": "^4.1.0",
"phpunit/php-text-template": "^3.0.1",
"sebastian/code-unit-reverse-lookup": "^3.0.0",
"sebastian/complexity": "^3.2.0",
"sebastian/environment": "^6.1.0",
"sebastian/lines-of-code": "^2.0.2",
"sebastian/version": "^4.0.1",
"theseer/tokenizer": "^1.2.3"
},
"require-dev": {
"phpunit/phpunit": "^10.1"
@@ -63,7 +63,7 @@
},
"extra": {
"branch-alias": {
"dev-main": "10.1-dev"
"dev-main": "10.1.x-dev"
}
}
}

View File

@@ -160,7 +160,7 @@ final class CodeCoverage
$this->tests = $tests;
}
public function start(string $id, TestSize $size = null, bool $clear = false): void
public function start(string $id, ?TestSize $size = null, bool $clear = false): void
{
if ($clear) {
$this->clear();
@@ -177,13 +177,13 @@ final class CodeCoverage
/**
* @psalm-param array<string,list<int>> $linesToBeIgnored
*/
public function stop(bool $append = true, TestStatus $status = null, array|false $linesToBeCovered = [], array $linesToBeUsed = [], array $linesToBeIgnored = []): RawCodeCoverageData
public function stop(bool $append = true, ?TestStatus $status = null, array|false $linesToBeCovered = [], array $linesToBeUsed = [], array $linesToBeIgnored = []): RawCodeCoverageData
{
$data = $this->driver->stop();
$this->linesToBeIgnored = array_merge_recursive(
$this->linesToBeIgnored,
$linesToBeIgnored
$linesToBeIgnored,
);
$this->append($data, null, $append, $status, $linesToBeCovered, $linesToBeUsed, $linesToBeIgnored);
@@ -202,7 +202,7 @@ final class CodeCoverage
* @throws TestIdMissingException
* @throws UnintentionallyCoveredCodeException
*/
public function append(RawCodeCoverageData $rawData, string $id = null, bool $append = true, TestStatus $status = null, array|false $linesToBeCovered = [], array $linesToBeUsed = [], array $linesToBeIgnored = []): void
public function append(RawCodeCoverageData $rawData, ?string $id = null, bool $append = true, ?TestStatus $status = null, array|false $linesToBeCovered = [], array $linesToBeUsed = [], array $linesToBeIgnored = []): void
{
if ($id === null) {
$id = $this->currentId;
@@ -246,7 +246,7 @@ final class CodeCoverage
$rawData,
$linesToBeCovered,
$linesToBeUsed,
$size
$size,
);
if (empty($rawData->lineCoverage())) {
@@ -267,7 +267,7 @@ final class CodeCoverage
public function merge(self $that): void
{
$this->filter->includeFiles(
$that->filter()->files()
$that->filter()->files(),
);
$this->data->merge($that->data);
@@ -342,7 +342,7 @@ final class CodeCoverage
{
if (!$this->cachesStaticAnalysis()) {
throw new StaticAnalysisCacheNotConfiguredException(
'The static analysis cache is not configured'
'The static analysis cache is not configured',
);
}
@@ -436,12 +436,12 @@ final class CodeCoverage
$data->keepLineCoverageDataOnlyForLines(
$filename,
array_keys($linesToBranchMap)
array_keys($linesToBranchMap),
);
$data->markExecutableLineByBranch(
$filename,
$linesToBranchMap
$linesToBranchMap,
);
}
}
@@ -459,13 +459,13 @@ final class CodeCoverage
if (isset($linesToBeIgnored[$filename])) {
$data->removeCoverageDataForLines(
$filename,
$linesToBeIgnored[$filename]
$linesToBeIgnored[$filename],
);
}
$data->removeCoverageDataForLines(
$filename,
$this->analyser()->ignoredLinesFor($filename)
$this->analyser()->ignoredLinesFor($filename),
);
}
}
@@ -477,7 +477,7 @@ final class CodeCoverage
{
$uncoveredFiles = array_diff(
$this->filter->files(),
$this->data->coveredFiles()
$this->data->coveredFiles(),
);
foreach ($uncoveredFiles as $uncoveredFile) {
@@ -485,10 +485,10 @@ final class CodeCoverage
$this->append(
RawCodeCoverageData::fromUncoveredFile(
$uncoveredFile,
$this->analyser()
$this->analyser(),
),
self::UNCOVERED_FILES,
linesToBeIgnored: $this->linesToBeIgnored
linesToBeIgnored: $this->linesToBeIgnored,
);
}
}
@@ -502,7 +502,7 @@ final class CodeCoverage
{
$allowedLines = $this->getAllowedLines(
$linesToBeCovered,
$linesToBeUsed
$linesToBeUsed,
);
$unintentionallyCoveredUnits = [];
@@ -519,7 +519,7 @@ final class CodeCoverage
if (!empty($unintentionallyCoveredUnits)) {
throw new UnintentionallyCoveredCodeException(
$unintentionallyCoveredUnits
$unintentionallyCoveredUnits,
);
}
}
@@ -535,7 +535,7 @@ final class CodeCoverage
$allowedLines[$file] = array_merge(
$allowedLines[$file],
$linesToBeCovered[$file]
$linesToBeCovered[$file],
);
}
@@ -546,13 +546,13 @@ final class CodeCoverage
$allowedLines[$file] = array_merge(
$allowedLines[$file],
$linesToBeUsed[$file]
$linesToBeUsed[$file],
);
}
foreach (array_keys($allowedLines) as $file) {
$allowedLines[$file] = array_flip(
array_unique($allowedLines[$file])
array_unique($allowedLines[$file]),
);
}
@@ -592,7 +592,7 @@ final class CodeCoverage
throw new ReflectionException(
$e->getMessage(),
$e->getCode(),
$e
$e,
);
}
@@ -614,7 +614,7 @@ final class CodeCoverage
$this->analyser = new ParsingFileAnalyser(
$this->useAnnotationsForIgnoringCode,
$this->ignoreDeprecatedCode
$this->ignoreDeprecatedCode,
);
if ($this->cachesStaticAnalysis()) {
@@ -622,7 +622,7 @@ final class CodeCoverage
$this->cacheDirectory,
$this->analyser,
$this->useAnnotationsForIgnoringCode,
$this->ignoreDeprecatedCode
$this->ignoreDeprecatedCode,
);
}

View File

@@ -164,8 +164,8 @@ final class ProcessedCodeCoverageData
$compareLineNumbers = array_unique(
array_merge(
array_keys($this->lineCoverage[$file]),
array_keys($newData->lineCoverage[$file])
)
array_keys($newData->lineCoverage[$file]),
),
);
foreach ($compareLineNumbers as $line) {
@@ -176,7 +176,7 @@ final class ProcessedCodeCoverageData
$this->lineCoverage[$file][$line] = $newData->lineCoverage[$file][$line];
} elseif ($thatPriority === $thisPriority && is_array($this->lineCoverage[$file][$line])) {
$this->lineCoverage[$file][$line] = array_unique(
array_merge($this->lineCoverage[$file][$line], $newData->lineCoverage[$file][$line])
array_merge($this->lineCoverage[$file][$line], $newData->lineCoverage[$file][$line]),
);
}
}

View File

@@ -144,7 +144,7 @@ final class RawCodeCoverageData
$this->lineCoverage[$filename] = array_intersect_key(
$this->lineCoverage[$filename],
array_flip($lines)
array_flip($lines),
);
}
@@ -223,7 +223,7 @@ final class RawCodeCoverageData
$this->lineCoverage[$filename] = array_diff_key(
$this->lineCoverage[$filename],
array_flip($lines)
array_flip($lines),
);
if (isset($this->functionCoverage[$filename])) {

View File

@@ -75,8 +75,8 @@ abstract class Driver
throw new BranchAndPathCoverageNotSupportedException(
sprintf(
'%s does not support branch and path coverage',
$this->nameAndVersion()
)
$this->nameAndVersion(),
),
);
}
@@ -107,8 +107,8 @@ abstract class Driver
throw new DeadCodeDetectionNotSupportedException(
sprintf(
'%s does not support dead code detection',
$this->nameAndVersion()
)
$this->nameAndVersion(),
),
);
}

View File

@@ -75,7 +75,7 @@ final class XdebugDriver extends Driver
xdebug_set_filter(
XDEBUG_FILTER_CODE_COVERAGE,
XDEBUG_PATH_INCLUDE,
$filter->files()
$filter->files(),
);
}
}

View File

@@ -16,6 +16,6 @@ final class XdebugNotEnabledException extends RuntimeException implements Except
{
public function __construct()
{
parent::__construct('XDEBUG_MODE=coverage or xdebug.mode=coverage has to be set');
parent::__construct('XDEBUG_MODE=coverage (environment variable) or xdebug.mode=coverage (PHP configuration setting) has to be set');
}
}

View File

@@ -33,7 +33,7 @@ abstract class AbstractNode implements Countable
private readonly ?AbstractNode $parent;
private string $id;
public function __construct(string $name, self $parent = null)
public function __construct(string $name, ?self $parent = null)
{
if (str_ends_with($name, DIRECTORY_SEPARATOR)) {
$name = substr($name, 0, -1);
@@ -131,7 +131,7 @@ abstract class AbstractNode implements Countable
{
return Percentage::fromFractionAndTotal(
$this->numberOfExecutedBranches(),
$this->numberOfExecutableBranches()
$this->numberOfExecutableBranches(),
);
}
@@ -139,7 +139,7 @@ abstract class AbstractNode implements Countable
{
return Percentage::fromFractionAndTotal(
$this->numberOfExecutedPaths(),
$this->numberOfExecutablePaths()
$this->numberOfExecutablePaths(),
);
}

View File

@@ -45,13 +45,13 @@ final class Builder
$commonPath = $this->reducePaths($data);
$root = new Directory(
$commonPath,
null
null,
);
$this->addItems(
$root,
$this->buildDirectoryStructure($data),
$coverage->getTests()
$coverage->getTests(),
);
return $root;
@@ -80,8 +80,8 @@ final class Builder
$this->analyser->classesIn($filename),
$this->analyser->traitsIn($filename),
$this->analyser->functionsIn($filename),
$this->analyser->linesOfCodeFor($filename)
)
$this->analyser->linesOfCodeFor($filename),
),
);
}
} else {

View File

@@ -37,7 +37,7 @@ final class CrapIndex
return sprintf(
'%01.2F',
$this->cyclomaticComplexity ** 2 * (1 - $this->codeCoverage / 100) ** 3 + $this->cyclomaticComplexity
$this->cyclomaticComplexity ** 2 * (1 - $this->codeCoverage / 100) ** 3 + $this->cyclomaticComplexity,
);
}
}

View File

@@ -76,7 +76,7 @@ final class Directory extends AbstractNode implements IteratorAggregate
{
return new RecursiveIteratorIterator(
new Iterator($this),
RecursiveIteratorIterator::SELF_FIRST
RecursiveIteratorIterator::SELF_FIRST,
);
}
@@ -122,7 +122,7 @@ final class Directory extends AbstractNode implements IteratorAggregate
foreach ($this->children as $child) {
$this->classes = array_merge(
$this->classes,
$child->classes()
$child->classes(),
);
}
}
@@ -138,7 +138,7 @@ final class Directory extends AbstractNode implements IteratorAggregate
foreach ($this->children as $child) {
$this->traits = array_merge(
$this->traits,
$child->traits()
$child->traits(),
);
}
}
@@ -154,7 +154,7 @@ final class Directory extends AbstractNode implements IteratorAggregate
foreach ($this->children as $child) {
$this->functions = array_merge(
$this->functions,
$child->functions()
$child->functions(),
);
}
}
@@ -177,8 +177,8 @@ final class Directory extends AbstractNode implements IteratorAggregate
foreach ($this->children as $child) {
$childLinesOfCode = $child->linesOfCode();
$this->linesOfCode['linesOfCode'] += $childLinesOfCode['linesOfCode'];
$this->linesOfCode['commentLinesOfCode'] += $childLinesOfCode['commentLinesOfCode'];
$this->linesOfCode['linesOfCode'] += $childLinesOfCode['linesOfCode'];
$this->linesOfCode['commentLinesOfCode'] += $childLinesOfCode['commentLinesOfCode'];
$this->linesOfCode['nonCommentLinesOfCode'] += $childLinesOfCode['nonCommentLinesOfCode'];
}
}

View File

@@ -487,14 +487,14 @@ final class File extends AbstractNode
$this->classes[$className]['methods'][$methodName] = $methodData;
$this->classes[$className]['executableBranches'] += $methodData['executableBranches'];
$this->classes[$className]['executedBranches'] += $methodData['executedBranches'];
$this->classes[$className]['executablePaths'] += $methodData['executablePaths'];
$this->classes[$className]['executedPaths'] += $methodData['executedPaths'];
$this->classes[$className]['executedBranches'] += $methodData['executedBranches'];
$this->classes[$className]['executablePaths'] += $methodData['executablePaths'];
$this->classes[$className]['executedPaths'] += $methodData['executedPaths'];
$this->numExecutableBranches += $methodData['executableBranches'];
$this->numExecutedBranches += $methodData['executedBranches'];
$this->numExecutablePaths += $methodData['executablePaths'];
$this->numExecutedPaths += $methodData['executedPaths'];
$this->numExecutedBranches += $methodData['executedBranches'];
$this->numExecutablePaths += $methodData['executablePaths'];
$this->numExecutedPaths += $methodData['executedPaths'];
foreach (range($method['startLine'], $method['endLine']) as $lineNumber) {
$this->codeUnitsByLine[$lineNumber] = [
@@ -536,14 +536,14 @@ final class File extends AbstractNode
$this->traits[$traitName]['methods'][$methodName] = $methodData;
$this->traits[$traitName]['executableBranches'] += $methodData['executableBranches'];
$this->traits[$traitName]['executedBranches'] += $methodData['executedBranches'];
$this->traits[$traitName]['executablePaths'] += $methodData['executablePaths'];
$this->traits[$traitName]['executedPaths'] += $methodData['executedPaths'];
$this->traits[$traitName]['executedBranches'] += $methodData['executedBranches'];
$this->traits[$traitName]['executablePaths'] += $methodData['executablePaths'];
$this->traits[$traitName]['executedPaths'] += $methodData['executedPaths'];
$this->numExecutableBranches += $methodData['executableBranches'];
$this->numExecutedBranches += $methodData['executedBranches'];
$this->numExecutablePaths += $methodData['executablePaths'];
$this->numExecutedPaths += $methodData['executedPaths'];
$this->numExecutedBranches += $methodData['executedBranches'];
$this->numExecutablePaths += $methodData['executablePaths'];
$this->numExecutedPaths += $methodData['executedPaths'];
foreach (range($method['startLine'], $method['endLine']) as $lineNumber) {
$this->codeUnitsByLine[$lineNumber] = [
@@ -587,7 +587,7 @@ final class File extends AbstractNode
if (isset($this->functionCoverageData[$functionName]['branches'])) {
$this->functions[$functionName]['executableBranches'] = count(
$this->functionCoverageData[$functionName]['branches']
$this->functionCoverageData[$functionName]['branches'],
);
$this->functions[$functionName]['executedBranches'] = count(
@@ -596,14 +596,14 @@ final class File extends AbstractNode
static function (array $branch)
{
return (bool) $branch['hit'];
}
)
},
),
);
}
if (isset($this->functionCoverageData[$functionName]['paths'])) {
$this->functions[$functionName]['executablePaths'] = count(
$this->functionCoverageData[$functionName]['paths']
$this->functionCoverageData[$functionName]['paths'],
);
$this->functions[$functionName]['executedPaths'] = count(
@@ -612,15 +612,15 @@ final class File extends AbstractNode
static function (array $path)
{
return (bool) $path['hit'];
}
)
},
),
);
}
$this->numExecutableBranches += $this->functions[$functionName]['executableBranches'];
$this->numExecutedBranches += $this->functions[$functionName]['executedBranches'];
$this->numExecutablePaths += $this->functions[$functionName]['executablePaths'];
$this->numExecutedPaths += $this->functions[$functionName]['executedPaths'];
$this->numExecutedBranches += $this->functions[$functionName]['executedBranches'];
$this->numExecutablePaths += $this->functions[$functionName]['executablePaths'];
$this->numExecutedPaths += $this->functions[$functionName]['executedPaths'];
}
}
@@ -653,7 +653,7 @@ final class File extends AbstractNode
if (isset($this->functionCoverageData[$key]['branches'])) {
$methodData['executableBranches'] = count(
$this->functionCoverageData[$key]['branches']
$this->functionCoverageData[$key]['branches'],
);
$methodData['executedBranches'] = count(
@@ -662,14 +662,14 @@ final class File extends AbstractNode
static function (array $branch)
{
return (bool) $branch['hit'];
}
)
},
),
);
}
if (isset($this->functionCoverageData[$key]['paths'])) {
$methodData['executablePaths'] = count(
$this->functionCoverageData[$key]['paths']
$this->functionCoverageData[$key]['paths'],
);
$methodData['executedPaths'] = count(
@@ -678,8 +678,8 @@ final class File extends AbstractNode
static function (array $path)
{
return (bool) $path['hit'];
}
)
},
),
);
}

View File

@@ -16,7 +16,7 @@ use function is_string;
use function ksort;
use function max;
use function range;
use function strpos;
use function str_contains;
use function time;
use DOMDocument;
use SebastianBergmann\CodeCoverage\CodeCoverage;
@@ -79,7 +79,7 @@ final class Clover
}
$classMethods++;
$classStatements += $method['executableLines'];
$classStatements += $method['executableLines'];
$coveredClassStatements += $method['executedLines'];
if ($method['coverage'] == 100) {
@@ -115,28 +115,28 @@ final class Clover
if (!empty($class['package']['fullPackage'])) {
$xmlClass->setAttribute(
'fullPackage',
$class['package']['fullPackage']
$class['package']['fullPackage'],
);
}
if (!empty($class['package']['category'])) {
$xmlClass->setAttribute(
'category',
$class['package']['category']
$class['package']['category'],
);
}
if (!empty($class['package']['package'])) {
$xmlClass->setAttribute(
'package',
$class['package']['package']
$class['package']['package'],
);
}
if (!empty($class['package']['subpackage'])) {
$xmlClass->setAttribute(
'subpackage',
$class['package']['subpackage']
$class['package']['subpackage'],
);
}
@@ -213,7 +213,7 @@ final class Clover
} else {
if (!isset($packages[$namespace])) {
$packages[$namespace] = $xmlDocument->createElement(
'package'
'package',
);
$packages[$namespace]->setAttribute('name', $namespace);
@@ -244,7 +244,7 @@ final class Clover
$buffer = $xmlDocument->saveXML();
if ($target !== null) {
if (!strpos($target, '://') !== false) {
if (!str_contains($target, '://')) {
Filesystem::createDirectory(dirname($target));
}

View File

@@ -15,8 +15,8 @@ use function dirname;
use function file_put_contents;
use function preg_match;
use function range;
use function str_contains;
use function str_replace;
use function strpos;
use function time;
use DOMImplementation;
use SebastianBergmann\CodeCoverage\CodeCoverage;
@@ -40,7 +40,7 @@ final class Cobertura
$documentType = $implementation->createDocumentType(
'coverage',
'',
'http://cobertura.sourceforge.net/xml/coverage-04.dtd'
'http://cobertura.sourceforge.net/xml/coverage-04.dtd',
);
$document = $implementation->createDocument('', '', $documentType);
@@ -114,7 +114,7 @@ final class Cobertura
$coverageData = $item->lineCoverageData();
foreach ($classes as $className => $class) {
$complexity += $class['ccn'];
$complexity += $class['ccn'];
$packageComplexity += $class['ccn'];
if (!empty($class['package']['namespace'])) {
@@ -225,22 +225,22 @@ final class Cobertura
continue;
}
$complexity += $function['ccn'];
$packageComplexity += $function['ccn'];
$complexity += $function['ccn'];
$packageComplexity += $function['ccn'];
$functionsComplexity += $function['ccn'];
$linesValid = $function['executableLines'];
$linesCovered = $function['executedLines'];
$lineRate = $linesValid === 0 ? 0 : ($linesCovered / $linesValid);
$functionsLinesValid += $linesValid;
$functionsLinesValid += $linesValid;
$functionsLinesCovered += $linesCovered;
$branchesValid = $function['executableBranches'];
$branchesCovered = $function['executedBranches'];
$branchRate = $branchesValid === 0 ? 0 : ($branchesCovered / $branchesValid);
$functionsBranchesValid += $branchesValid;
$functionsBranchesValid += $branchesValid;
$functionsBranchesCovered += $branchesValid;
$methodElement = $document->createElement('method');
@@ -295,7 +295,7 @@ final class Cobertura
$buffer = $document->saveXML();
if ($target !== null) {
if (!strpos($target, '://') !== false) {
if (!str_contains($target, '://')) {
Filesystem::createDirectory(dirname($target));
}

View File

@@ -15,7 +15,7 @@ use function file_put_contents;
use function htmlspecialchars;
use function is_string;
use function round;
use function strpos;
use function str_contains;
use DOMDocument;
use SebastianBergmann\CodeCoverage\CodeCoverage;
use SebastianBergmann\CodeCoverage\Driver\WriteOperationFailedException;
@@ -73,7 +73,7 @@ final class Crap4j
foreach ($class['methods'] as $methodName => $method) {
$crapLoad = $this->crapLoad((float) $method['crap'], $method['ccn'], $method['coverage']);
$fullCrap += $method['crap'];
$fullCrap += $method['crap'];
$fullCrapLoad += $crapLoad;
$fullMethodCount++;
@@ -122,7 +122,7 @@ final class Crap4j
$buffer = $document->saveXML();
if ($target !== null) {
if (!strpos($target, '://') !== false) {
if (!str_contains($target, '://')) {
Filesystem::createDirectory(dirname($target));
}

View File

@@ -31,7 +31,7 @@ final class CustomCssFile
{
if (!is_file($path)) {
throw new InvalidArgumentException(
'$path does not exist'
'$path does not exist',
);
}

View File

@@ -50,7 +50,7 @@ final class Facade
$this->generator,
$date,
$this->thresholds,
$coverage->collectsBranchAndPathCoverage()
$coverage->collectsBranchAndPathCoverage(),
);
$directory = new Directory(
@@ -58,7 +58,7 @@ final class Facade
$this->generator,
$date,
$this->thresholds,
$coverage->collectsBranchAndPathCoverage()
$coverage->collectsBranchAndPathCoverage(),
);
$file = new File(
@@ -66,7 +66,7 @@ final class Facade
$this->generator,
$date,
$this->thresholds,
$coverage->collectsBranchAndPathCoverage()
$coverage->collectsBranchAndPathCoverage(),
);
$directory->render($report, $target . 'index.html');
@@ -126,7 +126,7 @@ final class Facade
'success-high' => $this->colors->successHigh(),
'warning' => $this->colors->warning(),
'danger' => $this->colors->danger(),
]
],
);
try {
@@ -135,7 +135,7 @@ final class Facade
throw new FileCouldNotBeWrittenException(
$e->getMessage(),
$e->getCode(),
$e
$e,
);
}
}

View File

@@ -55,7 +55,7 @@ abstract class Renderer
$data['numClasses'];
$classesBar = $this->coverageBar(
$data['testedClassesPercent']
$data['testedClassesPercent'],
);
} else {
$classesLevel = '';
@@ -71,7 +71,7 @@ abstract class Renderer
$data['numMethods'];
$methodsBar = $this->coverageBar(
$data['testedMethodsPercent']
$data['testedMethodsPercent'],
);
} else {
$methodsLevel = '';
@@ -87,7 +87,7 @@ abstract class Renderer
$data['numExecutableLines'];
$linesBar = $this->coverageBar(
$data['linesExecutedPercent']
$data['linesExecutedPercent'],
);
} else {
$linesLevel = '';
@@ -103,7 +103,7 @@ abstract class Renderer
$data['numExecutablePaths'];
$pathsBar = $this->coverageBar(
$data['pathsExecutedPercent']
$data['pathsExecutedPercent'],
);
} else {
$pathsLevel = '';
@@ -119,7 +119,7 @@ abstract class Renderer
$data['numExecutableBranches'];
$branchesBar = $this->coverageBar(
$data['branchesExecutedPercent']
$data['branchesExecutedPercent'],
);
} else {
$branchesLevel = '';
@@ -153,7 +153,7 @@ abstract class Renderer
'classes_tested_percent' => $data['testedClassesPercentAsString'] ?? '',
'classes_level' => $classesLevel,
'classes_number' => $classesNumber,
]
],
);
return $template->render();
@@ -173,7 +173,7 @@ abstract class Renderer
'generator' => $this->generator,
'low_upper_bound' => $this->thresholds->lowUpperBound(),
'high_lower_bound' => $this->thresholds->highLowerBound(),
]
],
);
}
@@ -196,7 +196,7 @@ abstract class Renderer
if ($step !== $node) {
$breadcrumbs .= $this->inactiveBreadcrumb(
$step,
array_pop($pathToRoot)
array_pop($pathToRoot),
);
} else {
$breadcrumbs .= $this->activeBreadcrumb($step);
@@ -210,7 +210,7 @@ abstract class Renderer
{
$buffer = sprintf(
' <li class="breadcrumb-item active">%s</li>' . "\n",
$node->name()
$node->name(),
);
if ($node instanceof DirectoryNode) {
@@ -225,7 +225,7 @@ abstract class Renderer
return sprintf(
' <li class="breadcrumb-item"><a href="%sindex.html">%s</a></li>' . "\n",
$pathToRoot,
$node->name()
$node->name(),
);
}
@@ -250,7 +250,7 @@ abstract class Renderer
$template = new Template(
$templateName,
'{{',
'}}'
'}}',
);
$template->setVar(['level' => $level, 'percent' => sprintf('%.2F', $percent)]);
@@ -280,7 +280,7 @@ abstract class Renderer
'<a href="%s" target="_top">%s %s</a>',
$runtime->getVendorUrl(),
$runtime->getName(),
$runtime->getVersion()
$runtime->getVersion(),
);
}
}

View File

@@ -36,7 +36,7 @@ final class Dashboard extends Renderer
$template = new Template(
$templateName,
'{{',
'}}'
'}}',
);
$this->setCommonTemplateVariables($template, $node);
@@ -57,7 +57,7 @@ final class Dashboard extends Renderer
'complexity_method' => $complexity['method'],
'class_coverage_distribution' => $coverageDistribution['class'],
'method_coverage_distribution' => $coverageDistribution['method'],
]
],
);
try {
@@ -66,7 +66,7 @@ final class Dashboard extends Renderer
throw new FileCouldNotBeWrittenException(
$e->getMessage(),
$e->getCode(),
$e
$e,
);
}
}
@@ -76,7 +76,7 @@ final class Dashboard extends Renderer
return sprintf(
' <li class="breadcrumb-item"><a href="index.html">%s</a></li>' . "\n" .
' <li class="breadcrumb-item active">(Dashboard)</li>' . "\n",
$node->name()
$node->name(),
);
}
@@ -99,7 +99,7 @@ final class Dashboard extends Renderer
sprintf(
'<a href="%s">%s</a>',
str_replace($baseLink, '', $method['link']),
$methodName
$methodName,
),
];
}
@@ -110,7 +110,7 @@ final class Dashboard extends Renderer
sprintf(
'<a href="%s">%s</a>',
str_replace($baseLink, '', $class['link']),
$className
$className,
),
];
}
@@ -222,7 +222,7 @@ final class Dashboard extends Renderer
' <tr><td><a href="%s">%s</a></td><td class="text-right">%d%%</td></tr>' . "\n",
str_replace($baseLink, '', $classes[$className]['link']),
$className,
$coverage
$coverage,
);
}
@@ -234,7 +234,7 @@ final class Dashboard extends Renderer
str_replace($baseLink, '', $classes[$class]['methods'][$method]['link']),
$methodName,
$method,
$coverage
$coverage,
);
}
@@ -277,7 +277,7 @@ final class Dashboard extends Renderer
' <tr><td><a href="%s">%s</a></td><td class="text-right">%d</td></tr>' . "\n",
str_replace($baseLink, '', $classes[$className]['link']),
$className,
$crap
$crap,
);
}
@@ -289,7 +289,7 @@ final class Dashboard extends Renderer
str_replace($baseLink, '', $classes[$class]['methods'][$method]['link']),
$methodName,
$method,
$crap
$crap,
);
}

View File

@@ -44,7 +44,7 @@ final class Directory extends Renderer
[
'id' => $node->id(),
'items' => $items,
]
],
);
try {
@@ -53,7 +53,7 @@ final class Directory extends Renderer
throw new FileCouldNotBeWrittenException(
$e->getMessage(),
$e->getCode(),
$e
$e,
);
}
}
@@ -93,7 +93,7 @@ final class Directory extends Renderer
$data['name'] = sprintf(
'<a href="%s/index.html">%s</a>',
$node->name(),
$node->name()
$node->name(),
);
$data['icon'] = sprintf('<img src="%s_icons/file-directory.svg" class="octicon" />', $up);
} elseif ($this->hasBranchCoverage) {
@@ -102,13 +102,13 @@ final class Directory extends Renderer
$node->name(),
$node->name(),
$node->name(),
$node->name()
$node->name(),
);
} else {
$data['name'] = sprintf(
'<a href="%s.html">%s</a>',
$node->name(),
$node->name()
$node->name(),
);
}
}
@@ -117,7 +117,7 @@ final class Directory extends Renderer
return $this->renderItemTemplate(
new Template($templateName, '{{', '}}'),
$data
$data,
);
}
}

View File

@@ -196,7 +196,7 @@ final class File extends Renderer
'lines' => $this->renderSourceWithLineCoverage($node),
'legend' => '<p><span class="legend covered-by-small-tests">Covered by small (and larger) tests</span><span class="legend covered-by-medium-tests">Covered by medium (and large) tests</span><span class="legend covered-by-large-tests">Covered by large tests (and tests of unknown size)</span><span class="legend not-covered">Not covered</span><span class="legend not-coverable">Not coverable</span></p>',
'structure' => '',
]
],
);
try {
@@ -205,7 +205,7 @@ final class File extends Renderer
throw new FileCouldNotBeWrittenException(
$e->getMessage(),
$e->getCode(),
$e
$e,
);
}
@@ -216,7 +216,7 @@ final class File extends Renderer
'lines' => $this->renderSourceWithBranchCoverage($node),
'legend' => '<p><span class="success"><strong>Fully covered</strong></span><span class="warning"><strong>Partially covered</strong></span><span class="danger"><strong>Not covered</strong></span></p>',
'structure' => $this->renderBranchStructure($node),
]
],
);
try {
@@ -225,7 +225,7 @@ final class File extends Renderer
throw new FileCouldNotBeWrittenException(
$e->getMessage(),
$e->getCode(),
$e
$e,
);
}
@@ -235,7 +235,7 @@ final class File extends Renderer
'lines' => $this->renderSourceWithPathCoverage($node),
'legend' => '<p><span class="success"><strong>Fully covered</strong></span><span class="warning"><strong>Partially covered</strong></span><span class="danger"><strong>Not covered</strong></span></p>',
'structure' => $this->renderPathStructure($node),
]
],
);
try {
@@ -244,7 +244,7 @@ final class File extends Renderer
throw new FileCouldNotBeWrittenException(
$e->getMessage(),
$e->getCode(),
$e
$e,
);
}
}
@@ -259,7 +259,7 @@ final class File extends Renderer
$methodItemTemplate = new Template(
$methodTemplateName,
'{{',
'}}'
'}}',
);
$items = $this->renderItemTemplate(
@@ -287,24 +287,24 @@ final class File extends Renderer
'testedClassesPercent' => $node->percentageOfTestedClassesAndTraits()->asFloat(),
'testedClassesPercentAsString' => $node->percentageOfTestedClassesAndTraits()->asString(),
'crap' => '<abbr title="Change Risk Anti-Patterns (CRAP) Index">CRAP</abbr>',
]
],
);
$items .= $this->renderFunctionItems(
$node->functions(),
$methodItemTemplate
$methodItemTemplate,
);
$items .= $this->renderTraitOrClassItems(
$node->traits(),
$template,
$methodItemTemplate
$methodItemTemplate,
);
$items .= $this->renderTraitOrClassItems(
$node->classes(),
$template,
$methodItemTemplate
$methodItemTemplate,
);
return $items;
@@ -337,15 +337,15 @@ final class File extends Renderer
$numTestedClasses = $numTestedMethods === $numMethods ? 1 : 0;
$linesExecutedPercentAsString = Percentage::fromFractionAndTotal(
$item['executedLines'],
$item['executableLines']
$item['executableLines'],
)->asString();
$branchesExecutedPercentAsString = Percentage::fromFractionAndTotal(
$item['executedBranches'],
$item['executableBranches']
$item['executableBranches'],
)->asString();
$pathsExecutedPercentAsString = Percentage::fromFractionAndTotal(
$item['executedPaths'],
$item['executablePaths']
$item['executablePaths'],
)->asString();
} else {
$numClasses = 0;
@@ -357,12 +357,12 @@ final class File extends Renderer
$testedMethodsPercentage = Percentage::fromFractionAndTotal(
$numTestedMethods,
$numMethods
$numMethods,
);
$testedClassesPercentage = Percentage::fromFractionAndTotal(
$numTestedMethods === $numMethods ? 1 : 0,
1
1,
);
$buffer .= $this->renderItemTemplate(
@@ -389,7 +389,7 @@ final class File extends Renderer
'numExecutableBranches' => $item['executableBranches'],
'pathsExecutedPercent' => Percentage::fromFractionAndTotal(
$item['executedPaths'],
$item['executablePaths']
$item['executablePaths'],
)->asFloat(),
'pathsExecutedPercentAsString' => $pathsExecutedPercentAsString,
'numExecutedPaths' => $item['executedPaths'],
@@ -399,14 +399,14 @@ final class File extends Renderer
'testedClassesPercent' => $testedClassesPercentage->asFloat(),
'testedClassesPercentAsString' => $testedClassesPercentage->asString(),
'crap' => $item['crap'],
]
],
);
foreach ($item['methods'] as $method) {
$buffer .= $this->renderFunctionOrMethodItem(
$methodItemTemplate,
$method,
'&nbsp;'
'&nbsp;',
);
}
}
@@ -425,7 +425,7 @@ final class File extends Renderer
foreach ($functions as $function) {
$buffer .= $this->renderFunctionOrMethodItem(
$template,
$function
$function,
);
}
@@ -447,22 +447,22 @@ final class File extends Renderer
$executedLinesPercentage = Percentage::fromFractionAndTotal(
$item['executedLines'],
$item['executableLines']
$item['executableLines'],
);
$executedBranchesPercentage = Percentage::fromFractionAndTotal(
$item['executedBranches'],
$item['executableBranches']
$item['executableBranches'],
);
$executedPathsPercentage = Percentage::fromFractionAndTotal(
$item['executedPaths'],
$item['executablePaths']
$item['executablePaths'],
);
$testedMethodsPercentage = Percentage::fromFractionAndTotal(
$numTestedMethods,
1
1,
);
return $this->renderItemTemplate(
@@ -473,7 +473,7 @@ final class File extends Renderer
$indent,
$item['startLine'],
htmlspecialchars($item['signature'], $this->htmlSpecialCharsFlags),
$item['functionName'] ?? $item['methodName']
$item['functionName'] ?? $item['methodName'],
),
'numMethods' => $numMethods,
'numTestedMethods' => $numTestedMethods,
@@ -492,7 +492,7 @@ final class File extends Renderer
'testedMethodsPercent' => $testedMethodsPercentage->asFloat(),
'testedMethodsPercentAsString' => $testedMethodsPercentage->asString(),
'crap' => $item['crap'],
]
],
);
}
@@ -550,7 +550,7 @@ final class File extends Renderer
$popover = sprintf(
' data-title="%s" data-content="%s" data-placement="top" data-html="true"',
$popoverTitle,
htmlspecialchars($popoverContent, $this->htmlSpecialCharsFlags)
htmlspecialchars($popoverContent, $this->htmlSpecialCharsFlags),
);
}
@@ -637,7 +637,7 @@ final class File extends Renderer
$popover = sprintf(
' data-title="%s" data-content="%s" data-placement="top" data-html="true"',
$popoverTitle,
htmlspecialchars($popoverContent, $this->htmlSpecialCharsFlags)
htmlspecialchars($popoverContent, $this->htmlSpecialCharsFlags),
);
}
@@ -727,7 +727,7 @@ final class File extends Renderer
$popover = sprintf(
' data-title="%s" data-content="%s" data-placement="top" data-html="true"',
$popoverTitle,
htmlspecialchars($popoverContent, $this->htmlSpecialCharsFlags)
htmlspecialchars($popoverContent, $this->htmlSpecialCharsFlags),
);
}
@@ -825,7 +825,7 @@ final class File extends Renderer
$popover = sprintf(
' data-title="%s" data-content="%s" data-placement="top" data-html="true"',
$popoverTitle,
htmlspecialchars($popoverContent, $this->htmlSpecialCharsFlags)
htmlspecialchars($popoverContent, $this->htmlSpecialCharsFlags),
);
}
@@ -940,7 +940,7 @@ final class File extends Renderer
$popover = sprintf(
' data-title="%s" data-content="%s" data-placement="top" data-html="true"',
$popoverTitle,
htmlspecialchars($popoverContent, $this->htmlSpecialCharsFlags)
htmlspecialchars($popoverContent, $this->htmlSpecialCharsFlags),
);
}
@@ -965,7 +965,7 @@ final class File extends Renderer
'lineContent' => $lineContent,
'class' => $class,
'popover' => $popover,
]
],
);
return $template->render();
@@ -991,14 +991,14 @@ final class File extends Renderer
if ($token === '"' && $tokens[$j - 1] !== '\\') {
$result[$i] .= sprintf(
'<span class="string">%s</span>',
htmlspecialchars($token, $this->htmlSpecialCharsFlags)
htmlspecialchars($token, $this->htmlSpecialCharsFlags),
);
$stringFlag = !$stringFlag;
} else {
$result[$i] .= sprintf(
'<span class="keyword">%s</span>',
htmlspecialchars($token, $this->htmlSpecialCharsFlags)
htmlspecialchars($token, $this->htmlSpecialCharsFlags),
);
}
@@ -1010,7 +1010,7 @@ final class File extends Renderer
$value = str_replace(
["\t", ' '],
['&nbsp;&nbsp;&nbsp;&nbsp;', '&nbsp;'],
htmlspecialchars($value, $this->htmlSpecialCharsFlags)
htmlspecialchars($value, $this->htmlSpecialCharsFlags),
);
if ($value === "\n") {
@@ -1039,7 +1039,7 @@ final class File extends Renderer
$result[$i] .= sprintf(
'<span class="%s">%s</span>',
$colour,
$line
$line,
);
}
@@ -1067,7 +1067,7 @@ final class File extends Renderer
$className = sprintf(
'<abbr title="%s">%s</abbr>',
$className,
array_pop($tmp)
array_pop($tmp),
);
}
@@ -1109,7 +1109,7 @@ final class File extends Renderer
return sprintf(
'<li%s>%s</li>',
$testCSS,
htmlspecialchars($test, $this->htmlSpecialCharsFlags)
htmlspecialchars($test, $this->htmlSpecialCharsFlags),
);
}

View File

@@ -12,7 +12,7 @@ namespace SebastianBergmann\CodeCoverage\Report;
use function dirname;
use function file_put_contents;
use function serialize;
use function strpos;
use function str_contains;
use SebastianBergmann\CodeCoverage\CodeCoverage;
use SebastianBergmann\CodeCoverage\Driver\WriteOperationFailedException;
use SebastianBergmann\CodeCoverage\Util\Filesystem;
@@ -27,7 +27,7 @@ final class PHP
return \unserialize(<<<'END_OF_COVERAGE_SERIALIZATION'" . PHP_EOL . serialize($coverage) . PHP_EOL . 'END_OF_COVERAGE_SERIALIZATION' . PHP_EOL . ');';
if ($target !== null) {
if (!strpos($target, '://') !== false) {
if (!str_contains($target, '://')) {
Filesystem::createDirectory(dirname($target));
}

View File

@@ -78,27 +78,27 @@ final class Text
if ($showColors) {
$colors['classes'] = $this->coverageColor(
$report->numberOfTestedClassesAndTraits(),
$report->numberOfClassesAndTraits()
$report->numberOfClassesAndTraits(),
);
$colors['methods'] = $this->coverageColor(
$report->numberOfTestedMethods(),
$report->numberOfMethods()
$report->numberOfMethods(),
);
$colors['lines'] = $this->coverageColor(
$report->numberOfExecutedLines(),
$report->numberOfExecutableLines()
$report->numberOfExecutableLines(),
);
$colors['branches'] = $this->coverageColor(
$report->numberOfExecutedBranches(),
$report->numberOfExecutableBranches()
$report->numberOfExecutableBranches(),
);
$colors['paths'] = $this->coverageColor(
$report->numberOfExecutedPaths(),
$report->numberOfExecutablePaths()
$report->numberOfExecutablePaths(),
);
$colors['reset'] = self::COLOR_RESET;
@@ -109,10 +109,10 @@ final class Text
' Classes: %6s (%d/%d)',
Percentage::fromFractionAndTotal(
$report->numberOfTestedClassesAndTraits(),
$report->numberOfClassesAndTraits()
$report->numberOfClassesAndTraits(),
)->asString(),
$report->numberOfTestedClassesAndTraits(),
$report->numberOfClassesAndTraits()
$report->numberOfClassesAndTraits(),
);
$methods = sprintf(
@@ -122,7 +122,7 @@ final class Text
$report->numberOfMethods(),
)->asString(),
$report->numberOfTestedMethods(),
$report->numberOfMethods()
$report->numberOfMethods(),
);
$paths = '';
@@ -136,7 +136,7 @@ final class Text
$report->numberOfExecutablePaths(),
)->asString(),
$report->numberOfExecutedPaths(),
$report->numberOfExecutablePaths()
$report->numberOfExecutablePaths(),
);
$branches = sprintf(
@@ -146,7 +146,7 @@ final class Text
$report->numberOfExecutableBranches(),
)->asString(),
$report->numberOfExecutedBranches(),
$report->numberOfExecutableBranches()
$report->numberOfExecutableBranches(),
);
}
@@ -157,7 +157,7 @@ final class Text
$report->numberOfExecutableLines(),
)->asString(),
$report->numberOfExecutedLines(),
$report->numberOfExecutableLines()
$report->numberOfExecutableLines(),
);
$padding = max(array_map('strlen', [$classes, $methods, $lines]));
@@ -215,12 +215,12 @@ final class Text
}
$classMethods++;
$classExecutableLines += $method['executableLines'];
$classExecutedLines += $method['executedLines'];
$classExecutableLines += $method['executableLines'];
$classExecutedLines += $method['executedLines'];
$classExecutableBranches += $method['executableBranches'];
$classExecutedBranches += $method['executedBranches'];
$classExecutablePaths += $method['executablePaths'];
$classExecutedPaths += $method['executedPaths'];
$classExecutedBranches += $method['executedBranches'];
$classExecutablePaths += $method['executablePaths'];
$classExecutedPaths += $method['executedPaths'];
if ($method['coverage'] == 100) {
$coveredMethods++;
@@ -278,7 +278,7 @@ final class Text
{
$coverage = Percentage::fromFractionAndTotal(
$numberOfCoveredElements,
$totalNumberOfElements
$totalNumberOfElements,
);
if ($coverage->asFloat() >= $this->thresholds->highLowerBound()) {
@@ -298,16 +298,18 @@ final class Text
return Percentage::fromFractionAndTotal(
$numberOfCoveredElements,
$totalNumberOfElements
$totalNumberOfElements,
)->asFixedWidthString() .
' (' . sprintf($format, $numberOfCoveredElements) . '/' .
sprintf($format, $totalNumberOfElements) . ')';
}
private function format(string $color, int $padding, string|false $string): string
private function format(string $color, int $padding, false|string $string): string
{
$reset = $color ? self::COLOR_RESET : '';
if ($color === '') {
return (string) $string . PHP_EOL;
}
return $color . str_pad((string) $string, $padding) . $reset . PHP_EOL;
return $color . str_pad((string) $string, $padding) . self::COLOR_RESET . PHP_EOL;
}
}

View File

@@ -31,7 +31,7 @@ final class Thresholds
{
if ($lowUpperBound > $highLowerBound) {
throw new InvalidArgumentException(
'$lowUpperBound must not be larger than $highLowerBound'
'$lowUpperBound must not be larger than $highLowerBound',
);
}

View File

@@ -62,15 +62,15 @@ final class BuildInformation
{
$node = $this->contextNode->getElementsByTagNameNS(
'https://schema.phpunit.de/coverage/1.0',
$name
$name,
)->item(0);
if (!$node) {
$node = $this->contextNode->appendChild(
$this->contextNode->ownerDocument->createElementNS(
'https://schema.phpunit.de/coverage/1.0',
$name
)
$name,
),
);
}

View File

@@ -55,7 +55,7 @@ final class Coverage
$this->contextNode->parentNode->replaceChild(
$fragment,
$this->contextNode
$this->contextNode,
);
$this->finalized = true;

View File

@@ -64,7 +64,7 @@ final class Facade
$report = $coverage->getReport();
$this->project = new Project(
$coverage->getReport()->name()
$coverage->getReport()->name(),
);
$this->setBuildInformation();
@@ -132,14 +132,14 @@ final class Facade
{
$fileObject = $context->addFile(
$file->name(),
$file->id() . '.xml'
$file->id() . '.xml',
);
$this->setTotals($file, $fileObject->totals());
$path = substr(
$file->pathAsString(),
strlen($this->project->projectSourceDirectory())
strlen($this->project->projectSourceDirectory()),
);
$fileReport = new Report($path);
@@ -169,7 +169,7 @@ final class Facade
}
$fileReport->source()->setSourceCode(
file_get_contents($file->pathAsString())
file_get_contents($file->pathAsString()),
);
$this->saveDocument($fileReport->asDom(), $file->id());
@@ -186,7 +186,7 @@ final class Facade
$unitObject->setLines(
$unit['startLine'],
$unit['executableLines'],
$unit['executedLines']
$unit['executedLines'],
);
$unitObject->setCrap((float) $unit['crap']);
@@ -200,7 +200,7 @@ final class Facade
$methodObject->setTotals(
(string) $method['executableLines'],
(string) $method['executedLines'],
(string) $method['coverage']
(string) $method['coverage'],
);
}
}
@@ -233,27 +233,27 @@ final class Facade
$loc['commentLinesOfCode'],
$loc['nonCommentLinesOfCode'],
$node->numberOfExecutableLines(),
$node->numberOfExecutedLines()
$node->numberOfExecutedLines(),
);
$totals->setNumClasses(
$node->numberOfClasses(),
$node->numberOfTestedClasses()
$node->numberOfTestedClasses(),
);
$totals->setNumTraits(
$node->numberOfTraits(),
$node->numberOfTestedTraits()
$node->numberOfTestedTraits(),
);
$totals->setNumMethods(
$node->numberOfMethods(),
$node->numberOfTestedMethods()
$node->numberOfTestedMethods(),
);
$totals->setNumFunctions(
$node->numberOfFunctions(),
$node->numberOfTestedFunctions()
$node->numberOfTestedFunctions(),
);
}

View File

@@ -34,8 +34,8 @@ class File
$totalsContainer = $this->contextNode->appendChild(
$this->dom->createElementNS(
'https://schema.phpunit.de/coverage/1.0',
'totals'
)
'totals',
),
);
}
@@ -46,23 +46,23 @@ class File
{
$coverage = $this->contextNode->getElementsByTagNameNS(
'https://schema.phpunit.de/coverage/1.0',
'coverage'
'coverage',
)->item(0);
if (!$coverage) {
$coverage = $this->contextNode->appendChild(
$this->dom->createElementNS(
'https://schema.phpunit.de/coverage/1.0',
'coverage'
)
'coverage',
),
);
}
$lineNode = $coverage->appendChild(
$this->dom->createElementNS(
'https://schema.phpunit.de/coverage/1.0',
'line'
)
'line',
),
);
return new Coverage($lineNode, $line);

View File

@@ -38,8 +38,8 @@ abstract class Node
$totalsContainer = $this->contextNode()->appendChild(
$this->dom->createElementNS(
'https://schema.phpunit.de/coverage/1.0',
'totals'
)
'totals',
),
);
}
@@ -50,7 +50,7 @@ abstract class Node
{
$dirNode = $this->dom()->createElementNS(
'https://schema.phpunit.de/coverage/1.0',
'directory'
'directory',
);
$dirNode->setAttribute('name', $name);
@@ -63,7 +63,7 @@ abstract class Node
{
$fileNode = $this->dom()->createElementNS(
'https://schema.phpunit.de/coverage/1.0',
'file'
'file',
);
$fileNode->setAttribute('name', $name);

View File

@@ -31,15 +31,15 @@ final class Project extends Node
{
$buildNode = $this->dom()->getElementsByTagNameNS(
'https://schema.phpunit.de/coverage/1.0',
'build'
'build',
)->item(0);
if (!$buildNode) {
$buildNode = $this->dom()->documentElement->appendChild(
$this->dom()->createElementNS(
'https://schema.phpunit.de/coverage/1.0',
'build'
)
'build',
),
);
}
@@ -50,15 +50,15 @@ final class Project extends Node
{
$testsNode = $this->contextNode()->getElementsByTagNameNS(
'https://schema.phpunit.de/coverage/1.0',
'tests'
'tests',
)->item(0);
if (!$testsNode) {
$testsNode = $this->contextNode()->appendChild(
$this->dom()->createElementNS(
'https://schema.phpunit.de/coverage/1.0',
'tests'
)
'tests',
),
);
}
@@ -78,8 +78,8 @@ final class Project extends Node
$this->setContextNode(
$dom->getElementsByTagNameNS(
'https://schema.phpunit.de/coverage/1.0',
'project'
)->item(0)
'project',
)->item(0),
);
}

View File

@@ -25,7 +25,7 @@ final class Report extends File
$contextNode = $dom->getElementsByTagNameNS(
'https://schema.phpunit.de/coverage/1.0',
'file'
'file',
)->item(0);
parent::__construct($contextNode);
@@ -43,8 +43,8 @@ final class Report extends File
$node = $this->contextNode()->appendChild(
$this->dom()->createElementNS(
'https://schema.phpunit.de/coverage/1.0',
'function'
)
'function',
),
);
return new Method($node, $name);
@@ -64,15 +64,15 @@ final class Report extends File
{
$source = $this->contextNode()->getElementsByTagNameNS(
'https://schema.phpunit.de/coverage/1.0',
'source'
'source',
)->item(0);
if (!$source) {
$source = $this->contextNode()->appendChild(
$this->dom()->createElementNS(
'https://schema.phpunit.de/coverage/1.0',
'source'
)
'source',
),
);
}
@@ -90,8 +90,8 @@ final class Report extends File
$node = $this->contextNode()->appendChild(
$this->dom()->createElementNS(
'https://schema.phpunit.de/coverage/1.0',
$tagName
)
$tagName,
),
);
return new Unit($node, $name);

View File

@@ -35,7 +35,7 @@ final class Source
$context->parentNode->replaceChild(
$context->ownerDocument->importNode($srcDom->documentElement, true),
$context
$context,
);
}
}

View File

@@ -33,8 +33,8 @@ final class Tests
$node = $this->contextNode->appendChild(
$this->contextNode->ownerDocument->createElementNS(
'https://schema.phpunit.de/coverage/1.0',
'test'
)
'test',
),
);
$node->setAttribute('name', $test);

View File

@@ -33,27 +33,27 @@ final class Totals
$this->linesNode = $dom->createElementNS(
'https://schema.phpunit.de/coverage/1.0',
'lines'
'lines',
);
$this->methodsNode = $dom->createElementNS(
'https://schema.phpunit.de/coverage/1.0',
'methods'
'methods',
);
$this->functionsNode = $dom->createElementNS(
'https://schema.phpunit.de/coverage/1.0',
'functions'
'functions',
);
$this->classesNode = $dom->createElementNS(
'https://schema.phpunit.de/coverage/1.0',
'classes'
'classes',
);
$this->traitsNode = $dom->createElementNS(
'https://schema.phpunit.de/coverage/1.0',
'traits'
'traits',
);
$container->appendChild($this->linesNode);
@@ -77,7 +77,7 @@ final class Totals
$this->linesNode->setAttribute('executed', (string) $executed);
$this->linesNode->setAttribute(
'percent',
$executable === 0 ? '0' : sprintf('%01.2F', Percentage::fromFractionAndTotal($executed, $executable)->asFloat())
$executable === 0 ? '0' : sprintf('%01.2F', Percentage::fromFractionAndTotal($executed, $executable)->asFloat()),
);
}
@@ -87,7 +87,7 @@ final class Totals
$this->classesNode->setAttribute('tested', (string) $tested);
$this->classesNode->setAttribute(
'percent',
$count === 0 ? '0' : sprintf('%01.2F', Percentage::fromFractionAndTotal($tested, $count)->asFloat())
$count === 0 ? '0' : sprintf('%01.2F', Percentage::fromFractionAndTotal($tested, $count)->asFloat()),
);
}
@@ -97,7 +97,7 @@ final class Totals
$this->traitsNode->setAttribute('tested', (string) $tested);
$this->traitsNode->setAttribute(
'percent',
$count === 0 ? '0' : sprintf('%01.2F', Percentage::fromFractionAndTotal($tested, $count)->asFloat())
$count === 0 ? '0' : sprintf('%01.2F', Percentage::fromFractionAndTotal($tested, $count)->asFloat()),
);
}
@@ -107,7 +107,7 @@ final class Totals
$this->methodsNode->setAttribute('tested', (string) $tested);
$this->methodsNode->setAttribute(
'percent',
$count === 0 ? '0' : sprintf('%01.2F', Percentage::fromFractionAndTotal($tested, $count)->asFloat())
$count === 0 ? '0' : sprintf('%01.2F', Percentage::fromFractionAndTotal($tested, $count)->asFloat()),
);
}
@@ -117,7 +117,7 @@ final class Totals
$this->functionsNode->setAttribute('tested', (string) $tested);
$this->functionsNode->setAttribute(
'percent',
$count === 0 ? '0' : sprintf('%01.2F', Percentage::fromFractionAndTotal($tested, $count)->asFloat())
$count === 0 ? '0' : sprintf('%01.2F', Percentage::fromFractionAndTotal($tested, $count)->asFloat()),
);
}
}

View File

@@ -41,15 +41,15 @@ final class Unit
{
$node = $this->contextNode->getElementsByTagNameNS(
'https://schema.phpunit.de/coverage/1.0',
'namespace'
'namespace',
)->item(0);
if (!$node) {
$node = $this->contextNode->appendChild(
$this->contextNode->ownerDocument->createElementNS(
'https://schema.phpunit.de/coverage/1.0',
'namespace'
)
'namespace',
),
);
}
@@ -61,8 +61,8 @@ final class Unit
$node = $this->contextNode->appendChild(
$this->contextNode->ownerDocument->createElementNS(
'https://schema.phpunit.de/coverage/1.0',
'method'
)
'method',
),
);
return new Method($node, $name);

View File

@@ -19,7 +19,7 @@ final class CacheWarmer
$cacheDirectory,
new ParsingFileAnalyser(
$useAnnotationsForIgnoringCode,
$ignoreDeprecatedCode
$ignoreDeprecatedCode,
),
$useAnnotationsForIgnoringCode,
$ignoreDeprecatedCode,

View File

@@ -132,7 +132,7 @@ final class CachingFileAnalyser implements FileAnalyser
return unserialize(
file_get_contents($cacheFile),
['allowed_classes' => false]
['allowed_classes' => false],
);
}
@@ -140,7 +140,7 @@ final class CachingFileAnalyser implements FileAnalyser
{
file_put_contents(
$this->cacheFile($filename),
serialize($data)
serialize($data),
);
}
@@ -155,8 +155,8 @@ final class CachingFileAnalyser implements FileAnalyser
self::cacheVersion(),
$this->useAnnotationsForIgnoringCode,
$this->ignoreDeprecatedCode,
]
)
],
),
);
return $this->directory . DIRECTORY_SEPARATOR . $cacheKey;

View File

@@ -193,7 +193,7 @@ final class CodeUnitFindingVisitor extends NodeVisitorAbstract
return $signature;
}
private function type(Identifier|Name|ComplexType $type): string
private function type(ComplexType|Identifier|Name $type): string
{
if ($type instanceof NullableType) {
return '?' . $type->type;

View File

@@ -105,7 +105,6 @@ final class ExecutableLinesFindingVisitor extends NodeVisitorAbstract
$node instanceof Node\Stmt\Use_ ||
$node instanceof Node\Stmt\UseUse ||
$node instanceof Node\Expr\ConstFetch ||
$node instanceof Node\Expr\Match_ ||
$node instanceof Node\Expr\Variable ||
$node instanceof Node\Expr\Throw_ ||
$node instanceof Node\ComplexType ||
@@ -117,6 +116,18 @@ final class ExecutableLinesFindingVisitor extends NodeVisitorAbstract
return;
}
if ($node instanceof Node\Expr\Match_) {
foreach ($node->arms as $arm) {
$this->setLineBranch(
$arm->body->getStartLine(),
$arm->body->getEndLine(),
++$this->nextBranch,
);
}
return;
}
/*
* nikic/php-parser ^4.18 represents <code>throw</code> statements
* as <code>Stmt\Throw_</code> objects
@@ -206,7 +217,7 @@ final class ExecutableLinesFindingVisitor extends NodeVisitorAbstract
if ($node instanceof Node\Expr\ArrowFunction) {
$startLine = max(
$node->getStartLine() + 1,
$node->expr->getStartLine()
$node->expr->getStartLine(),
);
$endLine = $node->expr->getEndLine();
@@ -251,7 +262,7 @@ final class ExecutableLinesFindingVisitor extends NodeVisitorAbstract
$this->setLineBranch(
$node->cond->getStartLine(),
$node->cond->getStartLine(),
++$this->nextBranch
++$this->nextBranch,
);
return;
@@ -302,7 +313,7 @@ final class ExecutableLinesFindingVisitor extends NodeVisitorAbstract
$this->setLineBranch(
$startLine,
$endLine,
++$this->nextBranch
++$this->nextBranch,
);
return;
@@ -312,7 +323,7 @@ final class ExecutableLinesFindingVisitor extends NodeVisitorAbstract
$this->setLineBranch(
$node->expr->getStartLine(),
$node->valueVar->getEndLine(),
++$this->nextBranch
++$this->nextBranch,
);
return;
@@ -323,7 +334,7 @@ final class ExecutableLinesFindingVisitor extends NodeVisitorAbstract
$this->setLineBranch(
$node->cond->getStartLine(),
$node->cond->getEndLine(),
++$this->nextBranch
++$this->nextBranch,
);
return;
@@ -338,7 +349,7 @@ final class ExecutableLinesFindingVisitor extends NodeVisitorAbstract
$this->setLineBranch(
$startLine,
$endLine,
++$this->nextBranch
++$this->nextBranch,
);
return;
@@ -381,7 +392,7 @@ final class ExecutableLinesFindingVisitor extends NodeVisitorAbstract
$this->executableLinesGroupedByBranch = array_diff_key(
$this->executableLinesGroupedByBranch,
$this->unsets
$this->unsets,
);
}

View File

@@ -15,6 +15,7 @@ use PhpParser\Node;
use PhpParser\Node\Attribute;
use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Enum_;
use PhpParser\Node\Stmt\Function_;
use PhpParser\Node\Stmt\Interface_;
use PhpParser\Node\Stmt\Trait_;
@@ -43,6 +44,7 @@ final class IgnoredLinesFindingVisitor extends NodeVisitorAbstract
if (!$node instanceof Class_ &&
!$node instanceof Trait_ &&
!$node instanceof Interface_ &&
!$node instanceof Enum_ &&
!$node instanceof ClassMethod &&
!$node instanceof Function_ &&
!$node instanceof Attribute) {

View File

@@ -167,10 +167,10 @@ final class ParsingFileAnalyser implements FileAnalyser
sprintf(
'Cannot parse %s: %s',
$filename,
$error->getMessage()
$error->getMessage(),
),
$error->getCode(),
$error
$error,
);
}
// @codeCoverageIgnoreEnd
@@ -186,8 +186,8 @@ final class ParsingFileAnalyser implements FileAnalyser
$this->ignoredLines[$filename] = array_unique(
array_merge(
$this->ignoredLines[$filename],
$ignoredLinesFindingVisitor->ignoredLines()
)
$ignoredLinesFindingVisitor->ignoredLines(),
),
);
sort($this->ignoredLines[$filename]);
@@ -239,7 +239,7 @@ final class ParsingFileAnalyser implements FileAnalyser
$this->ignoredLines[$filename] = array_merge(
$this->ignoredLines[$filename],
range($start, $token[2])
range($start, $token[2]),
);
}
}

View File

@@ -23,14 +23,14 @@ final class Filesystem
*/
public static function createDirectory(string $directory): void
{
$success = !(!is_dir($directory) && !@mkdir($directory, 0777, true) && !is_dir($directory));
$success = !(!is_dir($directory) && !@mkdir($directory, 0o777, true) && !is_dir($directory));
if (!$success) {
throw new DirectoryCouldNotBeCreatedException(
sprintf(
'Directory "%s" could not be created',
$directory
)
$directory,
),
);
}
}

View File

@@ -19,7 +19,7 @@ final class Version
public static function id(): string
{
if (self::$version === '') {
self::$version = (new VersionId('10.1.11', dirname(__DIR__)))->asString();
self::$version = (new VersionId('10.1.16', dirname(__DIR__)))->asString();
}
return self::$version;

View File

@@ -1,38 +0,0 @@
<?php
namespace PHPSTORM_META {
override(
\PHPUnit\Framework\TestCase::createStub(0),
map([""=>"$0"])
);
override(
\PHPUnit\Framework\TestCase::createConfiguredStub(0),
map([""=>"$0"])
);
override(
\PHPUnit\Framework\TestCase::createMock(0),
map([""=>"$0"])
);
override(
\PHPUnit\Framework\TestCase::createConfiguredMock(0),
map([""=>"$0"])
);
override(
\PHPUnit\Framework\TestCase::createPartialMock(0),
map([""=>"$0"])
);
override(
\PHPUnit\Framework\TestCase::createTestProxy(0),
map([""=>"$0"])
);
override(
\PHPUnit\Framework\TestCase::getMockForAbstractClass(0),
map([""=>"$0"])
);
}

View File

@@ -2,8 +2,321 @@
All notable changes of the PHPUnit 10.5 release series are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.
## [10.5.46] - 2025-05-02
### Added
* `displayDetailsOnAllIssues` attribute on the `<phpunit>` element of the XML configuration file and `--display-all-issues` CLI option for controlling whether PHPUnit should display details on all issues that are triggered (default: `false`)
* `failOnAllIssues` attribute on the `<phpunit>` element of the XML configuration file and `--fail-on-all-issues` CLI option for controlling whether PHPUnit should fail on all issues that are triggered (default: `false`)
### Changed
* [#5956](https://github.com/sebastianbergmann/phpunit/issues/5956): Improved handling of deprecated `E_STRICT` constant
* Improved message when test is considered risky for printing unexpected output
## [10.5.45] - 2025-02-06
### Changed
* [#6117](https://github.com/sebastianbergmann/phpunit/issues/6117): Include source location information for issues triggered during test in `--debug` output
* [#6119](https://github.com/sebastianbergmann/phpunit/issues/6119): Improve message for errors that occur while parsing attributes
## [10.5.44] - 2025-01-31
### Fixed
* [#6115](https://github.com/sebastianbergmann/phpunit/issues/6115): Backed enumerations with values not of type `string` cannot be used in customized TestDox output
## [10.5.43] - 2025-01-29
### Changed
* Do not skip execution of test that depends on a test that is larger than itself
## [10.5.42] - 2025-01-28
### Fixed
* [#6103](https://github.com/sebastianbergmann/phpunit/issues/6103): Output from test run in separate process is printed twice
* [#6109](https://github.com/sebastianbergmann/phpunit/issues/6109): Skipping a test in a before-class method crashes JUnit XML logger
* [#6111](https://github.com/sebastianbergmann/phpunit/issues/6111): Deprecations cause `SourceMapper` to scan all `<source/>` files
## [10.5.41] - 2025-01-13
### Added
* `Test\AfterLastTestMethodErrored`, `Test\AfterTestMethodErrored`, `Test\BeforeTestMethodErrored`, `Test\PostConditionErrored`, and `Test\PreConditionErrored` events
### Fixed
* [#6094](https://github.com/sebastianbergmann/phpunit/issues/6094): Errors in after-last-test methods are not reported
* [#6095](https://github.com/sebastianbergmann/phpunit/issues/6095): Expectation is not counted correctly when a doubled method is called more often than is expected
* [#6098](https://github.com/sebastianbergmann/phpunit/issues/6098): No `system-out` element in JUnit XML logfile
## [10.5.40] - 2024-12-21
### Fixed
* [#6082](https://github.com/sebastianbergmann/phpunit/issues/6082): `assertArrayHasKey()`, `assertArrayNotHasKey()`, `arrayHasKey()`, and `ArrayHasKey::__construct()` do not support all possible key types
* [#6087](https://github.com/sebastianbergmann/phpunit/issues/6087): `--migrate-configuration` does not remove `beStrictAboutTodoAnnotatedTests` attribute from XML configuration file
## [10.5.39] - 2024-12-11
### Added
* [#6081](https://github.com/sebastianbergmann/phpunit/pull/6081): `DefaultResultCache::mergeWith()` for merging result cache instances
### Fixed
* [#6066](https://github.com/sebastianbergmann/phpunit/pull/6066): TeamCity logger does not handle error/skipped events in before-class methods correctly
## [10.5.38] - 2024-10-28
### Changed
* [#6012](https://github.com/sebastianbergmann/phpunit/pull/6012): Remove empty lines between TeamCity events
## [10.5.37] - 2024-10-19
### Fixed
* [#5982](https://github.com/sebastianbergmann/phpunit/pull/5982): Typo in exception message
## [10.5.36] - 2024-10-08
### Changed
* [#5957](https://github.com/sebastianbergmann/phpunit/pull/5957): Skip data provider build when requirements are not satisfied
* [#5969](https://github.com/sebastianbergmann/phpunit/pull/5969): Check for requirements before creating a separate process
* Updated regular expressions used by `StringMatchesFormatDescription` constraint to be consistent with PHP's `run-tests.php`
### Fixed
* [#5965](https://github.com/sebastianbergmann/phpunit/issues/5965): `PHPUnit\Framework\Exception` does not handle string error codes (`PDOException` with error code `'HY000'`, for example)
## [10.5.35] - 2024-09-19
### Changed
* [#5956](https://github.com/sebastianbergmann/phpunit/issues/5956): Deprecation of the `E_STRICT` constant in PHP 8.4
### Fixed
* [#5950](https://github.com/sebastianbergmann/phpunit/pull/5950): TestDox text should not be `trim()`med when it contains `$` character
* The attribute parser will no longer try to instantiate attribute classes that do not exist
## [10.5.34] - 2024-09-13
### Fixed
* [#5931](https://github.com/sebastianbergmann/phpunit/pull/5931): Reverted addition of `name` property on `<testsuites>` element in JUnit XML logfile
* [#5946](https://github.com/sebastianbergmann/phpunit/issues/5946): `Callback` throws a `TypeError` when checking a `callable` has variadic parameters
## [10.5.33] - 2024-09-09
### Fixed
* [#4584](https://github.com/sebastianbergmann/phpunit/issues/4584): `assertJsonStringEqualsJsonString()` considers objects with sequential numeric keys equal to be arrays
* [#4625](https://github.com/sebastianbergmann/phpunit/issues/4625): Generator yielding keys that are neither integer or string leads to hard-to-understand error message when used as data provider
* [#4674](https://github.com/sebastianbergmann/phpunit/issues/4674): JSON assertions should treat objects as unordered
* [#5891](https://github.com/sebastianbergmann/phpunit/issues/5891): `Callback` constraint does not handle variadic arguments correctly when used for mock object expectations
* [#5929](https://github.com/sebastianbergmann/phpunit/issues/5929): TestDox output containing `$` at the beginning gets truncated when used with a data provider
## [10.5.32] - 2024-09-04
### Added
* [#5937](https://github.com/sebastianbergmann/phpunit/issues/5937): `failOnPhpunitDeprecation` attribute on the `<phpunit>` element of the XML configuration file and `--fail-on-phpunit-deprecation` CLI option for controlling whether PHPUnit deprecations should be considered when determining the test runner's shell exit code (default: do not consider)
* `displayDetailsOnPhpunitDeprecations` attribute on the `<phpunit>` element of the XML configuration file and `--display-phpunit-deprecations` CLI option for controlling whether details on PHPUnit deprecations should be displayed (default: do not display)
### Changed
* [#5937](https://github.com/sebastianbergmann/phpunit/issues/5937): PHPUnit deprecations will, by default, no longer affect the test runner's shell exit code. This can optionally be turned back on using the `--fail-on-phpunit-deprecation` CLI option or the `failOnPhpunitDeprecation="true"` attribute on the `<phpunit>` element of the XML configuration file.
* Details for PHPUnit deprecations will, by default, no longer be displayed. This can optionally be turned back on using the `--display-phpunit-deprecations` CLI option or the `displayDetailsOnPhpunitDeprecations` attribute on the `<phpunit>` element of the XML configuration file.
## [10.5.31] - 2024-09-03
### Changed
* [#5931](https://github.com/sebastianbergmann/phpunit/pull/5931): `name` property on `<testsuites>` element in JUnit XML logfile
* Removed `.phpstorm.meta.php` file as methods such as `TestCase::createStub()` use generics / template types for their return types and PhpStorm, for example, uses that information
### Fixed
* [#5884](https://github.com/sebastianbergmann/phpunit/issues/5884): TestDox printer does not consider that issues can be suppressed by attribute, baseline, source location, or `@` operator
## [10.5.30] - 2024-08-13
### Changed
* Improved error message when stubbed method is called more often than return values were configured for it
## [10.5.29] - 2024-07-30
### Fixed
* [#5887](https://github.com/sebastianbergmann/phpunit/pull/5887): Issue baseline generator does not correctly handle ignoring suppressed issues
* [#5908](https://github.com/sebastianbergmann/phpunit/issues/5908): `--list-tests` and `--list-tests-xml` CLI options do not report error when data provider method throws exception
## [10.5.28] - 2024-07-18
### Fixed
* [#5898](https://github.com/sebastianbergmann/phpunit/issues/5898): `Test\Passed` event is not emitted for PHPT tests
* `--coverage-filter` CLI option could not be used multiple times
## [10.5.27] - 2024-07-10
### Changed
* Updated dependencies (so that users that install using Composer's `--prefer-lowest` CLI option also get recent versions)
### Fixed
* [#5892](https://github.com/sebastianbergmann/phpunit/issues/5892): Errors during write of `phpunit.xml` are not handled correctly when `--generate-configuration` is used
## [10.5.26] - 2024-07-08
### Added
* `--only-summary-for-coverage-text` CLI option to reduce the code coverage report in text format to a summary
* `--show-uncovered-for-coverage-text` CLI option to expand the code coverage report in text format to include a list of uncovered files
## [10.5.25] - 2024-07-03
### Changed
* Updated dependencies for PHAR distribution
## [10.5.24] - 2024-06-20
### Changed
* [#5877](https://github.com/sebastianbergmann/phpunit/pull/5877): Use `array_pop()` instead of `array_shift()` for processing `Test` objects in `TestSuite::run()` and optimize `TestSuite::isEmpty()`
## [10.5.23] - 2024-06-20
### Changed
* [#5875](https://github.com/sebastianbergmann/phpunit/pull/5875): Also destruct `TestCase` objects early that use a data provider
## [10.5.22] - 2024-06-19
### Changed
* [#5871](https://github.com/sebastianbergmann/phpunit/pull/5871): Do not collect unnecessary information using `debug_backtrace()`
## [10.5.21] - 2024-06-15
### Changed
* [#5861](https://github.com/sebastianbergmann/phpunit/pull/5861): Destroy `TestCase` object after its test was run
## [10.5.20] - 2024-04-24
* [#5771](https://github.com/sebastianbergmann/phpunit/issues/5771): JUnit XML logger may crash when test that is run in separate process exits unexpectedly
* [#5819](https://github.com/sebastianbergmann/phpunit/issues/5819): Duplicate keys from different data providers are not handled properly
## [10.5.19] - 2024-04-17
### Fixed
* [#5818](https://github.com/sebastianbergmann/phpunit/issues/5818): Calling `method()` on a test stub created using `createStubForIntersectionOfInterfaces()` throws an unexpected exception
## [10.5.18] - 2024-04-14
### Deprecated
* [#5812](https://github.com/sebastianbergmann/phpunit/pull/5812): Support for string array keys in data sets returned by data provider methods that do not match the parameter names of the test method(s) that use(s) them
### Fixed
* [#5795](https://github.com/sebastianbergmann/phpunit/issues/5795): Using `@testWith` annotation may generate `PHP Warning: Uninitialized string offset 0`
## [10.5.17] - 2024-04-05
### Changed
* The namespaces of dependencies are now prefixed with `PHPUnitPHAR` instead of just `PHPUnit` for the PHAR distribution of PHPUnit
## [10.5.16] - 2024-03-28
### Changed
* [#5766](https://github.com/sebastianbergmann/phpunit/pull/5766): Do not use a shell in `proc_open()` if not really needed
* [#5772](https://github.com/sebastianbergmann/phpunit/pull/5772): Cleanup process handling after dropping temp-file handling
### Fixed
* [#5570](https://github.com/sebastianbergmann/phpunit/pull/5570): Windows does not support exclusive locks on stdout
## [10.5.15] - 2024-03-22
### Fixed
* [#5765](https://github.com/sebastianbergmann/phpunit/pull/5765): Be more forgiving with error handlers that do not respect error suppression
## [10.5.14] - 2024-03-21
### Changed
* [#5747](https://github.com/sebastianbergmann/phpunit/pull/5747): Cache result of `Groups::groups()`
* [#5748](https://github.com/sebastianbergmann/phpunit/pull/5748): Improve performance of `NamePrettifier::prettifyTestMethodName()`
* [#5750](https://github.com/sebastianbergmann/phpunit/pull/5750): Micro-optimize `NamePrettifier::prettifyTestMethodName()` once again
### Fixed
* [#5760](https://github.com/sebastianbergmann/phpunit/issues/5760): TestDox printer does not display details about exceptions raised in before-test methods
## [10.5.13] - 2024-03-12
### Changed
* [#5727](https://github.com/sebastianbergmann/phpunit/pull/5727): Prevent duplicate call of `NamePrettifier::prettifyTestMethodName()`
* [#5739](https://github.com/sebastianbergmann/phpunit/pull/5739): Micro-optimize `NamePrettifier::prettifyTestMethodName()`
* [#5740](https://github.com/sebastianbergmann/phpunit/pull/5740): Micro-optimize `TestRunner::runTestWithTimeout()`
* [#5741](https://github.com/sebastianbergmann/phpunit/pull/5741): Save call to `Telemetry\System::snapshot()`
* [#5742](https://github.com/sebastianbergmann/phpunit/pull/5742): Prevent file IO when not strictly necessary
* [#5743](https://github.com/sebastianbergmann/phpunit/pull/5743): Prevent unnecessary `ExecutionOrderDependency::getTarget()` call
* [#5744](https://github.com/sebastianbergmann/phpunit/pull/5744): Simplify `NamePrettifier::prettifyTestMethodName()`
### Fixed
* [#5351](https://github.com/sebastianbergmann/phpunit/issues/5351): Incorrect code coverage metadata does not prevent code coverage data from being collected
* [#5746](https://github.com/sebastianbergmann/phpunit/issues/5746): Using `-d` CLI option multiple times triggers warning
## [10.5.12] - 2024-03-09
### Fixed
* [#5652](https://github.com/sebastianbergmann/phpunit/issues/5652): `HRTime::duration()` throws `InvalidArgumentException`
## [10.5.11] - 2024-02-25
### Fixed
* [#5704](https://github.com/sebastianbergmann/phpunit/issues/5704#issuecomment-1951105254): No warning when CLI options are used multiple times
* [#5707](https://github.com/sebastianbergmann/phpunit/issues/5707): `--fail-on-empty-test-suite` CLI option is not documented in `--help` output
* No warning when the `#[CoversClass]` and `#[UsesClass]` attributes are used with the name of an interface
* Resource usage information is printed when the `--debug` CLI option is used
## [10.5.10] - 2024-02-04
### Changed
* Improve output of `--check-version` CLI option
* Improve description of `--check-version` CLI option
### Fixed
* [#5692](https://github.com/sebastianbergmann/phpunit/issues/5692): `--log-events-text` and `--log-events-verbose-text` require the destination file to exit
## [10.5.9] - 2024-01-22
### Changed
* Show help for `--manifest`, `--sbom`, and `--composer-lock` when the PHAR is used
### Fixed
* [#5676](https://github.com/sebastianbergmann/phpunit/issues/5676): PHPUnit's test runner overwrites custom error handler registered using `set_error_handler()` in bootstrap script
@@ -56,6 +369,10 @@ All notable changes of the PHPUnit 10.5 release series are documented in this fi
## [10.5.3] - 2023-12-13
### Changed
* Make PHAR build reproducible (the only remaining differences were in the timestamps for the files in the PHAR)
### Deprecated
* `Test\AssertionFailed` and `Test\AssertionSucceeded` events
@@ -97,6 +414,43 @@ All notable changes of the PHPUnit 10.5 release series are documented in this fi
* [#5563](https://github.com/sebastianbergmann/phpunit/issues/5563): `createMockForIntersectionOfInterfaces()` does not automatically register mock object for expectation verification
[10.5.46]: https://github.com/sebastianbergmann/phpunit/compare/10.5.45...10.5.46
[10.5.45]: https://github.com/sebastianbergmann/phpunit/compare/10.5.44...10.5.45
[10.5.44]: https://github.com/sebastianbergmann/phpunit/compare/10.5.43...10.5.44
[10.5.43]: https://github.com/sebastianbergmann/phpunit/compare/10.5.42...10.5.43
[10.5.42]: https://github.com/sebastianbergmann/phpunit/compare/10.5.41...10.5.42
[10.5.41]: https://github.com/sebastianbergmann/phpunit/compare/10.5.40...10.5.41
[10.5.40]: https://github.com/sebastianbergmann/phpunit/compare/10.5.39...10.5.40
[10.5.39]: https://github.com/sebastianbergmann/phpunit/compare/10.5.38...10.5.39
[10.5.38]: https://github.com/sebastianbergmann/phpunit/compare/10.5.37...10.5.38
[10.5.37]: https://github.com/sebastianbergmann/phpunit/compare/10.5.36...10.5.37
[10.5.36]: https://github.com/sebastianbergmann/phpunit/compare/10.5.35...10.5.36
[10.5.35]: https://github.com/sebastianbergmann/phpunit/compare/10.5.34...10.5.35
[10.5.34]: https://github.com/sebastianbergmann/phpunit/compare/10.5.33...10.5.34
[10.5.33]: https://github.com/sebastianbergmann/phpunit/compare/10.5.32...10.5.33
[10.5.32]: https://github.com/sebastianbergmann/phpunit/compare/10.5.31...10.5.32
[10.5.31]: https://github.com/sebastianbergmann/phpunit/compare/10.5.30...10.5.31
[10.5.30]: https://github.com/sebastianbergmann/phpunit/compare/10.5.29...10.5.30
[10.5.29]: https://github.com/sebastianbergmann/phpunit/compare/10.5.28...10.5.29
[10.5.28]: https://github.com/sebastianbergmann/phpunit/compare/10.5.27...10.5.28
[10.5.27]: https://github.com/sebastianbergmann/phpunit/compare/10.5.26...10.5.27
[10.5.26]: https://github.com/sebastianbergmann/phpunit/compare/10.5.25...10.5.26
[10.5.25]: https://github.com/sebastianbergmann/phpunit/compare/10.5.24...10.5.25
[10.5.24]: https://github.com/sebastianbergmann/phpunit/compare/10.5.23...10.5.24
[10.5.23]: https://github.com/sebastianbergmann/phpunit/compare/10.5.22...10.5.23
[10.5.22]: https://github.com/sebastianbergmann/phpunit/compare/10.5.21...10.5.22
[10.5.21]: https://github.com/sebastianbergmann/phpunit/compare/10.5.20...10.5.21
[10.5.20]: https://github.com/sebastianbergmann/phpunit/compare/10.5.19...10.5.20
[10.5.19]: https://github.com/sebastianbergmann/phpunit/compare/10.5.18...10.5.19
[10.5.18]: https://github.com/sebastianbergmann/phpunit/compare/10.5.17...10.5.18
[10.5.17]: https://github.com/sebastianbergmann/phpunit/compare/10.5.16...10.5.17
[10.5.16]: https://github.com/sebastianbergmann/phpunit/compare/10.5.15...10.5.16
[10.5.15]: https://github.com/sebastianbergmann/phpunit/compare/10.5.14...10.5.15
[10.5.14]: https://github.com/sebastianbergmann/phpunit/compare/10.5.13...10.5.14
[10.5.13]: https://github.com/sebastianbergmann/phpunit/compare/10.5.12...10.5.13
[10.5.12]: https://github.com/sebastianbergmann/phpunit/compare/10.5.11...10.5.12
[10.5.11]: https://github.com/sebastianbergmann/phpunit/compare/10.5.10...10.5.11
[10.5.10]: https://github.com/sebastianbergmann/phpunit/compare/10.5.9...10.5.10
[10.5.9]: https://github.com/sebastianbergmann/phpunit/compare/10.5.8...10.5.9
[10.5.8]: https://github.com/sebastianbergmann/phpunit/compare/10.5.7...10.5.8
[10.5.7]: https://github.com/sebastianbergmann/phpunit/compare/10.5.6...10.5.7

View File

@@ -8,10 +8,10 @@ This functionality is currently [soft-deprecated](https://phpunit.de/backward-co
#### Assertions, Constraints, and Expectations
| Issue | Description | Since | Replacement |
|-------------------------------------------------------------------|------------------------------------------------|--------|-------------|
| [#5472](https://github.com/sebastianbergmann/phpunit/issues/5472) | `TestCase::assertStringNotMatchesFormat()` | 10.4.0 | |
| [#5472](https://github.com/sebastianbergmann/phpunit/issues/5472) | `TestCase::assertStringNotMatchesFormatFile()` | 10.4.0 | |
| Issue | Description | Since | Replacement |
|-------------------------------------------------------------------|----------------------------------------------|--------|-------------|
| [#5472](https://github.com/sebastianbergmann/phpunit/issues/5472) | `Assert::assertStringNotMatchesFormat()` | 10.4.0 | |
| [#5472](https://github.com/sebastianbergmann/phpunit/issues/5472) | `Assert::assertStringNotMatchesFormatFile()` | 10.4.0 | |
#### Test Double API
@@ -86,6 +86,7 @@ This functionality is currently [hard-deprecated](https://phpunit.de/backward-co
#### Miscellaneous
| Issue | Description | Since | Replacement |
|-------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------|--------|-------------|
| [#5100](https://github.com/sebastianbergmann/phpunit/issues/5100) | Support for non-static data provider methods, non-public data provider methods, and data provider methods that declare parameters | 10.0.0 | |
| Issue | Description | Since | Replacement |
|-------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|---------|-------------|
| [#5100](https://github.com/sebastianbergmann/phpunit/issues/5100) | Support for non-static data provider methods, non-public data provider methods, and data provider methods that declare parameters | 10.0.0 | |
| [#5812](https://github.com/sebastianbergmann/phpunit/pull/5812) | Support for string array keys in data sets returned by data provider methods that do not match the parameter names of the test method(s) that use(s) them | 10.5.18 | |

View File

@@ -1,6 +1,6 @@
BSD 3-Clause License
Copyright (c) 2001-2024, Sebastian Bergmann
Copyright (c) 2001-2025, Sebastian Bergmann
All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@@ -1,8 +1,7 @@
# PHPUnit
[![Latest Stable Version](https://poser.pugx.org/phpunit/phpunit/v/stable.png)](https://packagist.org/packages/phpunit/phpunit)
[![Latest Stable Version](https://poser.pugx.org/phpunit/phpunit/v)](https://packagist.org/packages/phpunit/phpunit)
[![CI Status](https://github.com/sebastianbergmann/phpunit/workflows/CI/badge.svg)](https://github.com/sebastianbergmann/phpunit/actions)
[![Type Coverage](https://shepherd.dev/github/sebastianbergmann/phpunit/coverage.svg)](https://shepherd.dev/github/sebastianbergmann/phpunit)
[![codecov](https://codecov.io/gh/sebastianbergmann/phpunit/branch/main/graph/badge.svg)](https://codecov.io/gh/sebastianbergmann/phpunit)
PHPUnit is a programmer-oriented testing framework for PHP. It is an instance of the xUnit architecture for unit testing frameworks.
@@ -19,7 +18,7 @@ $ php phpunit-X.Y.phar --version
Please replace `X.Y` with the version of PHPUnit you are interested in.
Alternatively, you may use [Composer](https://getcomposer.org/) to download and install PHPUnit as well as its dependencies. Please refer to the "[Getting Started](https://phpunit.de/getting-started-with-phpunit.html)" guide for details on how to install PHPUnit.
Alternatively, you may use [Composer](https://getcomposer.org/) to download and install PHPUnit as well as its dependencies. Please refer to the [documentation](https://phpunit.de/documentation.html) for details on how to install PHPUnit.
## Contribute

View File

@@ -29,30 +29,31 @@
"ext-mbstring": "*",
"ext-xml": "*",
"ext-xmlwriter": "*",
"myclabs/deep-copy": "^1.10.1",
"phar-io/manifest": "^2.0.3",
"phar-io/version": "^3.0.2",
"phpunit/php-code-coverage": "^10.1.5",
"phpunit/php-file-iterator": "^4.0",
"phpunit/php-invoker": "^4.0",
"phpunit/php-text-template": "^3.0",
"phpunit/php-timer": "^6.0",
"sebastian/cli-parser": "^2.0",
"sebastian/code-unit": "^2.0",
"sebastian/comparator": "^5.0",
"sebastian/diff": "^5.0",
"sebastian/environment": "^6.0",
"sebastian/exporter": "^5.1",
"sebastian/global-state": "^6.0.1",
"sebastian/object-enumerator": "^5.0",
"sebastian/recursion-context": "^5.0",
"sebastian/type": "^4.0",
"sebastian/version": "^4.0"
"myclabs/deep-copy": "^1.13.1",
"phar-io/manifest": "^2.0.4",
"phar-io/version": "^3.2.1",
"phpunit/php-code-coverage": "^10.1.16",
"phpunit/php-file-iterator": "^4.1.0",
"phpunit/php-invoker": "^4.0.0",
"phpunit/php-text-template": "^3.0.1",
"phpunit/php-timer": "^6.0.0",
"sebastian/cli-parser": "^2.0.1",
"sebastian/code-unit": "^2.0.0",
"sebastian/comparator": "^5.0.3",
"sebastian/diff": "^5.1.1",
"sebastian/environment": "^6.1.0",
"sebastian/exporter": "^5.1.2",
"sebastian/global-state": "^6.0.2",
"sebastian/object-enumerator": "^5.0.0",
"sebastian/recursion-context": "^5.0.0",
"sebastian/type": "^4.0.0",
"sebastian/version": "^4.0.1"
},
"config": {
"platform": {
"php": "8.1.0"
},
"classmap-authoritative": true,
"optimize-autoloader": true,
"sort-packages": true
},
@@ -72,9 +73,13 @@
},
"autoload-dev": {
"classmap": [
"tests/"
"tests/_files"
],
"files": [
"tests/unit/Event/AbstractEventTestCase.php",
"tests/unit/Framework/MockObject/TestDoubleTestCase.php",
"tests/unit/Metadata/Parser/AnnotationParserTestCase.php",
"tests/unit/Metadata/Parser/AttributeParserTestCase.php",
"tests/_files/CoverageNamespacedFunctionTest.php",
"tests/_files/CoveredFunction.php",
"tests/_files/Generator.php",

179
vendor/phpunit/phpunit/composer.lock generated vendored
View File

@@ -4,20 +4,20 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "e06728e5442edec84af96f94a889b4a7",
"content-hash": "74238629994a18b35f01a67ad11e60d4",
"packages": [
{
"name": "myclabs/deep-copy",
"version": "1.11.1",
"version": "1.13.1",
"source": {
"type": "git",
"url": "https://github.com/myclabs/DeepCopy.git",
"reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c"
"reference": "1720ddd719e16cf0db4eb1c6eca108031636d46c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c",
"reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/1720ddd719e16cf0db4eb1c6eca108031636d46c",
"reference": "1720ddd719e16cf0db4eb1c6eca108031636d46c",
"shasum": ""
},
"require": {
@@ -25,11 +25,12 @@
},
"conflict": {
"doctrine/collections": "<1.6.8",
"doctrine/common": "<2.13.3 || >=3,<3.2.2"
"doctrine/common": "<2.13.3 || >=3 <3.2.2"
},
"require-dev": {
"doctrine/collections": "^1.6.8",
"doctrine/common": "^2.13.3 || ^3.2.2",
"phpspec/prophecy": "^1.10",
"phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13"
},
"type": "library",
@@ -55,7 +56,7 @@
],
"support": {
"issues": "https://github.com/myclabs/DeepCopy/issues",
"source": "https://github.com/myclabs/DeepCopy/tree/1.11.1"
"source": "https://github.com/myclabs/DeepCopy/tree/1.13.1"
},
"funding": [
{
@@ -63,20 +64,20 @@
"type": "tidelift"
}
],
"time": "2023-03-08T13:26:56+00:00"
"time": "2025-04-29T12:36:36+00:00"
},
{
"name": "nikic/php-parser",
"version": "v5.0.0",
"version": "v5.4.0",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
"reference": "4a21235f7e56e713259a6f76bf4b5ea08502b9dc"
"reference": "447a020a1f875a434d62f2a401f53b82a396e494"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4a21235f7e56e713259a6f76bf4b5ea08502b9dc",
"reference": "4a21235f7e56e713259a6f76bf4b5ea08502b9dc",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/447a020a1f875a434d62f2a401f53b82a396e494",
"reference": "447a020a1f875a434d62f2a401f53b82a396e494",
"shasum": ""
},
"require": {
@@ -87,7 +88,7 @@
},
"require-dev": {
"ircmaxell/php-yacc": "^0.0.7",
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.0"
"phpunit/phpunit": "^9.0"
},
"bin": [
"bin/php-parse"
@@ -119,26 +120,27 @@
],
"support": {
"issues": "https://github.com/nikic/PHP-Parser/issues",
"source": "https://github.com/nikic/PHP-Parser/tree/v5.0.0"
"source": "https://github.com/nikic/PHP-Parser/tree/v5.4.0"
},
"time": "2024-01-07T17:17:35+00:00"
"time": "2024-12-30T11:07:19+00:00"
},
{
"name": "phar-io/manifest",
"version": "2.0.3",
"version": "2.0.4",
"source": {
"type": "git",
"url": "https://github.com/phar-io/manifest.git",
"reference": "97803eca37d319dfa7826cc2437fc020857acb53"
"reference": "54750ef60c58e43759730615a392c31c80e23176"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53",
"reference": "97803eca37d319dfa7826cc2437fc020857acb53",
"url": "https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176",
"reference": "54750ef60c58e43759730615a392c31c80e23176",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-libxml": "*",
"ext-phar": "*",
"ext-xmlwriter": "*",
"phar-io/version": "^3.0.1",
@@ -179,9 +181,15 @@
"description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)",
"support": {
"issues": "https://github.com/phar-io/manifest/issues",
"source": "https://github.com/phar-io/manifest/tree/2.0.3"
"source": "https://github.com/phar-io/manifest/tree/2.0.4"
},
"time": "2021-07-20T11:28:43+00:00"
"funding": [
{
"url": "https://github.com/theseer",
"type": "github"
}
],
"time": "2024-03-03T12:33:53+00:00"
},
{
"name": "phar-io/version",
@@ -236,32 +244,32 @@
},
{
"name": "phpunit/php-code-coverage",
"version": "10.1.11",
"version": "10.1.16",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "78c3b7625965c2513ee96569a4dbb62601784145"
"reference": "7e308268858ed6baedc8704a304727d20bc07c77"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/78c3b7625965c2513ee96569a4dbb62601784145",
"reference": "78c3b7625965c2513ee96569a4dbb62601784145",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/7e308268858ed6baedc8704a304727d20bc07c77",
"reference": "7e308268858ed6baedc8704a304727d20bc07c77",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-libxml": "*",
"ext-xmlwriter": "*",
"nikic/php-parser": "^4.18 || ^5.0",
"nikic/php-parser": "^4.19.1 || ^5.1.0",
"php": ">=8.1",
"phpunit/php-file-iterator": "^4.0",
"phpunit/php-text-template": "^3.0",
"sebastian/code-unit-reverse-lookup": "^3.0",
"sebastian/complexity": "^3.0",
"sebastian/environment": "^6.0",
"sebastian/lines-of-code": "^2.0",
"sebastian/version": "^4.0",
"theseer/tokenizer": "^1.2.0"
"phpunit/php-file-iterator": "^4.1.0",
"phpunit/php-text-template": "^3.0.1",
"sebastian/code-unit-reverse-lookup": "^3.0.0",
"sebastian/complexity": "^3.2.0",
"sebastian/environment": "^6.1.0",
"sebastian/lines-of-code": "^2.0.2",
"sebastian/version": "^4.0.1",
"theseer/tokenizer": "^1.2.3"
},
"require-dev": {
"phpunit/phpunit": "^10.1"
@@ -273,7 +281,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "10.1-dev"
"dev-main": "10.1.x-dev"
}
},
"autoload": {
@@ -302,7 +310,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
"security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy",
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.11"
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.16"
},
"funding": [
{
@@ -310,7 +318,7 @@
"type": "github"
}
],
"time": "2023-12-21T15:38:30+00:00"
"time": "2024-08-22T04:31:57+00:00"
},
{
"name": "phpunit/php-file-iterator",
@@ -557,16 +565,16 @@
},
{
"name": "sebastian/cli-parser",
"version": "2.0.0",
"version": "2.0.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/cli-parser.git",
"reference": "efdc130dbbbb8ef0b545a994fd811725c5282cae"
"reference": "c34583b87e7b7a8055bf6c450c2c77ce32a24084"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/efdc130dbbbb8ef0b545a994fd811725c5282cae",
"reference": "efdc130dbbbb8ef0b545a994fd811725c5282cae",
"url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/c34583b87e7b7a8055bf6c450c2c77ce32a24084",
"reference": "c34583b87e7b7a8055bf6c450c2c77ce32a24084",
"shasum": ""
},
"require": {
@@ -601,7 +609,8 @@
"homepage": "https://github.com/sebastianbergmann/cli-parser",
"support": {
"issues": "https://github.com/sebastianbergmann/cli-parser/issues",
"source": "https://github.com/sebastianbergmann/cli-parser/tree/2.0.0"
"security": "https://github.com/sebastianbergmann/cli-parser/security/policy",
"source": "https://github.com/sebastianbergmann/cli-parser/tree/2.0.1"
},
"funding": [
{
@@ -609,7 +618,7 @@
"type": "github"
}
],
"time": "2023-02-03T06:58:15+00:00"
"time": "2024-03-02T07:12:49+00:00"
},
{
"name": "sebastian/code-unit",
@@ -724,16 +733,16 @@
},
{
"name": "sebastian/comparator",
"version": "5.0.1",
"version": "5.0.3",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/comparator.git",
"reference": "2db5010a484d53ebf536087a70b4a5423c102372"
"reference": "a18251eb0b7a2dcd2f7aa3d6078b18545ef0558e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2db5010a484d53ebf536087a70b4a5423c102372",
"reference": "2db5010a484d53ebf536087a70b4a5423c102372",
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/a18251eb0b7a2dcd2f7aa3d6078b18545ef0558e",
"reference": "a18251eb0b7a2dcd2f7aa3d6078b18545ef0558e",
"shasum": ""
},
"require": {
@@ -744,7 +753,7 @@
"sebastian/exporter": "^5.0"
},
"require-dev": {
"phpunit/phpunit": "^10.3"
"phpunit/phpunit": "^10.5"
},
"type": "library",
"extra": {
@@ -789,7 +798,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/comparator/issues",
"security": "https://github.com/sebastianbergmann/comparator/security/policy",
"source": "https://github.com/sebastianbergmann/comparator/tree/5.0.1"
"source": "https://github.com/sebastianbergmann/comparator/tree/5.0.3"
},
"funding": [
{
@@ -797,7 +806,7 @@
"type": "github"
}
],
"time": "2023-08-14T13:18:12+00:00"
"time": "2024-10-18T14:56:07+00:00"
},
{
"name": "sebastian/complexity",
@@ -859,16 +868,16 @@
},
{
"name": "sebastian/diff",
"version": "5.1.0",
"version": "5.1.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/diff.git",
"reference": "fbf413a49e54f6b9b17e12d900ac7f6101591b7f"
"reference": "c41e007b4b62af48218231d6c2275e4c9b975b2e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/fbf413a49e54f6b9b17e12d900ac7f6101591b7f",
"reference": "fbf413a49e54f6b9b17e12d900ac7f6101591b7f",
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/c41e007b4b62af48218231d6c2275e4c9b975b2e",
"reference": "c41e007b4b62af48218231d6c2275e4c9b975b2e",
"shasum": ""
},
"require": {
@@ -876,7 +885,7 @@
},
"require-dev": {
"phpunit/phpunit": "^10.0",
"symfony/process": "^4.2 || ^5"
"symfony/process": "^6.4"
},
"type": "library",
"extra": {
@@ -914,7 +923,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/diff/issues",
"security": "https://github.com/sebastianbergmann/diff/security/policy",
"source": "https://github.com/sebastianbergmann/diff/tree/5.1.0"
"source": "https://github.com/sebastianbergmann/diff/tree/5.1.1"
},
"funding": [
{
@@ -922,20 +931,20 @@
"type": "github"
}
],
"time": "2023-12-22T10:55:06+00:00"
"time": "2024-03-02T07:15:17+00:00"
},
{
"name": "sebastian/environment",
"version": "6.0.1",
"version": "6.1.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/environment.git",
"reference": "43c751b41d74f96cbbd4e07b7aec9675651e2951"
"reference": "8074dbcd93529b357029f5cc5058fd3e43666984"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/43c751b41d74f96cbbd4e07b7aec9675651e2951",
"reference": "43c751b41d74f96cbbd4e07b7aec9675651e2951",
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/8074dbcd93529b357029f5cc5058fd3e43666984",
"reference": "8074dbcd93529b357029f5cc5058fd3e43666984",
"shasum": ""
},
"require": {
@@ -950,7 +959,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "6.0-dev"
"dev-main": "6.1-dev"
}
},
"autoload": {
@@ -978,7 +987,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/environment/issues",
"security": "https://github.com/sebastianbergmann/environment/security/policy",
"source": "https://github.com/sebastianbergmann/environment/tree/6.0.1"
"source": "https://github.com/sebastianbergmann/environment/tree/6.1.0"
},
"funding": [
{
@@ -986,20 +995,20 @@
"type": "github"
}
],
"time": "2023-04-11T05:39:26+00:00"
"time": "2024-03-23T08:47:14+00:00"
},
{
"name": "sebastian/exporter",
"version": "5.1.1",
"version": "5.1.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/exporter.git",
"reference": "64f51654862e0f5e318db7e9dcc2292c63cdbddc"
"reference": "955288482d97c19a372d3f31006ab3f37da47adf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/64f51654862e0f5e318db7e9dcc2292c63cdbddc",
"reference": "64f51654862e0f5e318db7e9dcc2292c63cdbddc",
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/955288482d97c19a372d3f31006ab3f37da47adf",
"reference": "955288482d97c19a372d3f31006ab3f37da47adf",
"shasum": ""
},
"require": {
@@ -1056,7 +1065,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/exporter/issues",
"security": "https://github.com/sebastianbergmann/exporter/security/policy",
"source": "https://github.com/sebastianbergmann/exporter/tree/5.1.1"
"source": "https://github.com/sebastianbergmann/exporter/tree/5.1.2"
},
"funding": [
{
@@ -1064,20 +1073,20 @@
"type": "github"
}
],
"time": "2023-09-24T13:22:09+00:00"
"time": "2024-03-02T07:17:12+00:00"
},
{
"name": "sebastian/global-state",
"version": "6.0.1",
"version": "6.0.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/global-state.git",
"reference": "7ea9ead78f6d380d2a667864c132c2f7b83055e4"
"reference": "987bafff24ecc4c9ac418cab1145b96dd6e9cbd9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/7ea9ead78f6d380d2a667864c132c2f7b83055e4",
"reference": "7ea9ead78f6d380d2a667864c132c2f7b83055e4",
"url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/987bafff24ecc4c9ac418cab1145b96dd6e9cbd9",
"reference": "987bafff24ecc4c9ac418cab1145b96dd6e9cbd9",
"shasum": ""
},
"require": {
@@ -1111,14 +1120,14 @@
}
],
"description": "Snapshotting of global state",
"homepage": "http://www.github.com/sebastianbergmann/global-state",
"homepage": "https://www.github.com/sebastianbergmann/global-state",
"keywords": [
"global state"
],
"support": {
"issues": "https://github.com/sebastianbergmann/global-state/issues",
"security": "https://github.com/sebastianbergmann/global-state/security/policy",
"source": "https://github.com/sebastianbergmann/global-state/tree/6.0.1"
"source": "https://github.com/sebastianbergmann/global-state/tree/6.0.2"
},
"funding": [
{
@@ -1126,7 +1135,7 @@
"type": "github"
}
],
"time": "2023-07-19T07:19:23+00:00"
"time": "2024-03-02T07:19:19+00:00"
},
{
"name": "sebastian/lines-of-code",
@@ -1472,16 +1481,16 @@
},
{
"name": "theseer/tokenizer",
"version": "1.2.2",
"version": "1.2.3",
"source": {
"type": "git",
"url": "https://github.com/theseer/tokenizer.git",
"reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96"
"reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/theseer/tokenizer/zipball/b2ad5003ca10d4ee50a12da31de12a5774ba6b96",
"reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96",
"url": "https://api.github.com/repos/theseer/tokenizer/zipball/737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2",
"reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2",
"shasum": ""
},
"require": {
@@ -1510,7 +1519,7 @@
"description": "A small library for converting tokenized PHP source code into XML and potentially other formats",
"support": {
"issues": "https://github.com/theseer/tokenizer/issues",
"source": "https://github.com/theseer/tokenizer/tree/1.2.2"
"source": "https://github.com/theseer/tokenizer/tree/1.2.3"
},
"funding": [
{
@@ -1518,13 +1527,13 @@
"type": "github"
}
],
"time": "2023-11-20T00:12:19+00:00"
"time": "2024-03-03T12:36:25+00:00"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"stability-flags": {},
"prefer-stable": true,
"prefer-lowest": false,
"platform": {
@@ -1536,7 +1545,7 @@
"ext-xml": "*",
"ext-xmlwriter": "*"
},
"platform-dev": [],
"platform-dev": {},
"platform-overrides": {
"php": "8.1.0"
},

0
vendor/phpunit/phpunit/phpunit vendored Normal file → Executable file
View File

View File

@@ -177,7 +177,9 @@
<xs:attribute name="numberOfTestsBeforeGarbageCollection" type="xs:integer" default="100"/>
<xs:attribute name="requireCoverageMetadata" type="xs:boolean" default="false"/>
<xs:attribute name="processIsolation" type="xs:boolean" default="false"/>
<xs:attribute name="failOnAllIssues" type="xs:boolean" default="false"/>
<xs:attribute name="failOnDeprecation" type="xs:boolean" default="false"/>
<xs:attribute name="failOnPhpunitDeprecation" type="xs:boolean" default="false"/>
<xs:attribute name="failOnEmptyTestSuite" type="xs:boolean" default="false"/>
<xs:attribute name="failOnIncomplete" type="xs:boolean" default="false"/>
<xs:attribute name="failOnNotice" type="xs:boolean" default="false"/>
@@ -196,7 +198,6 @@
<xs:attribute name="beStrictAboutChangesToGlobalState" type="xs:boolean" default="false"/>
<xs:attribute name="beStrictAboutOutputDuringTests" type="xs:boolean" default="false"/>
<xs:attribute name="beStrictAboutTestsThatDoNotTestAnything" type="xs:boolean" default="true"/>
<xs:attribute name="beStrictAboutTodoAnnotatedTests" type="xs:boolean" default="false"/>
<xs:attribute name="beStrictAboutCoverageMetadata" type="xs:boolean" default="false"/>
<xs:attribute name="defaultTimeLimit" type="xs:integer" default="0"/>
<xs:attribute name="enforceTimeLimit" type="xs:boolean" default="false"/>
@@ -211,9 +212,11 @@
<xs:attribute name="extensionsDirectory" type="xs:anyURI"/>
<xs:attribute name="executionOrder" type="executionOrderType" default="default"/>
<xs:attribute name="resolveDependencies" type="xs:boolean" default="true"/>
<xs:attribute name="displayDetailsOnAllIssues" type="xs:boolean" default="false"/>
<xs:attribute name="displayDetailsOnIncompleteTests" type="xs:boolean" default="false"/>
<xs:attribute name="displayDetailsOnSkippedTests" type="xs:boolean" default="false"/>
<xs:attribute name="displayDetailsOnTestsThatTriggerDeprecations" type="xs:boolean" default="false"/>
<xs:attribute name="displayDetailsOnPhpunitDeprecations" type="xs:boolean" default="false"/>
<xs:attribute name="displayDetailsOnTestsThatTriggerErrors" type="xs:boolean" default="false"/>
<xs:attribute name="displayDetailsOnTestsThatTriggerNotices" type="xs:boolean" default="false"/>
<xs:attribute name="displayDetailsOnTestsThatTriggerWarnings" type="xs:boolean" default="false"/>

View File

@@ -10,6 +10,8 @@
namespace PHPUnit\Event;
/**
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
final class CollectingDispatcher implements Dispatcher

View File

@@ -10,6 +10,8 @@
namespace PHPUnit\Event;
/**
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
final class DeferringDispatcher implements SubscribableDispatcher

View File

@@ -9,6 +9,7 @@
*/
namespace PHPUnit\Event;
use const PHP_EOL;
use function array_key_exists;
use function dirname;
use function sprintf;
@@ -16,6 +17,8 @@ use function str_starts_with;
use Throwable;
/**
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
final class DirectDispatcher implements SubscribableDispatcher
@@ -112,7 +115,7 @@ final class DirectDispatcher implements SubscribableDispatcher
public function handleThrowable(Throwable $t): void
{
if ($this->isThrowableFromThirdPartySubscriber($t)) {
Facade::emitter()->testRunnerTriggeredWarning(
Facade::emitter()->testRunnerTriggeredPhpunitWarning(
sprintf(
'Exception in third-party event subscriber: %s%s%s',
$t->getMessage(),

View File

@@ -10,6 +10,8 @@
namespace PHPUnit\Event;
/**
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @internal This interface is not covered by the backward compatibility promise for PHPUnit
*/
interface Dispatcher

View File

@@ -10,6 +10,8 @@
namespace PHPUnit\Event;
/**
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @internal This interface is not covered by the backward compatibility promise for PHPUnit
*/
interface SubscribableDispatcher extends Dispatcher

View File

@@ -26,6 +26,8 @@ use PHPUnit\TextUI\Configuration\Configuration;
use PHPUnit\Util\Exporter;
/**
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
final class DispatchingEmitter implements Emitter
@@ -42,7 +44,7 @@ final class DispatchingEmitter implements Emitter
$this->system = $system;
$this->startSnapshot = $system->snapshot();
$this->previousSnapshot = $system->snapshot();
$this->previousSnapshot = $this->startSnapshot;
}
/**
@@ -336,7 +338,7 @@ final class DispatchingEmitter implements Emitter
* @throws InvalidArgumentException
* @throws UnknownEventTypeException
*/
public function testBeforeFirstTestMethodCalled(string $testClassName, ClassMethod $calledMethod): void
public function beforeFirstTestMethodCalled(string $testClassName, ClassMethod $calledMethod): void
{
$this->dispatcher->dispatch(
new Test\BeforeFirstTestMethodCalled(
@@ -353,7 +355,7 @@ final class DispatchingEmitter implements Emitter
* @throws InvalidArgumentException
* @throws UnknownEventTypeException
*/
public function testBeforeFirstTestMethodErrored(string $testClassName, ClassMethod $calledMethod, Throwable $throwable): void
public function beforeFirstTestMethodErrored(string $testClassName, ClassMethod $calledMethod, Throwable $throwable): void
{
$this->dispatcher->dispatch(
new Test\BeforeFirstTestMethodErrored(
@@ -371,7 +373,7 @@ final class DispatchingEmitter implements Emitter
* @throws InvalidArgumentException
* @throws UnknownEventTypeException
*/
public function testBeforeFirstTestMethodFinished(string $testClassName, ClassMethod ...$calledMethods): void
public function beforeFirstTestMethodFinished(string $testClassName, ClassMethod ...$calledMethods): void
{
$this->dispatcher->dispatch(
new Test\BeforeFirstTestMethodFinished(
@@ -388,7 +390,7 @@ final class DispatchingEmitter implements Emitter
* @throws InvalidArgumentException
* @throws UnknownEventTypeException
*/
public function testBeforeTestMethodCalled(string $testClassName, ClassMethod $calledMethod): void
public function beforeTestMethodCalled(string $testClassName, ClassMethod $calledMethod): void
{
$this->dispatcher->dispatch(
new Test\BeforeTestMethodCalled(
@@ -405,7 +407,25 @@ final class DispatchingEmitter implements Emitter
* @throws InvalidArgumentException
* @throws UnknownEventTypeException
*/
public function testBeforeTestMethodFinished(string $testClassName, ClassMethod ...$calledMethods): void
public function beforeTestMethodErrored(string $testClassName, ClassMethod $calledMethod, Throwable $throwable): void
{
$this->dispatcher->dispatch(
new Test\BeforeTestMethodErrored(
$this->telemetryInfo(),
$testClassName,
$calledMethod,
$throwable,
),
);
}
/**
* @psalm-param class-string $testClassName
*
* @throws InvalidArgumentException
* @throws UnknownEventTypeException
*/
public function beforeTestMethodFinished(string $testClassName, ClassMethod ...$calledMethods): void
{
$this->dispatcher->dispatch(
new Test\BeforeTestMethodFinished(
@@ -422,7 +442,7 @@ final class DispatchingEmitter implements Emitter
* @throws InvalidArgumentException
* @throws UnknownEventTypeException
*/
public function testPreConditionCalled(string $testClassName, ClassMethod $calledMethod): void
public function preConditionCalled(string $testClassName, ClassMethod $calledMethod): void
{
$this->dispatcher->dispatch(
new Test\PreConditionCalled(
@@ -439,7 +459,25 @@ final class DispatchingEmitter implements Emitter
* @throws InvalidArgumentException
* @throws UnknownEventTypeException
*/
public function testPreConditionFinished(string $testClassName, ClassMethod ...$calledMethods): void
public function preConditionErrored(string $testClassName, ClassMethod $calledMethod, Throwable $throwable): void
{
$this->dispatcher->dispatch(
new Test\PreConditionErrored(
$this->telemetryInfo(),
$testClassName,
$calledMethod,
$throwable,
),
);
}
/**
* @psalm-param class-string $testClassName
*
* @throws InvalidArgumentException
* @throws UnknownEventTypeException
*/
public function preConditionFinished(string $testClassName, ClassMethod ...$calledMethods): void
{
$this->dispatcher->dispatch(
new Test\PreConditionFinished(
@@ -1010,7 +1048,7 @@ final class DispatchingEmitter implements Emitter
* @throws InvalidArgumentException
* @throws UnknownEventTypeException
*/
public function testPostConditionCalled(string $testClassName, ClassMethod $calledMethod): void
public function postConditionCalled(string $testClassName, ClassMethod $calledMethod): void
{
$this->dispatcher->dispatch(
new Test\PostConditionCalled(
@@ -1027,7 +1065,25 @@ final class DispatchingEmitter implements Emitter
* @throws InvalidArgumentException
* @throws UnknownEventTypeException
*/
public function testPostConditionFinished(string $testClassName, ClassMethod ...$calledMethods): void
public function postConditionErrored(string $testClassName, ClassMethod $calledMethod, Throwable $throwable): void
{
$this->dispatcher->dispatch(
new Test\PostConditionErrored(
$this->telemetryInfo(),
$testClassName,
$calledMethod,
$throwable,
),
);
}
/**
* @psalm-param class-string $testClassName
*
* @throws InvalidArgumentException
* @throws UnknownEventTypeException
*/
public function postConditionFinished(string $testClassName, ClassMethod ...$calledMethods): void
{
$this->dispatcher->dispatch(
new Test\PostConditionFinished(
@@ -1044,7 +1100,7 @@ final class DispatchingEmitter implements Emitter
* @throws InvalidArgumentException
* @throws UnknownEventTypeException
*/
public function testAfterTestMethodCalled(string $testClassName, ClassMethod $calledMethod): void
public function afterTestMethodCalled(string $testClassName, ClassMethod $calledMethod): void
{
$this->dispatcher->dispatch(
new Test\AfterTestMethodCalled(
@@ -1061,7 +1117,25 @@ final class DispatchingEmitter implements Emitter
* @throws InvalidArgumentException
* @throws UnknownEventTypeException
*/
public function testAfterTestMethodFinished(string $testClassName, ClassMethod ...$calledMethods): void
public function afterTestMethodErrored(string $testClassName, ClassMethod $calledMethod, Throwable $throwable): void
{
$this->dispatcher->dispatch(
new Test\AfterTestMethodErrored(
$this->telemetryInfo(),
$testClassName,
$calledMethod,
$throwable,
),
);
}
/**
* @psalm-param class-string $testClassName
*
* @throws InvalidArgumentException
* @throws UnknownEventTypeException
*/
public function afterTestMethodFinished(string $testClassName, ClassMethod ...$calledMethods): void
{
$this->dispatcher->dispatch(
new Test\AfterTestMethodFinished(
@@ -1078,7 +1152,7 @@ final class DispatchingEmitter implements Emitter
* @throws InvalidArgumentException
* @throws UnknownEventTypeException
*/
public function testAfterLastTestMethodCalled(string $testClassName, ClassMethod $calledMethod): void
public function afterLastTestMethodCalled(string $testClassName, ClassMethod $calledMethod): void
{
$this->dispatcher->dispatch(
new Test\AfterLastTestMethodCalled(
@@ -1095,7 +1169,25 @@ final class DispatchingEmitter implements Emitter
* @throws InvalidArgumentException
* @throws UnknownEventTypeException
*/
public function testAfterLastTestMethodFinished(string $testClassName, ClassMethod ...$calledMethods): void
public function afterLastTestMethodErrored(string $testClassName, ClassMethod $calledMethod, Throwable $throwable): void
{
$this->dispatcher->dispatch(
new Test\AfterLastTestMethodErrored(
$this->telemetryInfo(),
$testClassName,
$calledMethod,
$throwable,
),
);
}
/**
* @psalm-param class-string $testClassName
*
* @throws InvalidArgumentException
* @throws UnknownEventTypeException
*/
public function afterLastTestMethodFinished(string $testClassName, ClassMethod ...$calledMethods): void
{
$this->dispatcher->dispatch(
new Test\AfterLastTestMethodFinished(
@@ -1124,7 +1216,7 @@ final class DispatchingEmitter implements Emitter
* @throws InvalidArgumentException
* @throws UnknownEventTypeException
*/
public function testRunnerTriggeredDeprecation(string $message): void
public function testRunnerTriggeredPhpunitDeprecation(string $message): void
{
$this->dispatcher->dispatch(
new TestRunner\DeprecationTriggered(
@@ -1138,7 +1230,7 @@ final class DispatchingEmitter implements Emitter
* @throws InvalidArgumentException
* @throws UnknownEventTypeException
*/
public function testRunnerTriggeredWarning(string $message): void
public function testRunnerTriggeredPhpunitWarning(string $message): void
{
$this->dispatcher->dispatch(
new TestRunner\WarningTriggered(

View File

@@ -17,6 +17,8 @@ use PHPUnit\Framework\Constraint;
use PHPUnit\TextUI\Configuration\Configuration;
/**
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
interface Emitter
@@ -76,37 +78,47 @@ interface Emitter
/**
* @psalm-param class-string $testClassName
*/
public function testBeforeFirstTestMethodCalled(string $testClassName, ClassMethod $calledMethod): void;
public function beforeFirstTestMethodCalled(string $testClassName, ClassMethod $calledMethod): void;
/**
* @psalm-param class-string $testClassName
*/
public function testBeforeFirstTestMethodErrored(string $testClassName, ClassMethod $calledMethod, Throwable $throwable): void;
public function beforeFirstTestMethodErrored(string $testClassName, ClassMethod $calledMethod, Throwable $throwable): void;
/**
* @psalm-param class-string $testClassName
*/
public function testBeforeFirstTestMethodFinished(string $testClassName, ClassMethod ...$calledMethods): void;
public function beforeFirstTestMethodFinished(string $testClassName, ClassMethod ...$calledMethods): void;
/**
* @psalm-param class-string $testClassName
*/
public function testBeforeTestMethodCalled(string $testClassName, ClassMethod $calledMethod): void;
public function beforeTestMethodCalled(string $testClassName, ClassMethod $calledMethod): void;
/**
* @psalm-param class-string $testClassName
*/
public function testBeforeTestMethodFinished(string $testClassName, ClassMethod ...$calledMethods): void;
public function beforeTestMethodErrored(string $testClassName, ClassMethod $calledMethod, Throwable $throwable): void;
/**
* @psalm-param class-string $testClassName
*/
public function testPreConditionCalled(string $testClassName, ClassMethod $calledMethod): void;
public function beforeTestMethodFinished(string $testClassName, ClassMethod ...$calledMethods): void;
/**
* @psalm-param class-string $testClassName
*/
public function testPreConditionFinished(string $testClassName, ClassMethod ...$calledMethods): void;
public function preConditionCalled(string $testClassName, ClassMethod $calledMethod): void;
/**
* @psalm-param class-string $testClassName
*/
public function preConditionErrored(string $testClassName, ClassMethod $calledMethod, Throwable $throwable): void;
/**
* @psalm-param class-string $testClassName
*/
public function preConditionFinished(string $testClassName, ClassMethod ...$calledMethods): void;
public function testPrepared(Code\Test $test): void;
@@ -263,38 +275,53 @@ interface Emitter
/**
* @psalm-param class-string $testClassName
*/
public function testPostConditionCalled(string $testClassName, ClassMethod $calledMethod): void;
public function postConditionCalled(string $testClassName, ClassMethod $calledMethod): void;
/**
* @psalm-param class-string $testClassName
*/
public function testPostConditionFinished(string $testClassName, ClassMethod ...$calledMethods): void;
public function postConditionErrored(string $testClassName, ClassMethod $calledMethod, Throwable $throwable): void;
/**
* @psalm-param class-string $testClassName
*/
public function testAfterTestMethodCalled(string $testClassName, ClassMethod $calledMethod): void;
public function postConditionFinished(string $testClassName, ClassMethod ...$calledMethods): void;
/**
* @psalm-param class-string $testClassName
*/
public function testAfterTestMethodFinished(string $testClassName, ClassMethod ...$calledMethods): void;
public function afterTestMethodCalled(string $testClassName, ClassMethod $calledMethod): void;
/**
* @psalm-param class-string $testClassName
*/
public function testAfterLastTestMethodCalled(string $testClassName, ClassMethod $calledMethod): void;
public function afterTestMethodErrored(string $testClassName, ClassMethod $calledMethod, Throwable $throwable): void;
/**
* @psalm-param class-string $testClassName
*/
public function testAfterLastTestMethodFinished(string $testClassName, ClassMethod ...$calledMethods): void;
public function afterTestMethodFinished(string $testClassName, ClassMethod ...$calledMethods): void;
/**
* @psalm-param class-string $testClassName
*/
public function afterLastTestMethodCalled(string $testClassName, ClassMethod $calledMethod): void;
/**
* @psalm-param class-string $testClassName
*/
public function afterLastTestMethodErrored(string $testClassName, ClassMethod $calledMethod, Throwable $throwable): void;
/**
* @psalm-param class-string $testClassName
*/
public function afterLastTestMethodFinished(string $testClassName, ClassMethod ...$calledMethods): void;
public function testSuiteFinished(TestSuite $testSuite): void;
public function testRunnerTriggeredDeprecation(string $message): void;
public function testRunnerTriggeredPhpunitDeprecation(string $message): void;
public function testRunnerTriggeredWarning(string $message): void;
public function testRunnerTriggeredPhpunitWarning(string $message): void;
public function testRunnerEnabledGarbageCollection(): void;

View File

@@ -0,0 +1,84 @@
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\Event\Test;
use const PHP_EOL;
use function sprintf;
use PHPUnit\Event\Code;
use PHPUnit\Event\Code\Throwable;
use PHPUnit\Event\Event;
use PHPUnit\Event\Telemetry;
/**
* @psalm-immutable
*
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*/
final class AfterLastTestMethodErrored implements Event
{
private readonly Telemetry\Info $telemetryInfo;
/**
* @psalm-var class-string
*/
private readonly string $testClassName;
private readonly Code\ClassMethod $calledMethod;
private readonly Throwable $throwable;
/**
* @psalm-param class-string $testClassName
*/
public function __construct(Telemetry\Info $telemetryInfo, string $testClassName, Code\ClassMethod $calledMethod, Throwable $throwable)
{
$this->telemetryInfo = $telemetryInfo;
$this->testClassName = $testClassName;
$this->calledMethod = $calledMethod;
$this->throwable = $throwable;
}
public function telemetryInfo(): Telemetry\Info
{
return $this->telemetryInfo;
}
/**
* @psalm-return class-string
*/
public function testClassName(): string
{
return $this->testClassName;
}
public function calledMethod(): Code\ClassMethod
{
return $this->calledMethod;
}
public function throwable(): Throwable
{
return $this->throwable;
}
public function asString(): string
{
$message = $this->throwable->message();
if (!empty($message)) {
$message = PHP_EOL . $message;
}
return sprintf(
'After Last Test Method Errored (%s::%s)%s',
$this->calledMethod->className(),
$this->calledMethod->methodName(),
$message,
);
}
}

View File

@@ -0,0 +1,20 @@
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\Event\Test;
use PHPUnit\Event\Subscriber;
/**
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*/
interface AfterLastTestMethodErroredSubscriber extends Subscriber
{
public function notify(AfterLastTestMethodErrored $event): void;
}

View File

@@ -0,0 +1,84 @@
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\Event\Test;
use const PHP_EOL;
use function sprintf;
use PHPUnit\Event\Code;
use PHPUnit\Event\Code\Throwable;
use PHPUnit\Event\Event;
use PHPUnit\Event\Telemetry;
/**
* @psalm-immutable
*
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*/
final class AfterTestMethodErrored implements Event
{
private readonly Telemetry\Info $telemetryInfo;
/**
* @psalm-var class-string
*/
private readonly string $testClassName;
private readonly Code\ClassMethod $calledMethod;
private readonly Throwable $throwable;
/**
* @psalm-param class-string $testClassName
*/
public function __construct(Telemetry\Info $telemetryInfo, string $testClassName, Code\ClassMethod $calledMethod, Throwable $throwable)
{
$this->telemetryInfo = $telemetryInfo;
$this->testClassName = $testClassName;
$this->calledMethod = $calledMethod;
$this->throwable = $throwable;
}
public function telemetryInfo(): Telemetry\Info
{
return $this->telemetryInfo;
}
/**
* @psalm-return class-string
*/
public function testClassName(): string
{
return $this->testClassName;
}
public function calledMethod(): Code\ClassMethod
{
return $this->calledMethod;
}
public function throwable(): Throwable
{
return $this->throwable;
}
public function asString(): string
{
$message = $this->throwable->message();
if (!empty($message)) {
$message = PHP_EOL . $message;
}
return sprintf(
'After Test Method Errored (%s::%s)%s',
$this->calledMethod->className(),
$this->calledMethod->methodName(),
$message,
);
}
}

View File

@@ -0,0 +1,20 @@
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\Event\Test;
use PHPUnit\Event\Subscriber;
/**
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*/
interface AfterTestMethodErroredSubscriber extends Subscriber
{
public function notify(AfterTestMethodErrored $event): void;
}

View File

@@ -9,6 +9,7 @@
*/
namespace PHPUnit\Event\Test;
use const PHP_EOL;
use function sprintf;
use PHPUnit\Event\Code;
use PHPUnit\Event\Code\Throwable;

View File

@@ -0,0 +1,84 @@
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\Event\Test;
use const PHP_EOL;
use function sprintf;
use PHPUnit\Event\Code;
use PHPUnit\Event\Code\Throwable;
use PHPUnit\Event\Event;
use PHPUnit\Event\Telemetry;
/**
* @psalm-immutable
*
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*/
final class BeforeTestMethodErrored implements Event
{
private readonly Telemetry\Info $telemetryInfo;
/**
* @psalm-var class-string
*/
private readonly string $testClassName;
private readonly Code\ClassMethod $calledMethod;
private readonly Throwable $throwable;
/**
* @psalm-param class-string $testClassName
*/
public function __construct(Telemetry\Info $telemetryInfo, string $testClassName, Code\ClassMethod $calledMethod, Throwable $throwable)
{
$this->telemetryInfo = $telemetryInfo;
$this->testClassName = $testClassName;
$this->calledMethod = $calledMethod;
$this->throwable = $throwable;
}
public function telemetryInfo(): Telemetry\Info
{
return $this->telemetryInfo;
}
/**
* @psalm-return class-string
*/
public function testClassName(): string
{
return $this->testClassName;
}
public function calledMethod(): Code\ClassMethod
{
return $this->calledMethod;
}
public function throwable(): Throwable
{
return $this->throwable;
}
public function asString(): string
{
$message = $this->throwable->message();
if (!empty($message)) {
$message = PHP_EOL . $message;
}
return sprintf(
'Before Test Method Errored (%s::%s)%s',
$this->calledMethod->className(),
$this->calledMethod->methodName(),
$message,
);
}
}

View File

@@ -0,0 +1,20 @@
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\Event\Test;
use PHPUnit\Event\Subscriber;
/**
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*/
interface BeforeTestMethodErroredSubscriber extends Subscriber
{
public function notify(BeforeTestMethodErrored $event): void;
}

View File

@@ -0,0 +1,84 @@
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\Event\Test;
use const PHP_EOL;
use function sprintf;
use PHPUnit\Event\Code;
use PHPUnit\Event\Code\Throwable;
use PHPUnit\Event\Event;
use PHPUnit\Event\Telemetry;
/**
* @psalm-immutable
*
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*/
final class PostConditionErrored implements Event
{
private readonly Telemetry\Info $telemetryInfo;
/**
* @psalm-var class-string
*/
private readonly string $testClassName;
private readonly Code\ClassMethod $calledMethod;
private readonly Throwable $throwable;
/**
* @psalm-param class-string $testClassName
*/
public function __construct(Telemetry\Info $telemetryInfo, string $testClassName, Code\ClassMethod $calledMethod, Throwable $throwable)
{
$this->telemetryInfo = $telemetryInfo;
$this->testClassName = $testClassName;
$this->calledMethod = $calledMethod;
$this->throwable = $throwable;
}
public function telemetryInfo(): Telemetry\Info
{
return $this->telemetryInfo;
}
/**
* @psalm-return class-string
*/
public function testClassName(): string
{
return $this->testClassName;
}
public function calledMethod(): Code\ClassMethod
{
return $this->calledMethod;
}
public function throwable(): Throwable
{
return $this->throwable;
}
public function asString(): string
{
$message = $this->throwable->message();
if (!empty($message)) {
$message = PHP_EOL . $message;
}
return sprintf(
'Post Condition Method Errored (%s::%s)%s',
$this->calledMethod->className(),
$this->calledMethod->methodName(),
$message,
);
}
}

View File

@@ -0,0 +1,20 @@
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\Event\Test;
use PHPUnit\Event\Subscriber;
/**
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*/
interface PostConditionErroredSubscriber extends Subscriber
{
public function notify(PostConditionErrored $event): void;
}

View File

@@ -0,0 +1,84 @@
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\Event\Test;
use const PHP_EOL;
use function sprintf;
use PHPUnit\Event\Code;
use PHPUnit\Event\Code\Throwable;
use PHPUnit\Event\Event;
use PHPUnit\Event\Telemetry;
/**
* @psalm-immutable
*
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*/
final class PreConditionErrored implements Event
{
private readonly Telemetry\Info $telemetryInfo;
/**
* @psalm-var class-string
*/
private readonly string $testClassName;
private readonly Code\ClassMethod $calledMethod;
private readonly Throwable $throwable;
/**
* @psalm-param class-string $testClassName
*/
public function __construct(Telemetry\Info $telemetryInfo, string $testClassName, Code\ClassMethod $calledMethod, Throwable $throwable)
{
$this->telemetryInfo = $telemetryInfo;
$this->testClassName = $testClassName;
$this->calledMethod = $calledMethod;
$this->throwable = $throwable;
}
public function telemetryInfo(): Telemetry\Info
{
return $this->telemetryInfo;
}
/**
* @psalm-return class-string
*/
public function testClassName(): string
{
return $this->testClassName;
}
public function calledMethod(): Code\ClassMethod
{
return $this->calledMethod;
}
public function throwable(): Throwable
{
return $this->throwable;
}
public function asString(): string
{
$message = $this->throwable->message();
if (!empty($message)) {
$message = PHP_EOL . $message;
}
return sprintf(
'Pre Condition Method Errored (%s::%s)%s',
$this->calledMethod->className(),
$this->calledMethod->methodName(),
$message,
);
}
}

View File

@@ -0,0 +1,20 @@
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\Event\Test;
use PHPUnit\Event\Subscriber;
/**
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*/
interface PreConditionErroredSubscriber extends Subscriber
{
public function notify(PreConditionErrored $event): void;
}

View File

@@ -128,9 +128,11 @@ final class DeprecationTriggered implements Event
}
return sprintf(
'Test Triggered %sDeprecation (%s)%s',
'Test Triggered %sDeprecation (%s) in %s:%d%s',
$status,
$this->test->id(),
$this->file,
$this->line,
$message,
);
}

View File

@@ -104,9 +104,11 @@ final class ErrorTriggered implements Event
}
return sprintf(
'Test Triggered %sError (%s)%s',
'Test Triggered %sError (%s) in %s:%d%s',
$this->wasSuppressed() ? 'Suppressed ' : '',
$this->test->id(),
$this->file,
$this->line,
$message,
);
}

View File

@@ -119,9 +119,11 @@ final class NoticeTriggered implements Event
}
return sprintf(
'Test Triggered %sNotice (%s)%s',
'Test Triggered %sNotice (%s) in %s:%d%s',
$status,
$this->test->id(),
$this->file,
$this->line,
$message,
);
}

View File

@@ -128,9 +128,11 @@ final class PhpDeprecationTriggered implements Event
}
return sprintf(
'Test Triggered %sPHP Deprecation (%s)%s',
'Test Triggered %sPHP Deprecation (%s) in %s:%d%s',
$status,
$this->test->id(),
$this->file,
$this->line,
$message,
);
}

View File

@@ -119,9 +119,11 @@ final class PhpNoticeTriggered implements Event
}
return sprintf(
'Test Triggered %sPHP Notice (%s)%s',
'Test Triggered %sPHP Notice (%s) in %s:%d%s',
$status,
$this->test->id(),
$this->file,
$this->line,
$message,
);
}

View File

@@ -119,9 +119,11 @@ final class PhpWarningTriggered implements Event
}
return sprintf(
'Test Triggered %sPHP Warning (%s)%s',
'Test Triggered %sPHP Warning (%s) in %s:%d%s',
$status,
$this->test->id(),
$this->file,
$this->line,
$message,
);
}

View File

@@ -119,9 +119,11 @@ final class WarningTriggered implements Event
}
return sprintf(
'Test Triggered %sWarning (%s)%s',
'Test Triggered %sWarning (%s) in %s:%d%s',
$status,
$this->test->id(),
$this->file,
$this->line,
$message,
);
}

View File

@@ -11,7 +11,6 @@ namespace PHPUnit\Event\Test;
use const PHP_EOL;
use function sprintf;
use PHPUnit\Event\Code;
use PHPUnit\Event\Code\ClassMethod;
use PHPUnit\Event\Event;
use PHPUnit\Event\Telemetry;
@@ -49,7 +48,7 @@ final class DataProviderMethodFinished implements Event
}
/**
* @psalm-return list<Code\ClassMethod>
* @psalm-return list<ClassMethod>
*/
public function calledMethods(): array
{

View File

@@ -9,6 +9,7 @@
*/
namespace PHPUnit\Event\Test;
use const PHP_EOL;
use function sprintf;
use PHPUnit\Event\Event;
use PHPUnit\Event\Telemetry;

View File

@@ -13,6 +13,8 @@ use PHPUnit\Event\Exception;
use RuntimeException;
/**
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
final class NoTestCaseObjectOnCallStackException extends RuntimeException implements Exception

View File

@@ -15,6 +15,8 @@ use PHPUnit\Event\Telemetry\Php81GarbageCollectorStatusProvider;
use PHPUnit\Event\Telemetry\Php83GarbageCollectorStatusProvider;
/**
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
final class Facade
@@ -22,7 +24,6 @@ final class Facade
private static ?self $instance = null;
private Emitter $emitter;
private ?TypeMap $typeMap = null;
private ?Emitter $suspended = null;
private ?DeferringDispatcher $deferringDispatcher = null;
private bool $sealed = false;
@@ -110,10 +111,6 @@ final class Facade
public function forward(EventCollection $events): void
{
if ($this->suspended !== null) {
return;
}
$dispatcher = $this->deferredDispatcher();
foreach ($events as $event) {
@@ -181,8 +178,10 @@ final class Facade
Test\DataProviderMethodFinished::class,
Test\MarkedIncomplete::class,
Test\AfterLastTestMethodCalled::class,
Test\AfterLastTestMethodErrored::class,
Test\AfterLastTestMethodFinished::class,
Test\AfterTestMethodCalled::class,
Test\AfterTestMethodErrored::class,
Test\AfterTestMethodFinished::class,
Test\AssertionSucceeded::class,
Test\AssertionFailed::class,
@@ -190,6 +189,7 @@ final class Facade
Test\BeforeFirstTestMethodErrored::class,
Test\BeforeFirstTestMethodFinished::class,
Test\BeforeTestMethodCalled::class,
Test\BeforeTestMethodErrored::class,
Test\BeforeTestMethodFinished::class,
Test\ComparatorRegistered::class,
Test\ConsideredRisky::class,
@@ -207,8 +207,10 @@ final class Facade
Test\PhpunitWarningTriggered::class,
Test\PhpWarningTriggered::class,
Test\PostConditionCalled::class,
Test\PostConditionErrored::class,
Test\PostConditionFinished::class,
Test\PreConditionCalled::class,
Test\PreConditionErrored::class,
Test\PreConditionFinished::class,
Test\PreparationStarted::class,
Test\Prepared::class,

View File

@@ -17,6 +17,8 @@ use function interface_exists;
use function sprintf;
/**
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
final class TypeMap

View File

@@ -16,6 +16,8 @@ use PHPUnit\Framework\ExpectationFailedException;
use Throwable;
/**
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
final class ComparisonFailureBuilder

View File

@@ -10,6 +10,8 @@
namespace PHPUnit\Event\Telemetry;
/**
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @internal This interface is not covered by the backward compatibility promise for PHPUnit
*/
interface GarbageCollectorStatusProvider

View File

@@ -56,9 +56,6 @@ final class HRTime
return $this->nanoseconds;
}
/**
* @throws InvalidArgumentException
*/
public function duration(self $start): Duration
{
$seconds = $this->seconds - $start->seconds();
@@ -71,7 +68,7 @@ final class HRTime
}
if ($seconds < 0) {
throw new InvalidArgumentException('Start needs to be smaller.');
return Duration::fromSecondsAndNanoseconds(0, 0);
}
return Duration::fromSecondsAndNanoseconds(

View File

@@ -10,6 +10,8 @@
namespace PHPUnit\Event\Telemetry;
/**
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @internal This interface is not covered by the backward compatibility promise for PHPUnit
*/
interface MemoryMeter

View File

@@ -12,6 +12,8 @@ namespace PHPUnit\Event\Telemetry;
use function gc_status;
/**
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*
* @codeCoverageIgnore

View File

@@ -12,6 +12,8 @@ namespace PHPUnit\Event\Telemetry;
use function gc_status;
/**
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
final class Php83GarbageCollectorStatusProvider implements GarbageCollectorStatusProvider

View File

@@ -10,6 +10,8 @@
namespace PHPUnit\Event\Telemetry;
/**
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @internal This interface is not covered by the backward compatibility promise for PHPUnit
*/
interface StopWatch

View File

@@ -10,6 +10,8 @@
namespace PHPUnit\Event\Telemetry;
/**
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
final class System

View File

@@ -13,6 +13,8 @@ use function memory_get_peak_usage;
use function memory_get_usage;
/**
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
final class SystemMemoryMeter implements MemoryMeter

View File

@@ -13,6 +13,8 @@ use function hrtime;
use PHPUnit\Event\InvalidArgumentException;
/**
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
final class SystemStopWatch implements StopWatch

View File

@@ -13,6 +13,8 @@ use function hrtime;
use PHPUnit\Event\InvalidArgumentException;
/**
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*
* @codeCoverageIgnore

View File

@@ -14,6 +14,8 @@ use PHPUnit\Framework\TestCase;
use PHPUnit\Logging\TestDox\NamePrettifier;
/**
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
final class TestDoxBuilder
@@ -40,10 +42,12 @@ final class TestDoxBuilder
{
$prettifier = new NamePrettifier;
$prettifiedMethodName = $prettifier->prettifyTestMethodName($methodName);
return new TestDox(
$prettifier->prettifyTestClassName($className),
$prettifier->prettifyTestMethodName($methodName),
$prettifier->prettifyTestMethodName($methodName),
$prettifiedMethodName,
$prettifiedMethodName,
);
}
}

View File

@@ -9,6 +9,8 @@
*/
namespace PHPUnit\Event\Code;
use const DEBUG_BACKTRACE_IGNORE_ARGS;
use const DEBUG_BACKTRACE_PROVIDE_OBJECT;
use function assert;
use function debug_backtrace;
use function is_numeric;
@@ -23,6 +25,8 @@ use PHPUnit\Util\Exporter;
use PHPUnit\Util\Reflection;
/**
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
final class TestMethodBuilder
@@ -54,7 +58,7 @@ final class TestMethodBuilder
*/
public static function fromCallStack(): TestMethod
{
foreach (debug_backtrace() as $frame) {
foreach (debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT | DEBUG_BACKTRACE_IGNORE_ARGS) as $frame) {
if (isset($frame['object']) && $frame['object'] instanceof TestCase) {
return $frame['object']->valueObjectForEvents();
}

View File

@@ -22,6 +22,8 @@ use ReflectionException;
use ReflectionMethod;
/**
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
final class TestSuiteBuilder
@@ -31,18 +33,6 @@ final class TestSuiteBuilder
*/
public static function from(FrameworkTestSuite $testSuite): TestSuite
{
$groups = [];
foreach ($testSuite->groupDetails() as $groupName => $tests) {
if (!isset($groups[$groupName])) {
$groups[$groupName] = [];
}
foreach ($tests as $test) {
$groups[$groupName][] = $test::class;
}
}
$tests = [];
self::process($testSuite, $tests);

View File

@@ -15,6 +15,8 @@ use PHPUnit\Util\Filter;
use PHPUnit\Util\ThrowableToStringMapper;
/**
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
final class ThrowableBuilder

View File

@@ -78,7 +78,7 @@ abstract class Assert
* @throws Exception
* @throws ExpectationFailedException
*/
final public static function assertArrayHasKey(int|string $key, array|ArrayAccess $array, string $message = ''): void
final public static function assertArrayHasKey(mixed $key, array|ArrayAccess $array, string $message = ''): void
{
$constraint = new ArrayHasKey($key);
@@ -91,7 +91,7 @@ abstract class Assert
* @throws Exception
* @throws ExpectationFailedException
*/
final public static function assertArrayNotHasKey(int|string $key, array|ArrayAccess $array, string $message = ''): void
final public static function assertArrayNotHasKey(mixed $key, array|ArrayAccess $array, string $message = ''): void
{
$constraint = new LogicalNot(
new ArrayHasKey($key),
@@ -2120,7 +2120,7 @@ abstract class Assert
return new TraversableContainsOnly($className, false);
}
final public static function arrayHasKey(int|string $key): ArrayHasKey
final public static function arrayHasKey(mixed $key): ArrayHasKey
{
return new ArrayHasKey($key);
}

Some files were not shown because too many files have changed in this diff Show More