Aggiornato Composer

This commit is contained in:
Paolo A
2024-05-17 12:24:19 +00:00
parent 4ac62108b5
commit ec201d75b2
2238 changed files with 38684 additions and 59785 deletions

View File

@@ -20,7 +20,6 @@ use function count;
use function explode;
use function get_class;
use function is_array;
use function is_file;
use function sort;
use PHPUnit\Framework\TestCase;
use PHPUnit\Runner\PhptTestCase;
@@ -77,7 +76,7 @@ final class CodeCoverage
private $ignoreDeprecatedCode = false;
/**
* @var PhptTestCase|string|TestCase
* @var null|PhptTestCase|string|TestCase
*/
private $currentId;
@@ -115,6 +114,11 @@ final class CodeCoverage
*/
private $cacheDirectory;
/**
* @var ?Directory
*/
private $cachedReport;
public function __construct(Driver $driver, Filter $filter)
{
$this->driver = $driver;
@@ -128,7 +132,11 @@ final class CodeCoverage
*/
public function getReport(): Directory
{
return (new Builder($this->analyser()))->build($this);
if ($this->cachedReport === null) {
$this->cachedReport = (new Builder($this->analyser()))->build($this);
}
return $this->cachedReport;
}
/**
@@ -136,9 +144,18 @@ final class CodeCoverage
*/
public function clear(): void
{
$this->currentId = null;
$this->data = new ProcessedCodeCoverageData;
$this->tests = [];
$this->currentId = null;
$this->data = new ProcessedCodeCoverageData;
$this->tests = [];
$this->cachedReport = null;
}
/**
* @internal
*/
public function clearCache(): void
{
$this->cachedReport = null;
}
/**
@@ -203,6 +220,8 @@ final class CodeCoverage
$this->currentId = $id;
$this->driver->start();
$this->cachedReport = null;
}
/**
@@ -221,7 +240,8 @@ final class CodeCoverage
$data = $this->driver->stop();
$this->append($data, null, $append, $linesToBeCovered, $linesToBeUsed);
$this->currentId = null;
$this->currentId = null;
$this->cachedReport = null;
return $data;
}
@@ -246,6 +266,8 @@ final class CodeCoverage
throw new TestIdMissingException;
}
$this->cachedReport = null;
$this->applyFilter($rawData);
$this->applyExecutableLinesFilter($rawData);
@@ -313,6 +335,8 @@ final class CodeCoverage
$this->data->merge($that->data);
$this->tests = array_merge($this->tests, $that->getTests());
$this->cachedReport = null;
}
public function enableCheckForUnintentionallyCoveredCode(): void
@@ -486,9 +510,16 @@ final class CodeCoverage
continue;
}
$linesToBranchMap = $this->analyser()->executableLinesIn($filename);
$data->keepLineCoverageDataOnlyForLines(
$filename,
$this->analyser()->executableLinesIn($filename)
array_keys($linesToBranchMap)
);
$data->markExecutableLineByBranch(
$filename,
$linesToBranchMap
);
}
}
@@ -518,7 +549,7 @@ final class CodeCoverage
);
foreach ($uncoveredFiles as $uncoveredFile) {
if (is_file($uncoveredFile)) {
if ($this->filter->isFile($uncoveredFile)) {
$this->append(
RawCodeCoverageData::fromUncoveredFile(
$uncoveredFile,
@@ -543,7 +574,7 @@ final class CodeCoverage
$this->driver->start();
foreach ($uncoveredFiles as $uncoveredFile) {
if (is_file($uncoveredFile)) {
if ($this->filter->isFile($uncoveredFile)) {
include_once $uncoveredFile;
}
}
@@ -644,7 +675,7 @@ final class CodeCoverage
} catch (\ReflectionException $e) {
throw new ReflectionException(
$e->getMessage(),
(int) $e->getCode(),
$e->getCode(),
$e
);
}
@@ -667,7 +698,9 @@ final class CodeCoverage
if ($this->cachesStaticAnalysis()) {
$this->analyser = new CachingFileAnalyser(
$this->cacheDirectory,
$this->analyser
$this->analyser,
$this->useAnnotationsForIgnoringCode,
$this->ignoreDeprecatedCode
);
}