$codeLines
*/
- private function renderBranchLines(array $branch, array $codeLines, array $testData): string
+ private function renderBranchLines(ProcessedBranchCoverageData $branch, array $codeLines, array $testData): string
{
$linesTemplate = new Template($this->templatePath . 'lines.html.dist', '{{', '}}');
$singleLineTemplate = new Template($this->templatePath . 'line.html.dist', '{{', '}}');
$lines = '';
- $branchLines = range($branch['line_start'], $branch['line_end']);
+ $branchLines = range($branch->line_start, $branch->line_end);
sort($branchLines); // sometimes end_line < start_line
/** @var int $line */
@@ -818,7 +819,7 @@ private function renderBranchLines(array $branch, array $codeLines, array $testD
$popoverContent = '';
$popoverTitle = '';
- $numTests = count($branch['hit']);
+ $numTests = count($branch->hit);
if ($numTests === 0) {
$trClass = 'danger';
@@ -832,7 +833,7 @@ private function renderBranchLines(array $branch, array $codeLines, array $testD
$popoverTitle = '1 test covers this branch';
}
- foreach ($branch['hit'] as $test) {
+ foreach ($branch->hit as $test) {
if ($lineCss === 'covered-by-large-tests' && $testData[$test]['size'] === 'medium') {
$lineCss = 'covered-by-medium-tests';
} elseif ($testData[$test]['size'] === 'small') {
@@ -877,21 +878,18 @@ private function renderPathStructure(FileNode $node): string
ksort($coverageData);
+ /** @var ProcessedFunctionCoverageData $methodData */
foreach ($coverageData as $methodName => $methodData) {
- if (!$methodData['paths']) {
- continue;
- }
-
$pathStructure = '';
- if (count($methodData['paths']) > 100) {
- $pathStructure .= '' . count($methodData['paths']) . ' is too many paths to sensibly render, consider refactoring your code to bring this number down.
';
+ if (count($methodData->paths) > 100) {
+ $pathStructure .= '' . count($methodData->paths) . ' is too many paths to sensibly render, consider refactoring your code to bring this number down.
';
continue;
}
- foreach ($methodData['paths'] as $path) {
- $pathStructure .= $this->renderPathLines($path, $methodData['branches'], $codeLines, $testData);
+ foreach ($methodData->paths as $path) {
+ $pathStructure .= $this->renderPathLines($path, $methodData->branches, $codeLines, $testData);
}
if ($pathStructure !== '') {
@@ -906,9 +904,10 @@ private function renderPathStructure(FileNode $node): string
}
/**
- * @param list $codeLines
+ * @param array $branches
+ * @param list $codeLines
*/
- private function renderPathLines(array $path, array $branches, array $codeLines, array $testData): string
+ private function renderPathLines(ProcessedPathCoverageData $path, array $branches, array $codeLines, array $testData): string
{
$linesTemplate = new Template($this->templatePath . 'lines.html.dist', '{{', '}}');
$singleLineTemplate = new Template($this->templatePath . 'line.html.dist', '{{', '}}');
@@ -916,14 +915,14 @@ private function renderPathLines(array $path, array $branches, array $codeLines,
$lines = '';
$first = true;
- foreach ($path['path'] as $branchId) {
+ foreach ($path->path as $branchId) {
if ($first) {
$first = false;
} else {
$lines .= ' | |
' . "\n";
}
- $branchLines = range($branches[$branchId]['line_start'], $branches[$branchId]['line_end']);
+ $branchLines = range($branches[$branchId]->line_start, $branches[$branchId]->line_end);
sort($branchLines); // sometimes end_line < start_line
/** @var int $line */
@@ -935,7 +934,7 @@ private function renderPathLines(array $path, array $branches, array $codeLines,
$popoverContent = '';
$popoverTitle = '';
- $numTests = count($path['hit']);
+ $numTests = count($path->hit);
if ($numTests === 0) {
$trClass = 'danger';
@@ -949,7 +948,7 @@ private function renderPathLines(array $path, array $branches, array $codeLines,
$popoverTitle = '1 test covers this path';
}
- foreach ($path['hit'] as $test) {
+ foreach ($path->hit as $test) {
if ($lineCss === 'covered-by-large-tests' && $testData[$test]['size'] === 'medium') {
$lineCss = 'covered-by-medium-tests';
} elseif ($testData[$test]['size'] === 'small') {
diff --git a/src/Report/Html/Renderer/Template/css/style.css b/src/Report/Html/Renderer/Template/css/style.css
index c8a4cf7f4..4303bf844 100644
--- a/src/Report/Html/Renderer/Template/css/style.css
+++ b/src/Report/Html/Renderer/Template/css/style.css
@@ -2,8 +2,8 @@
:root {
/* Implementing an auto-selection of dark/light theme via: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/light-dark */
color-scheme: light dark;
-
- /* PHPUnit ligh/dark colors */
+
+ /* PHPUnit light/dark colors */
--phpunit-breadcrumbs: light-dark(var(--bs-gray-200), var(--bs-gray-800));
--phpunit-success-bar: light-dark(#28a745 ,#1f8135);
--phpunit-success-high: light-dark(#99cb84, #3d5c4e);
@@ -14,8 +14,8 @@
--phpunit-danger: light-dark(#f2dede, #42221e);
--phpunit-danger-bar: light-dark(#dc3545, #a62633);
- /* Bootstrap v5.3 default colors (ligth, dark) */
- --bs-body-bg-rgb: light-dark((255, 255, 255), (33, 37, 41));
+ /* Bootstrap v5.3 default colors (light, dark) */
+ --bs-body-bg-rgb: 255, 255, 255;
--bs-body-bg: light-dark(#fff, #212529);
--bs-body-color-rgb: light-dark(33, 37, 41, 222, 226, 230);
--bs-body-color: light-dark(#212529, #dee2e6);
@@ -28,7 +28,7 @@
--bs-dark-bg-subtle: light-dark(#ced4da, #1a1d20);
--bs-dark-border-subtle: light-dark(#adb5bd, #343a40);
--bs-dark-text-emphasis: light-dark(#495057, #dee2e6);
- --bs-emphasis-color-rgb: light-dark((0, 0, 0), (255, 255, 255));
+ --bs-emphasis-color-rgb: 0, 0, 0;
--bs-emphasis-color: light-dark(#000, #fff);
--bs-form-invalid-border-color: light-dark(#dc3545, #ea868f);
--bs-form-invalid-color: light-dark(#dc3545, #ea868f);
@@ -42,18 +42,18 @@
--bs-light-bg-subtle: light-dark(#fcfcfd, #343a40);
--bs-light-border-subtle: light-dark(#e9ecef, #495057);
--bs-light-text-emphasis: light-dark(#495057, #f8f9fa);
- --bs-link-color-rgb: light-dark((13, 110, 253), (110, 168, 254));
+ --bs-link-color-rgb: 13, 110, 253;
--bs-link-color: light-dark(#0d6efd, #6ea8fe);
- --bs-link-hover-color-rgb: light-dark((10, 88, 202), (139, 185, 254));
+ --bs-link-hover-color-rgb: 10, 88, 202;
--bs-link-hover-color: light-dark(#0a58ca, #8bb9fe);
--bs-primary-bg-subtle: light-dark(#cfe2ff, #031633);
--bs-primary-border-subtle: light-dark(#9ec5fe, #084298);
--bs-primary-text-emphasis: light-dark(#052c65, #6ea8fe);
- --bs-secondary-bg-rgb: light-dark((233, 236, 239), (52, 58, 64));
+ --bs-secondary-bg-rgb: 233, 236, 239;
--bs-secondary-bg-subtle: light-dark(#e2e3e5, #161719);
--bs-secondary-bg: light-dark(#e9ecef, #343a40);
--bs-secondary-border-subtle: light-dark(#c4c8cb, #41464b);
- --bs-secondary-color-rgb: light-dark((33, 37, 41), (222, 226, 230));
+ --bs-secondary-color-rgb: 33, 37, 41;
--bs-secondary-color: light-dark(rgba(33, 37, 41, 0.75), rgba(222, 226, 230, 0.75));
--bs-secondary-text-emphasis: light-dark(#2b2f32, #a7acb1);
--bs-success-bg-subtle: light-dark(#d1e7dd, #051b11);
@@ -61,7 +61,7 @@
--bs-success-text-emphasis: light-dark(#0a3622, #75b798);
--bs-tertiary-bg-rgb: light-dark(248, 249, 250, 43, 48, 53);
--bs-tertiary-bg: light-dark(#f8f9fa, #2b3035);
- --bs-tertiary-color-rgb: light-dark((33, 37, 41), (222, 226, 230));
+ --bs-tertiary-color-rgb: 33, 37, 41;
--bs-tertiary-color: light-dark(rgba(33, 37, 41, 0.5), rgba(222, 226, 230, 0.5));
--bs-warning-bg-subtle: light-dark(#fff3cd, #332701);
--bs-warning-border-subtle: light-dark(#ffe69c, #997404);
@@ -69,6 +69,16 @@
}
@media (prefers-color-scheme: dark) {
+ :root {
+ --bs-body-bg-rgb: 33, 37, 41;
+ --bs-emphasis-color-rgb: 255, 255, 255;
+ --bs-link-color-rgb: 110, 168, 254;
+ --bs-link-hover-color-rgb: 139, 185, 254;
+ --bs-secondary-bg-rgb: 52, 58, 64;
+ --bs-secondary-color-rgb: 222, 226, 230;
+ --bs-tertiary-color-rgb: 222, 226, 230;
+ }
+
/* Invert icon's colors on dark mode to improve readability */
img.octicon { filter: invert(1); }
}
diff --git a/src/Report/OpenClover.php b/src/Report/OpenClover.php
index 65d409b1c..3c9a7c3d1 100644
--- a/src/Report/OpenClover.php
+++ b/src/Report/OpenClover.php
@@ -78,53 +78,53 @@ public function process(CodeCoverage $coverage, ?string $target = null, ?string
$classMethods = 0;
// Assumption: one namespace per file
- if ($class['namespace'] !== '') {
- $namespace = $class['namespace'];
+ if ($class->namespace !== '') {
+ $namespace = $class->namespace;
}
- foreach ($class['methods'] as $methodName => $method) {
+ foreach ($class->methods as $methodName => $method) {
/** @phpstan-ignore equal.notAllowed */
- if ($method['executableLines'] == 0) {
+ if ($method->executableLines == 0) {
continue;
}
$classMethods++;
- $classStatements += $method['executableLines'];
- $coveredClassStatements += $method['executedLines'];
+ $classStatements += $method->executableLines;
+ $coveredClassStatements += $method->executedLines;
/** @phpstan-ignore equal.notAllowed */
- if ($method['coverage'] == 100) {
+ if ($method->coverage == 100) {
$coveredMethods++;
}
$methodCount = 0;
- foreach (range($method['startLine'], $method['endLine']) as $line) {
+ foreach (range($method->startLine, $method->endLine) as $line) {
if (isset($coverageData[$line])) {
$methodCount = max($methodCount, count($coverageData[$line]));
}
}
- $lines[$method['startLine']] = [
- 'ccn' => $method['ccn'],
+ $lines[$method->startLine] = [
+ 'ccn' => $method->ccn,
'count' => $methodCount,
'type' => 'method',
- 'signature' => $method['signature'],
- 'visibility' => $method['visibility'],
+ 'signature' => $method->signature,
+ 'visibility' => $method->visibility,
];
}
$xmlClass = $xmlDocument->createElement('class');
- $xmlClass->setAttribute('name', str_replace($class['namespace'] . '\\', '', $className));
+ $xmlClass->setAttribute('name', str_replace($class->namespace . '\\', '', $className));
$xmlFile->appendChild($xmlClass);
$xmlMetrics = $xmlDocument->createElement('metrics');
- $xmlMetrics->setAttribute('complexity', (string) $class['ccn']);
- $xmlMetrics->setAttribute('elements', (string) ($classMethods + $classStatements + $class['executableBranches']));
- $xmlMetrics->setAttribute('coveredelements', (string) ($coveredMethods + $coveredClassStatements + $class['executedBranches']));
- $xmlMetrics->setAttribute('conditionals', (string) $class['executableBranches']);
- $xmlMetrics->setAttribute('coveredconditionals', (string) $class['executedBranches']);
+ $xmlMetrics->setAttribute('complexity', (string) $class->ccn);
+ $xmlMetrics->setAttribute('elements', (string) ($classMethods + $classStatements + $class->executableBranches));
+ $xmlMetrics->setAttribute('coveredelements', (string) ($coveredMethods + $coveredClassStatements + $class->executedBranches));
+ $xmlMetrics->setAttribute('conditionals', (string) $class->executableBranches);
+ $xmlMetrics->setAttribute('coveredconditionals', (string) $class->executedBranches);
$xmlMetrics->setAttribute('statements', (string) $classStatements);
$xmlMetrics->setAttribute('coveredstatements', (string) $coveredClassStatements);
$xmlMetrics->setAttribute('methods', (string) $classMethods);
diff --git a/src/Report/Text.php b/src/Report/Text.php
index f18820b70..4c8d70986 100644
--- a/src/Report/Text.php
+++ b/src/Report/Text.php
@@ -190,28 +190,28 @@ public function process(CodeCoverage $coverage, bool $showColors = false): strin
$coveredMethods = 0;
$classMethods = 0;
- foreach ($class['methods'] as $method) {
+ foreach ($class->methods as $method) {
/** @phpstan-ignore equal.notAllowed */
- if ($method['executableLines'] == 0) {
+ if ($method->executableLines == 0) {
continue;
}
$classMethods++;
- $classExecutableLines += $method['executableLines'];
- $classExecutedLines += $method['executedLines'];
- $classExecutableBranches += $method['executableBranches'];
- $classExecutedBranches += $method['executedBranches'];
- $classExecutablePaths += $method['executablePaths'];
- $classExecutedPaths += $method['executedPaths'];
+ $classExecutableLines += $method->executableLines;
+ $classExecutedLines += $method->executedLines;
+ $classExecutableBranches += $method->executableBranches;
+ $classExecutedBranches += $method->executedBranches;
+ $classExecutablePaths += $method->executablePaths;
+ $classExecutedPaths += $method->executedPaths;
/** @phpstan-ignore equal.notAllowed */
- if ($method['coverage'] == 100) {
+ if ($method->coverage == 100) {
$coveredMethods++;
}
}
$classCoverage[$className] = [
- 'namespace' => $class['namespace'],
+ 'namespace' => $class->namespace,
'className' => $className,
'methodsCovered' => $coveredMethods,
'methodCount' => $classMethods,
diff --git a/src/Report/Xml/BuildInformation.php b/src/Report/Xml/BuildInformation.php
index dba230123..654eecb31 100644
--- a/src/Report/Xml/BuildInformation.php
+++ b/src/Report/Xml/BuildInformation.php
@@ -22,13 +22,15 @@
{
private DOMElement $contextNode;
- public function __construct(DOMElement $contextNode)
- {
+ public function __construct(
+ DOMElement $contextNode,
+ Runtime $runtime,
+ DateTimeImmutable $buildDate,
+ string $phpUnitVersion,
+ string $coverageVersion
+ ) {
$this->contextNode = $contextNode;
- }
- public function setRuntimeInformation(Runtime $runtime): void
- {
$runtimeNode = $this->nodeByName('runtime');
$runtimeNode->setAttribute('name', $runtime->getName());
@@ -46,34 +48,21 @@ public function setRuntimeInformation(Runtime $runtime): void
$driverNode->setAttribute('name', 'pcov');
$driverNode->setAttribute('version', phpversion('pcov'));
}
- }
- public function setBuildTime(DateTimeImmutable $date): void
- {
- $this->contextNode->setAttribute('time', $date->format('D M j G:i:s T Y'));
- }
+ $this->contextNode->setAttribute('time', $buildDate->format('D M j G:i:s T Y'));
- public function setGeneratorVersions(string $phpUnitVersion, string $coverageVersion): void
- {
$this->contextNode->setAttribute('phpunit', $phpUnitVersion);
$this->contextNode->setAttribute('coverage', $coverageVersion);
}
private function nodeByName(string $name): DOMElement
{
- $node = $this->contextNode->getElementsByTagNameNS(
- 'https://schema.phpunit.de/coverage/1.0',
- $name,
- )->item(0);
-
- if ($node === null) {
- $node = $this->contextNode->appendChild(
- $this->contextNode->ownerDocument->createElementNS(
- 'https://schema.phpunit.de/coverage/1.0',
- $name,
- ),
- );
- }
+ $node = $this->contextNode->appendChild(
+ $this->contextNode->ownerDocument->createElementNS(
+ Facade::XML_NAMESPACE,
+ $name,
+ ),
+ );
assert($node instanceof DOMElement);
diff --git a/src/Report/Xml/Coverage.php b/src/Report/Xml/Coverage.php
index afb70a069..9462780be 100644
--- a/src/Report/Xml/Coverage.php
+++ b/src/Report/Xml/Coverage.php
@@ -10,7 +10,6 @@
namespace SebastianBergmann\CodeCoverage\Report\Xml;
use DOMElement;
-use SebastianBergmann\CodeCoverage\ReportAlreadyFinalizedException;
use XMLWriter;
/**
@@ -18,48 +17,35 @@
*/
final class Coverage
{
- private readonly XMLWriter $writer;
private readonly DOMElement $contextNode;
- private bool $finalized = false;
+ private readonly string $line;
public function __construct(DOMElement $context, string $line)
{
$this->contextNode = $context;
-
- $this->writer = new XMLWriter;
- $this->writer->openMemory();
- $this->writer->startElementNs(null, $context->nodeName, 'https://schema.phpunit.de/coverage/1.0');
- $this->writer->writeAttribute('nr', $line);
+ $this->line = $line;
}
- /**
- * @throws ReportAlreadyFinalizedException
- */
- public function addTest(string $test): void
+ public function finalize(array $tests): void
{
- if ($this->finalized) {
- // @codeCoverageIgnoreStart
- throw new ReportAlreadyFinalizedException;
- // @codeCoverageIgnoreEnd
+ $writer = new XMLWriter;
+ $writer->openMemory();
+ $writer->startElementNs(null, $this->contextNode->nodeName, Facade::XML_NAMESPACE);
+ $writer->writeAttribute('nr', $this->line);
+
+ foreach ($tests as $test) {
+ $writer->startElement('covered');
+ $writer->writeAttribute('by', $test);
+ $writer->endElement();
}
-
- $this->writer->startElement('covered');
- $this->writer->writeAttribute('by', $test);
- $this->writer->endElement();
- }
-
- public function finalize(): void
- {
- $this->writer->endElement();
+ $writer->endElement();
$fragment = $this->contextNode->ownerDocument->createDocumentFragment();
- $fragment->appendXML($this->writer->outputMemory());
+ $fragment->appendXML($writer->outputMemory());
$this->contextNode->parentNode->replaceChild(
$fragment,
$this->contextNode,
);
-
- $this->finalized = true;
}
}
diff --git a/src/Report/Xml/Facade.php b/src/Report/Xml/Facade.php
index ba008f2ff..c3767088e 100644
--- a/src/Report/Xml/Facade.php
+++ b/src/Report/Xml/Facade.php
@@ -23,9 +23,11 @@
use DateTimeImmutable;
use DOMDocument;
use SebastianBergmann\CodeCoverage\CodeCoverage;
+use SebastianBergmann\CodeCoverage\Data\ProcessedClassType;
+use SebastianBergmann\CodeCoverage\Data\ProcessedFunctionType;
+use SebastianBergmann\CodeCoverage\Data\ProcessedTraitType;
use SebastianBergmann\CodeCoverage\Node\AbstractNode;
use SebastianBergmann\CodeCoverage\Node\Directory as DirectoryNode;
-use SebastianBergmann\CodeCoverage\Node\File;
use SebastianBergmann\CodeCoverage\Node\File as FileNode;
use SebastianBergmann\CodeCoverage\PathExistsButIsNotDirectoryException;
use SebastianBergmann\CodeCoverage\Util\Filesystem;
@@ -36,13 +38,11 @@
use SebastianBergmann\Environment\Runtime;
/**
- * @phpstan-import-type ProcessedClassType from File
- * @phpstan-import-type ProcessedTraitType from File
- * @phpstan-import-type ProcessedFunctionType from File
* @phpstan-import-type TestType from CodeCoverage
*/
final class Facade
{
+ public const string XML_NAMESPACE = 'https://schema.phpunit.de/coverage/1.0';
private string $target;
private Project $project;
private readonly string $phpUnitVersion;
@@ -79,10 +79,12 @@ public function process(CodeCoverage $coverage, string $target): void
private function setBuildInformation(): void
{
- $buildNode = $this->project->buildInformation();
- $buildNode->setRuntimeInformation(new Runtime);
- $buildNode->setBuildTime(new DateTimeImmutable);
- $buildNode->setGeneratorVersions($this->phpUnitVersion, Version::id());
+ $this->project->buildInformation(
+ new Runtime,
+ new DateTimeImmutable,
+ $this->phpUnitVersion,
+ Version::id(),
+ );
}
/**
@@ -165,12 +167,7 @@ private function processFile(FileNode $file, Directory $context): void
}
$coverage = $fileReport->lineCoverage((string) $line);
-
- foreach ($tests as $test) {
- $coverage->addTest($test);
- }
-
- $coverage->finalize();
+ $coverage->finalize($tests);
}
$fileReport->source()->setSourceCode(
@@ -180,50 +177,54 @@ private function processFile(FileNode $file, Directory $context): void
$this->saveDocument($fileReport->asDom(), $file->id());
}
- /**
- * @param ProcessedClassType|ProcessedTraitType $unit
- */
- private function processUnit(array $unit, Report $report): void
+ private function processUnit(ProcessedClassType|ProcessedTraitType $unit, Report $report): void
{
- if (isset($unit['className'])) {
- $unitObject = $report->classObject($unit['className']);
+ if ($unit instanceof ProcessedClassType) {
+ $unitObject = $report->classObject(
+ $unit->className,
+ $unit->namespace,
+ $unit->startLine,
+ $unit->executableLines,
+ $unit->executedLines,
+ (float) $unit->crap,
+ );
} else {
- $unitObject = $report->traitObject($unit['traitName']);
+ $unitObject = $report->traitObject(
+ $unit->traitName,
+ $unit->namespace,
+ $unit->startLine,
+ $unit->executableLines,
+ $unit->executedLines,
+ (float) $unit->crap,
+ );
}
- $unitObject->setLines(
- $unit['startLine'],
- $unit['executableLines'],
- $unit['executedLines'],
- );
-
- $unitObject->setCrap((float) $unit['crap']);
- $unitObject->setNamespace($unit['namespace']);
-
- foreach ($unit['methods'] as $method) {
- $methodObject = $unitObject->addMethod($method['methodName']);
- $methodObject->setSignature($method['signature']);
- $methodObject->setLines((string) $method['startLine'], (string) $method['endLine']);
- $methodObject->setCrap($method['crap']);
- $methodObject->setTotals(
- (string) $method['executableLines'],
- (string) $method['executedLines'],
- (string) $method['coverage'],
+ foreach ($unit->methods as $method) {
+ $unitObject->addMethod(
+ $method->methodName,
+ $method->signature,
+ (string) $method->startLine,
+ (string) $method->endLine,
+ (string) $method->executableLines,
+ (string) $method->executedLines,
+ (string) $method->coverage,
+ $method->crap,
);
}
}
- /**
- * @param ProcessedFunctionType $function
- */
- private function processFunction(array $function, Report $report): void
+ private function processFunction(ProcessedFunctionType $function, Report $report): void
{
- $functionObject = $report->functionObject($function['functionName']);
-
- $functionObject->setSignature($function['signature']);
- $functionObject->setLines((string) $function['startLine']);
- $functionObject->setCrap($function['crap']);
- $functionObject->setTotals((string) $function['executableLines'], (string) $function['executedLines'], (string) $function['coverage']);
+ $report->functionObject(
+ $function->functionName,
+ $function->signature,
+ (string) $function->startLine,
+ null,
+ (string) $function->executableLines,
+ (string) $function->executedLines,
+ (string) $function->coverage,
+ $function->crap,
+ );
}
/**
@@ -276,15 +277,20 @@ private function targetDirectory(): string
return $this->target;
}
- /**
- * @throws XmlException
- */
- private function saveDocument(DOMDocument $document, string $name): void
+ private function targetFilePath(string $name): string
{
$filename = sprintf('%s/%s.xml', $this->targetDirectory(), $name);
$this->initTargetDirectory(dirname($filename));
- Filesystem::write($filename, Xml::asString($document));
+ return $filename;
+ }
+
+ /**
+ * @throws XmlException
+ */
+ private function saveDocument(DOMDocument $document, string $name): void
+ {
+ Filesystem::write($this->targetFilePath($name), Xml::asString($document));
}
}
diff --git a/src/Report/Xml/File.php b/src/Report/Xml/File.php
index 4a3fea008..e6dd5c4ba 100644
--- a/src/Report/Xml/File.php
+++ b/src/Report/Xml/File.php
@@ -12,14 +12,16 @@
use function assert;
use DOMDocument;
use DOMElement;
+use DOMNode;
/**
* @internal This class is not covered by the backward compatibility promise for phpunit/php-code-coverage
*/
class File
{
- private readonly DOMDocument $dom;
+ protected readonly DOMDocument $dom;
private readonly DOMElement $contextNode;
+ private ?DOMNode $lineCoverage = null;
public function __construct(DOMElement $context)
{
@@ -29,16 +31,12 @@ public function __construct(DOMElement $context)
public function totals(): Totals
{
- $totalsContainer = $this->contextNode->firstChild;
-
- if ($totalsContainer === null) {
- $totalsContainer = $this->contextNode->appendChild(
- $this->dom->createElementNS(
- 'https://schema.phpunit.de/coverage/1.0',
- 'totals',
- ),
- );
- }
+ $totalsContainer = $this->contextNode->appendChild(
+ $this->dom->createElementNS(
+ Facade::XML_NAMESPACE,
+ 'totals',
+ ),
+ );
assert($totalsContainer instanceof DOMElement);
@@ -47,23 +45,19 @@ public function totals(): Totals
public function lineCoverage(string $line): Coverage
{
- $coverage = $this->contextNode->getElementsByTagNameNS(
- 'https://schema.phpunit.de/coverage/1.0',
- 'coverage',
- )->item(0);
-
- if ($coverage === null) {
- $coverage = $this->contextNode->appendChild(
+ if ($this->lineCoverage === null) {
+ $this->lineCoverage = $this->contextNode->appendChild(
$this->dom->createElementNS(
- 'https://schema.phpunit.de/coverage/1.0',
+ Facade::XML_NAMESPACE,
'coverage',
),
);
}
+ assert($this->lineCoverage instanceof DOMElement);
- $lineNode = $coverage->appendChild(
+ $lineNode = $this->lineCoverage->appendChild(
$this->dom->createElementNS(
- 'https://schema.phpunit.de/coverage/1.0',
+ Facade::XML_NAMESPACE,
'line',
),
);
@@ -77,9 +71,4 @@ protected function contextNode(): DOMElement
{
return $this->contextNode;
}
-
- protected function dom(): DOMDocument
- {
- return $this->dom;
- }
}
diff --git a/src/Report/Xml/Method.php b/src/Report/Xml/Method.php
index 1994d0f79..1b5bdb28f 100644
--- a/src/Report/Xml/Method.php
+++ b/src/Report/Xml/Method.php
@@ -18,41 +18,32 @@
{
private DOMElement $contextNode;
- public function __construct(DOMElement $context, string $name)
- {
+ public function __construct(
+ DOMElement $context,
+ string $name,
+ string $signature,
+ string $start,
+ ?string $end,
+ string $executable,
+ string $executed,
+ string $coverage,
+ string $crap
+ ) {
$this->contextNode = $context;
- $this->setName($name);
- }
-
- public function setSignature(string $signature): void
- {
+ $this->contextNode->setAttribute('name', $name);
$this->contextNode->setAttribute('signature', $signature);
- }
- public function setLines(string $start, ?string $end = null): void
- {
$this->contextNode->setAttribute('start', $start);
if ($end !== null) {
$this->contextNode->setAttribute('end', $end);
}
- }
- public function setTotals(string $executable, string $executed, string $coverage): void
- {
+ $this->contextNode->setAttribute('crap', $crap);
+
$this->contextNode->setAttribute('executable', $executable);
$this->contextNode->setAttribute('executed', $executed);
$this->contextNode->setAttribute('coverage', $coverage);
}
-
- public function setCrap(string $crap): void
- {
- $this->contextNode->setAttribute('crap', $crap);
- }
-
- private function setName(string $name): void
- {
- $this->contextNode->setAttribute('name', $name);
- }
}
diff --git a/src/Report/Xml/Node.php b/src/Report/Xml/Node.php
index e41197a08..86fe70df4 100644
--- a/src/Report/Xml/Node.php
+++ b/src/Report/Xml/Node.php
@@ -18,17 +18,13 @@
*/
abstract class Node
{
- private DOMDocument $dom;
- private DOMElement $contextNode;
+ protected readonly DOMDocument $dom;
+ private readonly DOMElement $contextNode;
public function __construct(DOMElement $context)
{
- $this->setContextNode($context);
- }
-
- public function dom(): DOMDocument
- {
- return $this->dom;
+ $this->dom = $context->ownerDocument;
+ $this->contextNode = $context;
}
public function totals(): Totals
@@ -38,7 +34,7 @@ public function totals(): Totals
if ($totalsContainer === null) {
$totalsContainer = $this->contextNode()->appendChild(
$this->dom->createElementNS(
- 'https://schema.phpunit.de/coverage/1.0',
+ Facade::XML_NAMESPACE,
'totals',
),
);
@@ -51,8 +47,8 @@ public function totals(): Totals
public function addDirectory(string $name): Directory
{
- $dirNode = $this->dom()->createElementNS(
- 'https://schema.phpunit.de/coverage/1.0',
+ $dirNode = $this->dom->createElementNS(
+ Facade::XML_NAMESPACE,
'directory',
);
@@ -64,8 +60,8 @@ public function addDirectory(string $name): Directory
public function addFile(string $name, string $href): File
{
- $fileNode = $this->dom()->createElementNS(
- 'https://schema.phpunit.de/coverage/1.0',
+ $fileNode = $this->dom->createElementNS(
+ Facade::XML_NAMESPACE,
'file',
);
@@ -76,12 +72,6 @@ public function addFile(string $name, string $href): File
return new File($fileNode);
}
- protected function setContextNode(DOMElement $context): void
- {
- $this->dom = $context->ownerDocument;
- $this->contextNode = $context;
- }
-
protected function contextNode(): DOMElement
{
return $this->contextNode;
diff --git a/src/Report/Xml/Project.php b/src/Report/Xml/Project.php
index 21b5a2ce1..c81a6a933 100644
--- a/src/Report/Xml/Project.php
+++ b/src/Report/Xml/Project.php
@@ -10,64 +10,68 @@
namespace SebastianBergmann\CodeCoverage\Report\Xml;
use function assert;
+use DateTimeImmutable;
use DOMDocument;
use DOMElement;
+use SebastianBergmann\Environment\Runtime;
/**
* @internal This class is not covered by the backward compatibility promise for phpunit/php-code-coverage
*/
final class Project extends Node
{
- /**
- * @phpstan-ignore constructor.missingParentCall
- */
+ private readonly string $directory;
+
public function __construct(string $directory)
{
- $this->init();
- $this->setProjectSourceDirectory($directory);
+ $dom = new DOMDocument;
+ $dom->loadXML('');
+
+ parent::__construct(
+ $dom->getElementsByTagNameNS(
+ Facade::XML_NAMESPACE,
+ 'project',
+ )->item(0),
+ );
+
+ $this->directory = $directory;
}
public function projectSourceDirectory(): string
{
- return $this->contextNode()->getAttribute('source');
+ return $this->directory;
}
- public function buildInformation(): BuildInformation
- {
- $buildNode = $this->dom()->getElementsByTagNameNS(
- 'https://schema.phpunit.de/coverage/1.0',
+ public function buildInformation(
+ Runtime $runtime,
+ DateTimeImmutable $buildDate,
+ string $phpUnitVersion,
+ string $coverageVersion
+ ): void {
+ $buildNode = $this->dom->getElementsByTagNameNS(
+ Facade::XML_NAMESPACE,
'build',
)->item(0);
- if ($buildNode === null) {
- $buildNode = $this->dom()->documentElement->appendChild(
- $this->dom()->createElementNS(
- 'https://schema.phpunit.de/coverage/1.0',
- 'build',
- ),
- );
- }
-
assert($buildNode instanceof DOMElement);
- return new BuildInformation($buildNode);
+ new BuildInformation(
+ $buildNode,
+ $runtime,
+ $buildDate,
+ $phpUnitVersion,
+ $coverageVersion,
+ );
}
public function tests(): Tests
{
- $testsNode = $this->contextNode()->getElementsByTagNameNS(
- 'https://schema.phpunit.de/coverage/1.0',
- 'tests',
- )->item(0);
-
- if ($testsNode === null) {
- $testsNode = $this->contextNode()->appendChild(
- $this->dom()->createElementNS(
- 'https://schema.phpunit.de/coverage/1.0',
- 'tests',
- ),
- );
- }
+ $testsNode = $this->contextNode()->appendChild(
+ $this->dom->createElementNS(
+ Facade::XML_NAMESPACE,
+ 'tests',
+ ),
+ );
assert($testsNode instanceof DOMElement);
@@ -76,24 +80,8 @@ public function tests(): Tests
public function asDom(): DOMDocument
{
- return $this->dom();
- }
+ $this->contextNode()->setAttribute('source', $this->directory);
- private function init(): void
- {
- $dom = new DOMDocument;
- $dom->loadXML('');
-
- $this->setContextNode(
- $dom->getElementsByTagNameNS(
- 'https://schema.phpunit.de/coverage/1.0',
- 'project',
- )->item(0),
- );
- }
-
- private function setProjectSourceDirectory(string $name): void
- {
- $this->contextNode()->setAttribute('source', $name);
+ return $this->dom;
}
}
diff --git a/src/Report/Xml/Report.php b/src/Report/Xml/Report.php
index f39ab860c..ee9b401de 100644
--- a/src/Report/Xml/Report.php
+++ b/src/Report/Xml/Report.php
@@ -20,88 +20,114 @@
*/
final class Report extends File
{
+ private readonly string $name;
+
public function __construct(string $name)
{
$dom = new DOMDocument;
$dom->loadXML('');
$contextNode = $dom->getElementsByTagNameNS(
- 'https://schema.phpunit.de/coverage/1.0',
+ Facade::XML_NAMESPACE,
'file',
)->item(0);
parent::__construct($contextNode);
- $this->setName($name);
+ $this->name = $name;
}
public function asDom(): DOMDocument
{
- return $this->dom();
+ $this->contextNode()->setAttribute('name', basename($this->name));
+ $this->contextNode()->setAttribute('path', dirname($this->name));
+
+ return $this->dom;
}
- public function functionObject(string $name): Method
- {
+ public function functionObject(
+ string $name,
+ string $signature,
+ string $start,
+ ?string $end,
+ string $executable,
+ string $executed,
+ string $coverage,
+ string $crap
+ ): void {
$node = $this->contextNode()->appendChild(
- $this->dom()->createElementNS(
- 'https://schema.phpunit.de/coverage/1.0',
+ $this->dom->createElementNS(
+ Facade::XML_NAMESPACE,
'function',
),
);
assert($node instanceof DOMElement);
- return new Method($node, $name);
- }
-
- public function classObject(string $name): Unit
- {
- return $this->unitObject('class', $name);
+ new Method(
+ $node,
+ $name,
+ $signature,
+ $start,
+ $end,
+ $executable,
+ $executed,
+ $coverage,
+ $crap,
+ );
}
- public function traitObject(string $name): Unit
- {
- return $this->unitObject('trait', $name);
- }
+ public function classObject(
+ string $name,
+ string $namespace,
+ int $start,
+ int $executable,
+ int $executed,
+ float $crap
+ ): Unit {
+ $node = $this->contextNode()->appendChild(
+ $this->dom->createElementNS(
+ Facade::XML_NAMESPACE,
+ 'class',
+ ),
+ );
- public function source(): Source
- {
- $source = $this->contextNode()->getElementsByTagNameNS(
- 'https://schema.phpunit.de/coverage/1.0',
- 'source',
- )->item(0);
+ assert($node instanceof DOMElement);
- if ($source === null) {
- $source = $this->contextNode()->appendChild(
- $this->dom()->createElementNS(
- 'https://schema.phpunit.de/coverage/1.0',
- 'source',
- ),
- );
- }
+ return new Unit($node, $name, $namespace, $start, $executable, $executed, $crap);
+ }
- assert($source instanceof DOMElement);
+ public function traitObject(
+ string $name,
+ string $namespace,
+ int $start,
+ int $executable,
+ int $executed,
+ float $crap
+ ): Unit {
+ $node = $this->contextNode()->appendChild(
+ $this->dom->createElementNS(
+ Facade::XML_NAMESPACE,
+ 'trait',
+ ),
+ );
- return new Source($source);
- }
+ assert($node instanceof DOMElement);
- private function setName(string $name): void
- {
- $this->contextNode()->setAttribute('name', basename($name));
- $this->contextNode()->setAttribute('path', dirname($name));
+ return new Unit($node, $name, $namespace, $start, $executable, $executed, $crap);
}
- private function unitObject(string $tagName, string $name): Unit
+ public function source(): Source
{
- $node = $this->contextNode()->appendChild(
- $this->dom()->createElementNS(
- 'https://schema.phpunit.de/coverage/1.0',
- $tagName,
+ $source = $this->contextNode()->appendChild(
+ $this->dom->createElementNS(
+ Facade::XML_NAMESPACE,
+ 'source',
),
);
- assert($node instanceof DOMElement);
+ assert($source instanceof DOMElement);
- return new Unit($node, $name);
+ return new Source($source);
}
}
diff --git a/src/Report/Xml/Source.php b/src/Report/Xml/Source.php
index 448fe72d6..698a71b6d 100644
--- a/src/Report/Xml/Source.php
+++ b/src/Report/Xml/Source.php
@@ -31,7 +31,7 @@ public function setSourceCode(string $source): void
$context = $this->context;
$tokens = (new Tokenizer)->parse($source);
- $srcDom = (new XMLSerializer(new NamespaceUri($context->namespaceURI)))->toDom($tokens);
+ $srcDom = (new XMLSerializer(new NamespaceUri(Facade::XML_NAMESPACE)))->toDom($tokens);
$context->parentNode->replaceChild(
$context->ownerDocument->importNode($srcDom->documentElement, true),
diff --git a/src/Report/Xml/Tests.php b/src/Report/Xml/Tests.php
index c9e9c48ef..1760fdfa5 100644
--- a/src/Report/Xml/Tests.php
+++ b/src/Report/Xml/Tests.php
@@ -34,7 +34,7 @@ public function addTest(string $test, array $result): void
{
$node = $this->contextNode->appendChild(
$this->contextNode->ownerDocument->createElementNS(
- 'https://schema.phpunit.de/coverage/1.0',
+ Facade::XML_NAMESPACE,
'test',
),
);
diff --git a/src/Report/Xml/Totals.php b/src/Report/Xml/Totals.php
index 8e285a78e..28612f7aa 100644
--- a/src/Report/Xml/Totals.php
+++ b/src/Report/Xml/Totals.php
@@ -29,27 +29,27 @@ public function __construct(DOMElement $container)
$dom = $container->ownerDocument;
$this->linesNode = $dom->createElementNS(
- 'https://schema.phpunit.de/coverage/1.0',
+ Facade::XML_NAMESPACE,
'lines',
);
$this->methodsNode = $dom->createElementNS(
- 'https://schema.phpunit.de/coverage/1.0',
+ Facade::XML_NAMESPACE,
'methods',
);
$this->functionsNode = $dom->createElementNS(
- 'https://schema.phpunit.de/coverage/1.0',
+ Facade::XML_NAMESPACE,
'functions',
);
$this->classesNode = $dom->createElementNS(
- 'https://schema.phpunit.de/coverage/1.0',
+ Facade::XML_NAMESPACE,
'classes',
);
$this->traitsNode = $dom->createElementNS(
- 'https://schema.phpunit.de/coverage/1.0',
+ Facade::XML_NAMESPACE,
'traits',
);
diff --git a/src/Report/Xml/Unit.php b/src/Report/Xml/Unit.php
index a00f85d39..fa97909c2 100644
--- a/src/Report/Xml/Unit.php
+++ b/src/Report/Xml/Unit.php
@@ -19,62 +19,63 @@
{
private DOMElement $contextNode;
- public function __construct(DOMElement $context, string $name)
- {
+ public function __construct(
+ DOMElement $context,
+ string $name,
+ string $namespace,
+ int $start,
+ int $executable,
+ int $executed,
+ float $crap
+ ) {
$this->contextNode = $context;
- $this->setName($name);
- }
-
- public function setLines(int $start, int $executable, int $executed): void
- {
+ $this->contextNode->setAttribute('name', $name);
$this->contextNode->setAttribute('start', (string) $start);
$this->contextNode->setAttribute('executable', (string) $executable);
$this->contextNode->setAttribute('executed', (string) $executed);
- }
-
- public function setCrap(float $crap): void
- {
$this->contextNode->setAttribute('crap', (string) $crap);
- }
-
- public function setNamespace(string $namespace): void
- {
- $node = $this->contextNode->getElementsByTagNameNS(
- 'https://schema.phpunit.de/coverage/1.0',
- 'namespace',
- )->item(0);
-
- if ($node === null) {
- $node = $this->contextNode->appendChild(
- $this->contextNode->ownerDocument->createElementNS(
- 'https://schema.phpunit.de/coverage/1.0',
- 'namespace',
- ),
- );
- }
+ $node = $this->contextNode->appendChild(
+ $this->contextNode->ownerDocument->createElementNS(
+ Facade::XML_NAMESPACE,
+ 'namespace',
+ ),
+ );
assert($node instanceof DOMElement);
$node->setAttribute('name', $namespace);
}
- public function addMethod(string $name): Method
- {
+ public function addMethod(
+ string $name,
+ string $signature,
+ string $start,
+ ?string $end,
+ string $executable,
+ string $executed,
+ string $coverage,
+ string $crap
+ ): void {
$node = $this->contextNode->appendChild(
$this->contextNode->ownerDocument->createElementNS(
- 'https://schema.phpunit.de/coverage/1.0',
+ Facade::XML_NAMESPACE,
'method',
),
);
assert($node instanceof DOMElement);
- return new Method($node, $name);
- }
-
- private function setName(string $name): void
- {
- $this->contextNode->setAttribute('name', $name);
+ new Method(
+ $node,
+ $name,
+ $signature,
+ $start,
+ $end,
+ $executable,
+ $executed,
+ $coverage,
+ $crap,
+ );
}
}
diff --git a/tests/src/TestCase.php b/tests/src/TestCase.php
index ba87455db..f8273d17c 100644
--- a/tests/src/TestCase.php
+++ b/tests/src/TestCase.php
@@ -14,6 +14,9 @@
use BankAccount;
use RecursiveDirectoryIterator;
use RecursiveIteratorIterator;
+use SebastianBergmann\CodeCoverage\Data\ProcessedBranchCoverageData;
+use SebastianBergmann\CodeCoverage\Data\ProcessedFunctionCoverageData;
+use SebastianBergmann\CodeCoverage\Data\ProcessedPathCoverageData;
use SebastianBergmann\CodeCoverage\Data\RawCodeCoverageData;
use SebastianBergmann\CodeCoverage\Driver\Driver;
use SebastianBergmann\CodeCoverage\Test\Target\Target;
@@ -1560,201 +1563,199 @@ protected function getExpectedPathCoverageDataArrayForBankAccount(): array
{
return [
TEST_FILES_PATH . 'BankAccount.php' => [
- 'BankAccount->depositMoney' => [
- 'branches' => [
- 0 => [
- 'op_start' => 0,
- 'op_end' => 14,
- 'line_start' => 20,
- 'line_end' => 25,
- 'hit' => [
+ 'BankAccount->depositMoney' => new ProcessedFunctionCoverageData(
+ [
+ 0 => new ProcessedBranchCoverageData(
+ 0,
+ 14,
+ 20,
+ 25,
+ [
0 => 'BankAccountTest::testBalanceCannotBecomeNegative2',
1 => 'BankAccountTest::testDepositWithdrawMoney',
],
- 'out' => [
- ],
- 'out_hit' => [
- ],
- ],
+ [],
+ [],
+ ),
],
- 'paths' => [
- 0 => [
- 'path' => [
+ [
+ 0 => new ProcessedPathCoverageData(
+ [
0 => 0,
],
- 'hit' => [
+ [
0 => 'BankAccountTest::testBalanceCannotBecomeNegative2',
1 => 'BankAccountTest::testDepositWithdrawMoney',
],
- ],
+ ),
],
- ],
- 'BankAccount->getBalance' => [
- 'branches' => [
- 0 => [
- 'op_start' => 0,
- 'op_end' => 5,
- 'line_start' => 6,
- 'line_end' => 9,
- 'hit' => [
+ ),
+ 'BankAccount->getBalance' => new ProcessedFunctionCoverageData(
+ [
+ 0 => new ProcessedBranchCoverageData(
+ 0,
+ 5,
+ 6,
+ 9,
+ [
0 => 'BankAccountTest::testBalanceIsInitiallyZero',
1 => 'BankAccountTest::testDepositWithdrawMoney',
],
- 'out' => [
+ [
],
- 'out_hit' => [
+ [
],
- ],
+ ),
],
- 'paths' => [
- 0 => [
- 'path' => [
+ [
+ 0 => new ProcessedPathCoverageData(
+ [
0 => 0,
],
- 'hit' => [
+ [
0 => 'BankAccountTest::testBalanceIsInitiallyZero',
1 => 'BankAccountTest::testDepositWithdrawMoney',
],
- ],
+ ),
],
- ],
- 'BankAccount->withdrawMoney' => [
- 'branches' => [
- 0 => [
- 'op_start' => 0,
- 'op_end' => 14,
- 'line_start' => 27,
- 'line_end' => 32,
- 'hit' => [
+ ),
+ 'BankAccount->withdrawMoney' => new ProcessedFunctionCoverageData(
+ [
+ 0 => new ProcessedBranchCoverageData(
+ 0,
+ 14,
+ 27,
+ 32,
+ [
0 => 'BankAccountTest::testBalanceCannotBecomeNegative',
1 => 'BankAccountTest::testDepositWithdrawMoney',
],
- 'out' => [
+ [
],
- 'out_hit' => [
+ [
],
- ],
+ ),
],
- 'paths' => [
- 0 => [
- 'path' => [
+ [
+ 0 => new ProcessedPathCoverageData(
+ [
0 => 0,
],
- 'hit' => [
+ [
0 => 'BankAccountTest::testBalanceCannotBecomeNegative',
1 => 'BankAccountTest::testDepositWithdrawMoney',
],
- ],
+ ),
],
- ],
- '{main}' => [
- 'branches' => [
- 0 => [
- 'op_start' => 0,
- 'op_end' => 1,
- 'line_start' => 34,
- 'line_end' => 34,
- 'hit' => [
- ],
- 'out' => [
+ ),
+ '{main}' => new ProcessedFunctionCoverageData(
+ [
+ 0 => new ProcessedBranchCoverageData(
+ 0,
+ 1,
+ 34,
+ 34,
+ [
+ ],
+ [
0 => 2147483645,
],
- 'out_hit' => [
+ [
0 => 0,
],
- ],
+ ),
],
- 'paths' => [
- 0 => [
- 'path' => [
+ [
+ 0 => new ProcessedPathCoverageData(
+ [
0 => 0,
],
- 'hit' => [
+ [
],
- ],
+ ),
],
- ],
- 'BankAccount->setBalance' => [
- 'branches' => [
- 0 => [
- 'op_start' => 0,
- 'op_end' => 4,
- 'line_start' => 11,
- 'line_end' => 13,
- 'hit' => [
- ],
- 'out' => [
+ ),
+ 'BankAccount->setBalance' => new ProcessedFunctionCoverageData(
+ [
+ 0 => new ProcessedBranchCoverageData(
+ 0,
+ 4,
+ 11,
+ 13,
+ [
+ ],
+ [
0 => 5,
1 => 9,
],
- 'out_hit' => [
+ [
0 => 0,
1 => 0,
],
- ],
- 5 => [
- 'op_start' => 5,
- 'op_end' => 8,
- 'line_start' => 14,
- 'line_end' => 14,
- 'hit' => [
- ],
- 'out' => [
+ ),
+ 5 => new ProcessedBranchCoverageData(
+ 5,
+ 8,
+ 14,
+ 14,
+ [
+ ],
+ [
0 => 13,
],
- 'out_hit' => [
+ [
0 => 0,
],
- ],
- 9 => [
- 'op_start' => 9,
- 'op_end' => 12,
- 'line_start' => 16,
- 'line_end' => 16,
- 'hit' => [
- ],
- 'out' => [
+ ),
+ 9 => new ProcessedBranchCoverageData(
+ 9,
+ 12,
+ 16,
+ 16,
+ [
+ ],
+ [
0 => 2147483645,
],
- 'out_hit' => [
+ [
0 => 0,
],
- ],
- 13 => [
- 'op_start' => 13,
- 'op_end' => 14,
- 'line_start' => 18,
- 'line_end' => 18,
- 'hit' => [
- ],
- 'out' => [
+ ),
+ 13 => new ProcessedBranchCoverageData(
+ 13,
+ 14,
+ 18,
+ 18,
+ [
+ ],
+ [
0 => 2147483645,
],
- 'out_hit' => [
+ [
0 => 0,
],
- ],
+ ),
],
- 'paths' => [
- 0 => [
- 'path' => [
+ [
+ 0 => new ProcessedPathCoverageData(
+ [
0 => 0,
1 => 5,
2 => 13,
],
- 'hit' => [
+ [
],
- ],
- 1 => [
- 'path' => [
+ ),
+ 1 => new ProcessedPathCoverageData(
+ [
0 => 0,
1 => 9,
],
- 'hit' => [
+ [
],
- ],
+ ),
],
- ],
+ ),
],
];
}
diff --git a/tests/tests/Data/ProcessedCodeCoverageDataTest.php b/tests/tests/Data/ProcessedCodeCoverageDataTest.php
index 46e144eec..e903636b8 100644
--- a/tests/tests/Data/ProcessedCodeCoverageDataTest.php
+++ b/tests/tests/Data/ProcessedCodeCoverageDataTest.php
@@ -75,29 +75,27 @@ public function testMergeDoesNotCrashWhenFileContentsHaveChanged(): void
$coverage->setFunctionCoverage(
[
'/some/path/SomeClass.php' => [
- 'SomeClass->firstFunction' => [
- 'branches' => [
- 0 => [
- 'op_start' => 0,
- 'op_end' => 14,
- 'line_start' => 20,
- 'line_end' => 25,
- 'hit' => [],
- 'out' => [
- ],
- 'out_hit' => [
- ],
- ],
+ 'SomeClass->firstFunction' => new ProcessedFunctionCoverageData(
+ [
+ 0 => new ProcessedBranchCoverageData(
+ 0,
+ 14,
+ 20,
+ 25,
+ [],
+ [],
+ [],
+ ),
],
- 'paths' => [
- 0 => [
- 'path' => [
+ [
+ 0 => new ProcessedPathCoverageData(
+ [
0 => 0,
],
- 'hit' => [],
- ],
+ [],
+ ),
],
- ],
+ ),
],
],
);
@@ -106,75 +104,70 @@ public function testMergeDoesNotCrashWhenFileContentsHaveChanged(): void
$newCoverage->setFunctionCoverage(
[
'/some/path/SomeClass.php' => [
- 'SomeClass->firstFunction' => [
- 'branches' => [
- 0 => [
- 'op_start' => 0,
- 'op_end' => 14,
- 'line_start' => 20,
- 'line_end' => 25,
- 'hit' => [],
- 'out' => [
- ],
- 'out_hit' => [
- ],
- ],
- 1 => [
- 'op_start' => 15,
- 'op_end' => 16,
- 'line_start' => 26,
- 'line_end' => 27,
- 'hit' => [],
- 'out' => [
- ],
- 'out_hit' => [
- ],
- ],
+ 'SomeClass->firstFunction' => new ProcessedFunctionCoverageData(
+ [
+ 0 => new ProcessedBranchCoverageData(
+ 0,
+ 14,
+ 20,
+ 25,
+ [],
+ [],
+ [],
+ ),
+ 1 => new ProcessedBranchCoverageData(
+ 15,
+ 16,
+ 26,
+ 27,
+ [],
+ [],
+ [],
+ ),
],
- 'paths' => [
- 0 => [
- 'path' => [
+ [
+ 0 => new ProcessedPathCoverageData(
+ [
0 => 0,
],
- 'hit' => [],
- ],
- 1 => [
- 'path' => [
+ [],
+ ),
+ 1 => new ProcessedPathCoverageData(
+ [
0 => 1,
],
- 'hit' => [],
- ],
+ [],
+ ),
],
- ],
- 'SomeClass->secondFunction' => [
- 'branches' => [
- 0 => [
- 'op_start' => 0,
- 'op_end' => 24,
- 'line_start' => 30,
- 'line_end' => 35,
- 'hit' => [],
- 'out' => [
- ],
- 'out_hit' => [
- ],
- ],
+ ),
+ 'SomeClass->secondFunction' => new ProcessedFunctionCoverageData(
+ [
+ 0 => new ProcessedBranchCoverageData(
+ 0,
+ 24,
+ 30,
+ 35,
+ [],
+ [],
+ [],
+ ),
],
- 'paths' => [
- 0 => [
- 'path' => [
+ [
+ 0 => new ProcessedPathCoverageData(
+ [
0 => 0,
],
- 'hit' => [],
- ],
+ [],
+ ),
],
- ],
+ ),
],
],
);
$coverage->merge($newCoverage);
+ $this->assertIsArray($newCoverage->functionCoverage()['/some/path/SomeClass.php']);
$this->assertArrayHasKey('SomeClass->secondFunction', $newCoverage->functionCoverage()['/some/path/SomeClass.php']);
}
}
diff --git a/tools/.phpstan/composer.json b/tools/.phpstan/composer.json
index 29d56109c..9851b7c08 100644
--- a/tools/.phpstan/composer.json
+++ b/tools/.phpstan/composer.json
@@ -1,10 +1,10 @@
{
"require-dev": {
- "phpstan/phpstan": "^2.1.22",
+ "phpstan/phpstan": "^2.1.32",
"phpstan/extension-installer": "^1.4.3",
- "phpstan/phpstan-strict-rules": "^2.0.6",
+ "phpstan/phpstan-strict-rules": "^2.0.7",
"tomasvotruba/type-coverage": "^2.0.2",
- "ergebnis/phpstan-rules": "^2.11.0"
+ "ergebnis/phpstan-rules": "^2.12.0"
},
"config": {
"allow-plugins": {
diff --git a/tools/.phpstan/composer.lock b/tools/.phpstan/composer.lock
index f01a2d2b8..e823a15ad 100644
--- a/tools/.phpstan/composer.lock
+++ b/tools/.phpstan/composer.lock
@@ -4,21 +4,21 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "33d32155239d1370eaa496a5fd6794c9",
+ "content-hash": "2c8ea294a7a4e09e4793951d07859bf8",
"packages": [],
"packages-dev": [
{
"name": "ergebnis/phpstan-rules",
- "version": "2.11.0",
+ "version": "2.12.0",
"source": {
"type": "git",
"url": "https://github.com/ergebnis/phpstan-rules.git",
- "reference": "505fead92d89daeb6aa045e92a3e77b55f4ca6a5"
+ "reference": "c4e0121a937b3b551f800a86e7d78794da2783ea"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/ergebnis/phpstan-rules/zipball/505fead92d89daeb6aa045e92a3e77b55f4ca6a5",
- "reference": "505fead92d89daeb6aa045e92a3e77b55f4ca6a5",
+ "url": "https://api.github.com/repos/ergebnis/phpstan-rules/zipball/c4e0121a937b3b551f800a86e7d78794da2783ea",
+ "reference": "c4e0121a937b3b551f800a86e7d78794da2783ea",
"shasum": ""
},
"require": {
@@ -31,10 +31,9 @@
"doctrine/orm": "^2.20.0 || ^3.3.0",
"ergebnis/composer-normalize": "^2.47.0",
"ergebnis/license": "^2.6.0",
- "ergebnis/php-cs-fixer-config": "^6.52.0",
- "ergebnis/phpunit-slow-test-detector": "^2.19.1",
+ "ergebnis/php-cs-fixer-config": "^6.54.0",
+ "ergebnis/phpunit-slow-test-detector": "^2.20.0",
"fakerphp/faker": "^1.24.1",
- "nette/di": "^3.1.10",
"phpstan/extension-installer": "^1.4.3",
"phpstan/phpstan-deprecation-rules": "^2.0.3",
"phpstan/phpstan-phpunit": "^2.0.7",
@@ -79,7 +78,7 @@
"security": "https://github.com/ergebnis/phpstan-rules/blob/main/.github/SECURITY.md",
"source": "https://github.com/ergebnis/phpstan-rules"
},
- "time": "2025-08-19T07:58:25+00:00"
+ "time": "2025-09-07T13:31:33+00:00"
},
{
"name": "nette/utils",
@@ -220,16 +219,11 @@
},
{
"name": "phpstan/phpstan",
- "version": "2.1.22",
- "source": {
- "type": "git",
- "url": "https://github.com/phpstan/phpstan.git",
- "reference": "41600c8379eb5aee63e9413fe9e97273e25d57e4"
- },
+ "version": "2.1.32",
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/phpstan/phpstan/zipball/41600c8379eb5aee63e9413fe9e97273e25d57e4",
- "reference": "41600c8379eb5aee63e9413fe9e97273e25d57e4",
+ "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e126cad1e30a99b137b8ed75a85a676450ebb227",
+ "reference": "e126cad1e30a99b137b8ed75a85a676450ebb227",
"shasum": ""
},
"require": {
@@ -274,25 +268,25 @@
"type": "github"
}
],
- "time": "2025-08-04T19:17:37+00:00"
+ "time": "2025-11-11T15:18:17+00:00"
},
{
"name": "phpstan/phpstan-strict-rules",
- "version": "2.0.6",
+ "version": "2.0.7",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan-strict-rules.git",
- "reference": "f9f77efa9de31992a832ff77ea52eb42d675b094"
+ "reference": "d6211c46213d4181054b3d77b10a5c5cb0d59538"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/f9f77efa9de31992a832ff77ea52eb42d675b094",
- "reference": "f9f77efa9de31992a832ff77ea52eb42d675b094",
+ "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/d6211c46213d4181054b3d77b10a5c5cb0d59538",
+ "reference": "d6211c46213d4181054b3d77b10a5c5cb0d59538",
"shasum": ""
},
"require": {
"php": "^7.4 || ^8.0",
- "phpstan/phpstan": "^2.0.4"
+ "phpstan/phpstan": "^2.1.29"
},
"require-dev": {
"php-parallel-lint/php-parallel-lint": "^1.2",
@@ -320,9 +314,9 @@
"description": "Extra strict and opinionated rules for PHPStan",
"support": {
"issues": "https://github.com/phpstan/phpstan-strict-rules/issues",
- "source": "https://github.com/phpstan/phpstan-strict-rules/tree/2.0.6"
+ "source": "https://github.com/phpstan/phpstan-strict-rules/tree/2.0.7"
},
- "time": "2025-07-21T12:19:29+00:00"
+ "time": "2025-09-26T11:19:08+00:00"
},
{
"name": "tomasvotruba/type-coverage",
@@ -389,5 +383,5 @@
"prefer-lowest": false,
"platform": {},
"platform-dev": {},
- "plugin-api-version": "2.6.0"
+ "plugin-api-version": "2.9.0"
}
diff --git a/tools/.phpstan/vendor/composer/autoload_static.php b/tools/.phpstan/vendor/composer/autoload_static.php
index 7af16ed81..b66b4992e 100644
--- a/tools/.phpstan/vendor/composer/autoload_static.php
+++ b/tools/.phpstan/vendor/composer/autoload_static.php
@@ -11,43 +11,43 @@ class ComposerStaticInitf9e7218f71d5874b5632927df4f72bd7
);
public static $prefixLengthsPsr4 = array (
- 'T' =>
+ 'T' =>
array (
'TomasVotruba\\TypeCoverage\\' => 26,
),
- 'P' =>
+ 'P' =>
array (
'PHPStan\\ExtensionInstaller\\' => 27,
'PHPStan\\' => 8,
),
- 'N' =>
+ 'N' =>
array (
'Nette\\' => 6,
),
- 'E' =>
+ 'E' =>
array (
'Ergebnis\\PHPStan\\Rules\\' => 23,
),
);
public static $prefixDirsPsr4 = array (
- 'TomasVotruba\\TypeCoverage\\' =>
+ 'TomasVotruba\\TypeCoverage\\' =>
array (
0 => __DIR__ . '/..' . '/tomasvotruba/type-coverage/src',
),
- 'PHPStan\\ExtensionInstaller\\' =>
+ 'PHPStan\\ExtensionInstaller\\' =>
array (
0 => __DIR__ . '/..' . '/phpstan/extension-installer/src',
),
- 'PHPStan\\' =>
+ 'PHPStan\\' =>
array (
0 => __DIR__ . '/..' . '/phpstan/phpstan-strict-rules/src',
),
- 'Nette\\' =>
+ 'Nette\\' =>
array (
0 => __DIR__ . '/..' . '/nette/utils/src',
),
- 'Ergebnis\\PHPStan\\Rules\\' =>
+ 'Ergebnis\\PHPStan\\Rules\\' =>
array (
0 => __DIR__ . '/..' . '/ergebnis/phpstan-rules/src',
),
diff --git a/tools/.phpstan/vendor/composer/installed.json b/tools/.phpstan/vendor/composer/installed.json
index 09fde69c1..76385ec26 100644
--- a/tools/.phpstan/vendor/composer/installed.json
+++ b/tools/.phpstan/vendor/composer/installed.json
@@ -2,17 +2,17 @@
"packages": [
{
"name": "ergebnis/phpstan-rules",
- "version": "2.11.0",
- "version_normalized": "2.11.0.0",
+ "version": "2.12.0",
+ "version_normalized": "2.12.0.0",
"source": {
"type": "git",
"url": "https://github.com/ergebnis/phpstan-rules.git",
- "reference": "505fead92d89daeb6aa045e92a3e77b55f4ca6a5"
+ "reference": "c4e0121a937b3b551f800a86e7d78794da2783ea"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/ergebnis/phpstan-rules/zipball/505fead92d89daeb6aa045e92a3e77b55f4ca6a5",
- "reference": "505fead92d89daeb6aa045e92a3e77b55f4ca6a5",
+ "url": "https://api.github.com/repos/ergebnis/phpstan-rules/zipball/c4e0121a937b3b551f800a86e7d78794da2783ea",
+ "reference": "c4e0121a937b3b551f800a86e7d78794da2783ea",
"shasum": ""
},
"require": {
@@ -25,10 +25,9 @@
"doctrine/orm": "^2.20.0 || ^3.3.0",
"ergebnis/composer-normalize": "^2.47.0",
"ergebnis/license": "^2.6.0",
- "ergebnis/php-cs-fixer-config": "^6.52.0",
- "ergebnis/phpunit-slow-test-detector": "^2.19.1",
+ "ergebnis/php-cs-fixer-config": "^6.54.0",
+ "ergebnis/phpunit-slow-test-detector": "^2.20.0",
"fakerphp/faker": "^1.24.1",
- "nette/di": "^3.1.10",
"phpstan/extension-installer": "^1.4.3",
"phpstan/phpstan-deprecation-rules": "^2.0.3",
"phpstan/phpstan-phpunit": "^2.0.7",
@@ -38,7 +37,7 @@
"symfony/finder": "^5.4.45",
"symfony/process": "^5.4.47"
},
- "time": "2025-08-19T07:58:25+00:00",
+ "time": "2025-09-07T13:31:33+00:00",
"type": "phpstan-extension",
"extra": {
"phpstan": {
@@ -222,17 +221,12 @@
},
{
"name": "phpstan/phpstan",
- "version": "2.1.22",
- "version_normalized": "2.1.22.0",
- "source": {
- "type": "git",
- "url": "https://github.com/phpstan/phpstan.git",
- "reference": "41600c8379eb5aee63e9413fe9e97273e25d57e4"
- },
+ "version": "2.1.32",
+ "version_normalized": "2.1.32.0",
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/phpstan/phpstan/zipball/41600c8379eb5aee63e9413fe9e97273e25d57e4",
- "reference": "41600c8379eb5aee63e9413fe9e97273e25d57e4",
+ "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e126cad1e30a99b137b8ed75a85a676450ebb227",
+ "reference": "e126cad1e30a99b137b8ed75a85a676450ebb227",
"shasum": ""
},
"require": {
@@ -241,7 +235,7 @@
"conflict": {
"phpstan/phpstan-shim": "*"
},
- "time": "2025-08-04T19:17:37+00:00",
+ "time": "2025-11-11T15:18:17+00:00",
"bin": [
"phpstan",
"phpstan.phar"
@@ -283,22 +277,22 @@
},
{
"name": "phpstan/phpstan-strict-rules",
- "version": "2.0.6",
- "version_normalized": "2.0.6.0",
+ "version": "2.0.7",
+ "version_normalized": "2.0.7.0",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan-strict-rules.git",
- "reference": "f9f77efa9de31992a832ff77ea52eb42d675b094"
+ "reference": "d6211c46213d4181054b3d77b10a5c5cb0d59538"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/f9f77efa9de31992a832ff77ea52eb42d675b094",
- "reference": "f9f77efa9de31992a832ff77ea52eb42d675b094",
+ "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/d6211c46213d4181054b3d77b10a5c5cb0d59538",
+ "reference": "d6211c46213d4181054b3d77b10a5c5cb0d59538",
"shasum": ""
},
"require": {
"php": "^7.4 || ^8.0",
- "phpstan/phpstan": "^2.0.4"
+ "phpstan/phpstan": "^2.1.29"
},
"require-dev": {
"php-parallel-lint/php-parallel-lint": "^1.2",
@@ -306,7 +300,7 @@
"phpstan/phpstan-phpunit": "^2.0",
"phpunit/phpunit": "^9.6"
},
- "time": "2025-07-21T12:19:29+00:00",
+ "time": "2025-09-26T11:19:08+00:00",
"type": "phpstan-extension",
"extra": {
"phpstan": {
@@ -328,7 +322,7 @@
"description": "Extra strict and opinionated rules for PHPStan",
"support": {
"issues": "https://github.com/phpstan/phpstan-strict-rules/issues",
- "source": "https://github.com/phpstan/phpstan-strict-rules/tree/2.0.6"
+ "source": "https://github.com/phpstan/phpstan-strict-rules/tree/2.0.7"
},
"install-path": "../phpstan/phpstan-strict-rules"
},
diff --git a/tools/.phpstan/vendor/composer/installed.php b/tools/.phpstan/vendor/composer/installed.php
index f294cb70c..58d90cfef 100644
--- a/tools/.phpstan/vendor/composer/installed.php
+++ b/tools/.phpstan/vendor/composer/installed.php
@@ -3,7 +3,7 @@
'name' => '__root__',
'pretty_version' => 'dev-main',
'version' => 'dev-main',
- 'reference' => '086553c5b2e0e1e20293d782d788ab768202b621',
+ 'reference' => '37047b5f0e98b31dccb9b7e7241e4f66ebfcd358',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@@ -13,16 +13,16 @@
'__root__' => array(
'pretty_version' => 'dev-main',
'version' => 'dev-main',
- 'reference' => '086553c5b2e0e1e20293d782d788ab768202b621',
+ 'reference' => '37047b5f0e98b31dccb9b7e7241e4f66ebfcd358',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'dev_requirement' => false,
),
'ergebnis/phpstan-rules' => array(
- 'pretty_version' => '2.11.0',
- 'version' => '2.11.0.0',
- 'reference' => '505fead92d89daeb6aa045e92a3e77b55f4ca6a5',
+ 'pretty_version' => '2.12.0',
+ 'version' => '2.12.0.0',
+ 'reference' => 'c4e0121a937b3b551f800a86e7d78794da2783ea',
'type' => 'phpstan-extension',
'install_path' => __DIR__ . '/../ergebnis/phpstan-rules',
'aliases' => array(),
@@ -47,18 +47,18 @@
'dev_requirement' => true,
),
'phpstan/phpstan' => array(
- 'pretty_version' => '2.1.22',
- 'version' => '2.1.22.0',
- 'reference' => '41600c8379eb5aee63e9413fe9e97273e25d57e4',
+ 'pretty_version' => '2.1.32',
+ 'version' => '2.1.32.0',
+ 'reference' => 'e126cad1e30a99b137b8ed75a85a676450ebb227',
'type' => 'library',
'install_path' => __DIR__ . '/../phpstan/phpstan',
'aliases' => array(),
'dev_requirement' => true,
),
'phpstan/phpstan-strict-rules' => array(
- 'pretty_version' => '2.0.6',
- 'version' => '2.0.6.0',
- 'reference' => 'f9f77efa9de31992a832ff77ea52eb42d675b094',
+ 'pretty_version' => '2.0.7',
+ 'version' => '2.0.7.0',
+ 'reference' => 'd6211c46213d4181054b3d77b10a5c5cb0d59538',
'type' => 'phpstan-extension',
'install_path' => __DIR__ . '/../phpstan/phpstan-strict-rules',
'aliases' => array(),
diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/CHANGELOG.md b/tools/.phpstan/vendor/ergebnis/phpstan-rules/CHANGELOG.md
index 00eab751e..7729147af 100644
--- a/tools/.phpstan/vendor/ergebnis/phpstan-rules/CHANGELOG.md
+++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/CHANGELOG.md
@@ -6,7 +6,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
## Unreleased
-For a full diff see [`2.11.0...main`][2.11.0...main].
+For a full diff see [`2.12.0...main`][2.12.0...main].
+
+## [`2.12.0`][2.12.0]
+
+For a full diff see [`2.11.0...2.12.0`][2.11.0...2.12.0].
+
+### Added
+
+- Added support for PHP 8.5 ([#977]), by [@localheinz]
## [`2.11.0`][2.11.0]
@@ -579,6 +587,7 @@ For a full diff see [`362c7ea...0.1.0`][362c7ea...0.1.0].
[2.10.4]: https://github.com/ergebnis/phpstan-rules/releases/tag/2.10.4
[2.10.5]: https://github.com/ergebnis/phpstan-rules/releases/tag/2.10.5
[2.11.0]: https://github.com/ergebnis/phpstan-rules/releases/tag/2.11.0
+[2.12.0]: https://github.com/ergebnis/phpstan-rules/releases/tag/2.12.0
[362c7ea...0.1.0]: https://github.com/ergebnis/phpstan-rules/compare/362c7ea...0.1.0
[0.1.0...0.2.0]: https://github.com/ergebnis/phpstan-rules/compare/0.1.0...0.2.0
@@ -628,7 +637,8 @@ For a full diff see [`362c7ea...0.1.0`][362c7ea...0.1.0].
[2.10.3...2.10.4]: https://github.com/ergebnis/phpstan-rules/compare/2.10.3...2.10.4
[2.10.4...2.10.5]: https://github.com/ergebnis/phpstan-rules/compare/2.10.4...2.10.5
[2.10.5...2.11.0]: https://github.com/ergebnis/phpstan-rules/compare/2.10.5...2.11.0
-[2.11.0...main]: https://github.com/ergebnis/phpstan-rules/compare/2.11.0...main
+[2.11.0...2.12.0]: https://github.com/ergebnis/phpstan-rules/compare/2.11.0...2.12.0
+[2.12.0...main]: https://github.com/ergebnis/phpstan-rules/compare/2.12.0...main
[#1]: https://github.com/ergebnis/phpstan-rules/pull/1
[#4]: https://github.com/ergebnis/phpstan-rules/pull/4
@@ -725,6 +735,7 @@ For a full diff see [`362c7ea...0.1.0`][362c7ea...0.1.0].
[#957]: https://github.com/ergebnis/phpstan-rules/pull/957
[#958]: https://github.com/ergebnis/phpstan-rules/pull/958
[#972]: https://github.com/ergebnis/phpstan-rules/pull/972
+[#977]: https://github.com/ergebnis/phpstan-rules/pull/977
[@cosmastech]: https://github.com/cosmastech
[@enumag]: https://github.com/enumag
diff --git a/tools/.phpstan/vendor/ergebnis/phpstan-rules/composer.json b/tools/.phpstan/vendor/ergebnis/phpstan-rules/composer.json
index 16e88b2fa..5060dde2d 100644
--- a/tools/.phpstan/vendor/ergebnis/phpstan-rules/composer.json
+++ b/tools/.phpstan/vendor/ergebnis/phpstan-rules/composer.json
@@ -30,10 +30,9 @@
"doctrine/orm": "^2.20.0 || ^3.3.0",
"ergebnis/composer-normalize": "^2.47.0",
"ergebnis/license": "^2.6.0",
- "ergebnis/php-cs-fixer-config": "^6.52.0",
- "ergebnis/phpunit-slow-test-detector": "^2.19.1",
+ "ergebnis/php-cs-fixer-config": "^6.54.0",
+ "ergebnis/phpunit-slow-test-detector": "^2.20.0",
"fakerphp/faker": "^1.24.1",
- "nette/di": "^3.1.10",
"phpstan/extension-installer": "^1.4.3",
"phpstan/phpstan-deprecation-rules": "^2.0.3",
"phpstan/phpstan-phpunit": "^2.0.7",
diff --git a/tools/.phpstan/vendor/phpstan/extension-installer/src/GeneratedConfig.php b/tools/.phpstan/vendor/phpstan/extension-installer/src/GeneratedConfig.php
index 145d6b0bb..c708b87ff 100644
--- a/tools/.phpstan/vendor/phpstan/extension-installer/src/GeneratedConfig.php
+++ b/tools/.phpstan/vendor/phpstan/extension-installer/src/GeneratedConfig.php
@@ -12,7 +12,7 @@ final class GeneratedConfig
public const EXTENSIONS = array (
'ergebnis/phpstan-rules' =>
array (
- 'install_path' => '/usr/local/src/php-code-coverage/tools/.phpstan/vendor/ergebnis/phpstan-rules',
+ 'install_path' => '/Users/sb/Work/OpenSource/php-code-coverage/tools/.phpstan/vendor/ergebnis/phpstan-rules',
'relative_install_path' => '../../../ergebnis/phpstan-rules',
'extra' =>
array (
@@ -21,12 +21,12 @@ final class GeneratedConfig
0 => 'rules.neon',
),
),
- 'version' => '2.11.0',
+ 'version' => '2.12.0',
'phpstanVersionConstraint' => '>=2.1.8.0-dev, <3.0.0.0-dev',
),
'phpstan/phpstan-strict-rules' =>
array (
- 'install_path' => '/usr/local/src/php-code-coverage/tools/.phpstan/vendor/phpstan/phpstan-strict-rules',
+ 'install_path' => '/Users/sb/Work/OpenSource/php-code-coverage/tools/.phpstan/vendor/phpstan/phpstan-strict-rules',
'relative_install_path' => '../../phpstan-strict-rules',
'extra' =>
array (
@@ -35,12 +35,12 @@ final class GeneratedConfig
0 => 'rules.neon',
),
),
- 'version' => '2.0.6',
- 'phpstanVersionConstraint' => '>=2.0.4.0-dev, <3.0.0.0-dev',
+ 'version' => '2.0.7',
+ 'phpstanVersionConstraint' => '>=2.1.29.0-dev, <3.0.0.0-dev',
),
'tomasvotruba/type-coverage' =>
array (
- 'install_path' => '/usr/local/src/php-code-coverage/tools/.phpstan/vendor/tomasvotruba/type-coverage',
+ 'install_path' => '/Users/sb/Work/OpenSource/php-code-coverage/tools/.phpstan/vendor/tomasvotruba/type-coverage',
'relative_install_path' => '../../../tomasvotruba/type-coverage',
'extra' =>
array (
@@ -58,7 +58,7 @@ final class GeneratedConfig
);
/** @var string|null */
- public const PHPSTAN_VERSION_CONSTRAINT = '>=2.1.8.0-dev, <3.0.0.0-dev';
+ public const PHPSTAN_VERSION_CONSTRAINT = '>=2.1.29.0-dev, <3.0.0.0-dev';
private function __construct()
{
diff --git a/tools/.phpstan/vendor/phpstan/phpstan-strict-rules/README.md b/tools/.phpstan/vendor/phpstan/phpstan-strict-rules/README.md
index e56aa34d7..3a60ec8e1 100644
--- a/tools/.phpstan/vendor/phpstan/phpstan-strict-rules/README.md
+++ b/tools/.phpstan/vendor/phpstan/phpstan-strict-rules/README.md
@@ -13,14 +13,12 @@
| `numericOperandsInArithmeticOperators` | Require numeric operand in `+$var`, `-$var`, `$var++`, `$var--`, `++$var` and `--$var`. |
| `numericOperandsInArithmeticOperators` | Require numeric operand in `$var++`, `$var--`, `++$var`and `--$var`. |
| `strictFunctionCalls` | These functions contain a `$strict` parameter for better type safety, it must be set to `true`:
* `in_array` (3rd parameter)
* `array_search` (3rd parameter)
* `array_keys` (3rd parameter; only if the 2nd parameter `$search_value` is provided)
* `base64_decode` (2nd parameter). |
-| `overwriteVariablesWithLoop` | Variables assigned in `while` loop condition and `for` loop initial assignment cannot be used after the loop. |
-| `overwriteVariablesWithLoop` | Variables set in foreach that's always looped thanks to non-empty arrays cannot be used after the loop. |
+| `overwriteVariablesWithLoop` | * Disallow overwriting variables with `foreach` key and value variables.
* Disallow overwriting variables with `for` loop initial assignment. |
| `switchConditionsMatchingType` | Types in `switch` condition and `case` value must match. PHP compares them loosely by default and that can lead to unexpected results. |
| `dynamicCallOnStaticMethod` | Check that statically declared methods are called statically. |
| `disallowedEmpty` | Disallow `empty()` - it's a very loose comparison (see [manual](https://php.net/empty)), it's recommended to use more strict one. |
| `disallowedShortTernary` | Disallow short ternary operator (`?:`) - implies weak comparison, it's recommended to use null coalesce operator (`??`) or ternary operator with strict condition. |
| `noVariableVariables` | Disallow variable variables (`$$foo`, `$this->$method()` etc.). |
-| `overwriteVariablesWithLoop` | Disallow overwriting variables with foreach key and value variables. |
| `checkAlwaysTrueInstanceof`, `checkAlwaysTrueCheckTypeFunctionCall`, `checkAlwaysTrueStrictComparison` | Always true `instanceof`, type-checking `is_*` functions and strict comparisons `===`/`!==`. These checks can be turned off by setting `checkAlwaysTrueInstanceof`, `checkAlwaysTrueCheckTypeFunctionCall` and `checkAlwaysTrueStrictComparison` to false. |
| | Correct case for referenced and called function names. |
| `matchingInheritedMethodNames` | Correct case for inherited and implemented method names. |
diff --git a/tools/.phpstan/vendor/phpstan/phpstan-strict-rules/composer.json b/tools/.phpstan/vendor/phpstan/phpstan-strict-rules/composer.json
index 2bbc44d69..bc72c5811 100644
--- a/tools/.phpstan/vendor/phpstan/phpstan-strict-rules/composer.json
+++ b/tools/.phpstan/vendor/phpstan/phpstan-strict-rules/composer.json
@@ -7,7 +7,7 @@
],
"require": {
"php": "^7.4 || ^8.0",
- "phpstan/phpstan": "^2.0.4"
+ "phpstan/phpstan": "^2.1.29"
},
"require-dev": {
"php-parallel-lint/php-parallel-lint": "^1.2",
diff --git a/tools/.phpstan/vendor/phpstan/phpstan-strict-rules/rules.neon b/tools/.phpstan/vendor/phpstan/phpstan-strict-rules/rules.neon
index 7a63c4ec3..0def6d878 100644
--- a/tools/.phpstan/vendor/phpstan/phpstan-strict-rules/rules.neon
+++ b/tools/.phpstan/vendor/phpstan/phpstan-strict-rules/rules.neon
@@ -11,6 +11,7 @@ parameters:
reportStaticMethodSignatures: true
reportMaybesInPropertyPhpDocTypes: true
reportWrongPhpDocTypeInVarTag: true
+ checkStrictPrintfPlaceholderTypes: true
strictRules:
allRules: true
disallowedLooseComparison: %strictRules.allRules%
diff --git a/tools/.phpstan/vendor/phpstan/phpstan-strict-rules/src/Rules/Classes/RequireParentConstructCallRule.php b/tools/.phpstan/vendor/phpstan/phpstan-strict-rules/src/Rules/Classes/RequireParentConstructCallRule.php
index 77595810a..38c5e0339 100644
--- a/tools/.phpstan/vendor/phpstan/phpstan-strict-rules/src/Rules/Classes/RequireParentConstructCallRule.php
+++ b/tools/.phpstan/vendor/phpstan/phpstan-strict-rules/src/Rules/Classes/RequireParentConstructCallRule.php
@@ -104,26 +104,27 @@ private function callsParentConstruct(Node $parserNode): bool
*/
private function getParentConstructorClass($classReflection)
{
- while ($classReflection->getParentClass() !== false) {
- $constructor = $classReflection->getParentClass()->hasMethod('__construct') ? $classReflection->getParentClass()->getMethod('__construct') : null;
- $constructorWithClassName = $classReflection->getParentClass()->hasMethod($classReflection->getParentClass()->getName()) ? $classReflection->getParentClass()->getMethod($classReflection->getParentClass()->getName()) : null;
+ $parentClass = $classReflection->getParentClass();
+ while ($parentClass !== false) {
+ $constructor = $parentClass->hasMethod('__construct') ? $parentClass->getMethod('__construct') : null;
+ $constructorWithClassName = $parentClass->hasMethod($parentClass->getName()) ? $parentClass->getMethod($parentClass->getName()) : null;
if (
(
$constructor !== null
- && $constructor->getDeclaringClass()->getName() === $classReflection->getParentClass()->getName()
+ && $constructor->getDeclaringClass()->getName() === $parentClass->getName()
&& !$constructor->isAbstract()
&& !$constructor->isPrivate()
&& !$constructor->isDeprecated()
) || (
$constructorWithClassName !== null
- && $constructorWithClassName->getDeclaringClass()->getName() === $classReflection->getParentClass()->getName()
+ && $constructorWithClassName->getDeclaringClass()->getName() === $parentClass->getName()
&& !$constructorWithClassName->isAbstract()
)
) {
- return $classReflection->getParentClass();
+ return $parentClass;
}
- $classReflection = $classReflection->getParentClass();
+ $parentClass = $parentClass->getParentClass();
}
return false;
diff --git a/tools/.phpstan/vendor/phpstan/phpstan/README.md b/tools/.phpstan/vendor/phpstan/phpstan/README.md
index f4af4753a..49bed4fd7 100644
--- a/tools/.phpstan/vendor/phpstan/phpstan/README.md
+++ b/tools/.phpstan/vendor/phpstan/phpstan/README.md
@@ -60,7 +60,7 @@ Want your logo here? [Learn more »](https://phpstan.org/sponsor)
-
+
@@ -78,8 +78,6 @@ Want your logo here? [Learn more »](https://phpstan.org/sponsor)
-
-
diff --git a/tools/.phpstan/vendor/phpstan/phpstan/bootstrap.php b/tools/.phpstan/vendor/phpstan/phpstan/bootstrap.php
index a5d341bfd..889755e60 100644
--- a/tools/.phpstan/vendor/phpstan/phpstan/bootstrap.php
+++ b/tools/.phpstan/vendor/phpstan/phpstan/bootstrap.php
@@ -92,6 +92,36 @@ final public static function loadClass(string $class): void {
require_once 'phar://' . __DIR__ . '/phpstan.phar/vendor/symfony/polyfill-php81/Php81.php';
require_once 'phar://' . __DIR__ . '/phpstan.phar/vendor/symfony/polyfill-php81/bootstrap.php';
}
+
+ if (
+ PHP_VERSION_ID < 80300
+ && empty ($GLOBALS['__composer_autoload_files']['662a729f963d39afe703c9d9b7ab4a8c'])
+ && !class_exists(\Symfony\Polyfill\Php83\Php83::class, false)
+ ) {
+ $GLOBALS['__composer_autoload_files']['662a729f963d39afe703c9d9b7ab4a8c'] = true;
+ require_once 'phar://' . __DIR__ . '/phpstan.phar/vendor/symfony/polyfill-php83/Php83.php';
+ require_once 'phar://' . __DIR__ . '/phpstan.phar/vendor/symfony/polyfill-php83/bootstrap.php';
+ }
+
+ if (
+ PHP_VERSION_ID < 80400
+ && empty ($GLOBALS['__composer_autoload_files']['9d2b9fc6db0f153a0a149fefb182415e'])
+ && !class_exists(\Symfony\Polyfill\Php83\Php84::class, false)
+ ) {
+ $GLOBALS['__composer_autoload_files']['9d2b9fc6db0f153a0a149fefb182415e'] = true;
+ require_once 'phar://' . __DIR__ . '/phpstan.phar/vendor/symfony/polyfill-php84/Php84.php';
+ require_once 'phar://' . __DIR__ . '/phpstan.phar/vendor/symfony/polyfill-php84/bootstrap.php';
+ }
+
+ if (
+ PHP_VERSION_ID < 80500
+ && empty ($GLOBALS['__composer_autoload_files']['606a39d89246991a373564698c2d8383'])
+ && !class_exists(\Symfony\Polyfill\Php83\Php85::class, false)
+ ) {
+ $GLOBALS['__composer_autoload_files']['606a39d89246991a373564698c2d8383'] = true;
+ require_once 'phar://' . __DIR__ . '/phpstan.phar/vendor/symfony/polyfill-php85/Php85.php';
+ require_once 'phar://' . __DIR__ . '/phpstan.phar/vendor/symfony/polyfill-php85/bootstrap.php';
+ }
}
$filename = str_replace('\\', DIRECTORY_SEPARATOR, $class);
diff --git a/tools/.phpstan/vendor/phpstan/phpstan/composer.json b/tools/.phpstan/vendor/phpstan/phpstan/composer.json
index dc62c19ce..8b51d4b71 100644
--- a/tools/.phpstan/vendor/phpstan/phpstan/composer.json
+++ b/tools/.phpstan/vendor/phpstan/phpstan/composer.json
@@ -16,6 +16,11 @@
"autoload": {
"files": ["bootstrap.php"]
},
+ "source": {
+ "type": "",
+ "url": "",
+ "reference": ""
+ },
"support": {
"issues": "https://github.com/phpstan/phpstan/issues",
"forum": "https://github.com/phpstan/phpstan/discussions",
diff --git a/tools/.phpstan/vendor/phpstan/phpstan/phpstan.phar b/tools/.phpstan/vendor/phpstan/phpstan/phpstan.phar
index c542df205..8c83a085d 100755
Binary files a/tools/.phpstan/vendor/phpstan/phpstan/phpstan.phar and b/tools/.phpstan/vendor/phpstan/phpstan/phpstan.phar differ
diff --git a/tools/.phpstan/vendor/phpstan/phpstan/phpstan.phar.asc b/tools/.phpstan/vendor/phpstan/phpstan/phpstan.phar.asc
index fce211b97..62f935e89 100644
--- a/tools/.phpstan/vendor/phpstan/phpstan/phpstan.phar.asc
+++ b/tools/.phpstan/vendor/phpstan/phpstan/phpstan.phar.asc
@@ -1,16 +1,16 @@
-----BEGIN PGP SIGNATURE-----
-iQIzBAABCgAdFiEEynwsejDI6OEnSoR2UcZzBf/C5cAFAmiRBzAACgkQUcZzBf/C
-5cBT9A//bFN1PIaNFWyowUaBTRJJ5bZ5ztqIar8C872t6S3mZmjEicE7d9X8gbWg
-sAAJO0hL6rH2bMUJDx4xksCGOcctI2WHauVa02JhzRXM3MKNh1UsfapHWA379j+3
-hwly1F/+fPklDS0W3zigWNlz0W7TFc4g8AL1CtAGeBOaFxeFmVPOU54UkfOy5YBT
-PuyxprZ473hZFrdbFRAanp95FLatLSZ9TL53M4SysyLewc6dOoO790l4zdMgYu74
-OxPAdgqZEzHCNOB60mKSFs6W3df9pXsoWvd0W8h9WVmre0COjzgaItDfhJRc+ODN
-sR/5ibIaPfhydCSj2tEoLWzNVy2EZpKv7rEBZji81qLcGCe+rC9T+RYygzJKoZ5z
-iHOXFmFK/GGevbPFVeN8Tiss3A5wkbNnJGSe3twegwa03IAiJkcqZfwCqRlrHTnH
-+k0KsuEB8mpfoYNGhda8u0AFWWIH1QU1//1OhXW3/t7mu/pCcavpXRlIcm8vJGfI
-++GWH160+xC4oeX35pbsoHq7c7aWtpeVDobjB1C+Kdhjh/HLkranM5jg/CeYt1ol
-EVdQ9rqIVEZdDXcziA0hI+ueM9mf995aMjyAzkis7Oy13EC6PZGjabErNjPRX0oN
-wU0YFwBv9hXCUDZN+3U9gzfu8WTNjYYMDE8q7EjbdnXj1+9YJGc=
-=owzd
+iQIzBAABCgAdFiEEynwsejDI6OEnSoR2UcZzBf/C5cAFAmkTU5cACgkQUcZzBf/C
+5cC1bg/+MAMAfCH1CDfI78Inqo/Mqa5q40QOn4RmVNex+xb8lKZ1AApc76nwNfn/
+BLI+War1G/5C2WWNgiqI9X7j/jo46oi+oO/1qywssqEn+7S9Ob7C56N2ERoikS3c
+MsrseR5XEVMFRG/enk1Gsmde9PesuIiN10FnsFyhZiMDNUXhoiLHPrERzTlUocAv
+K7/zm4gF152HM8tUir38i+h9BxadfNvah0zWCfzn7v+5OxSAHjz/DriWWdZkIsmB
+VuyZUg1QX05JzRkVBAdEy3h1N9c57ktWVf92PDrNha3hhQ1lw0OvH9+1+B5+Me5w
+BTUrLz+S6PGpFKkLY8M5ucQAvqHB41zgYp1QIN/Da1ZxvsQyAFq6yvD+d+yYG/zn
+k1NVNDrQMAE6GV7YjCK1bDSKExaFyYXmTb93fRN90cxYi3pfZpIMaaiKNGLYFPsk
+YHe1N4/et3741Y8VNSb2S1iu3KVTOzSnEsQL/olD5Trt6faKtscCSY7deeINoMkq
+IGLQmZjbj4TUO0js2Lw8zTp/d8X3bd67ktdVmijjaKurNYXJsecYuAZXz3WOTek9
+aXuT8kC1aZz/h7CxvjaN2G3KAi5yZ2aN57CSUYhDpmeN2VhvDGaGgHBPFSHcE5fx
+dr4BzRNTOU1ACBONChMGSvuDKCqC7kzt+qvWY29TlZxgwO+iIq8=
+=0Qu+
-----END PGP SIGNATURE-----
diff --git a/tools/composer b/tools/composer
index ee830d113..572223953 100755
Binary files a/tools/composer and b/tools/composer differ
diff --git a/tools/php-cs-fixer b/tools/php-cs-fixer
index 9c31190b5..997a14782 100755
Binary files a/tools/php-cs-fixer and b/tools/php-cs-fixer differ