From 09898ccbc87b5e297bcfab4527a3705bd3b4d5a4 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 2 Dec 2023 17:45:25 +0300 Subject: add phpunit code coverage driver --- vendor/phpunit/php-code-coverage/src/CodeCoverage.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'vendor/phpunit/php-code-coverage/src/CodeCoverage.php') diff --git a/vendor/phpunit/php-code-coverage/src/CodeCoverage.php b/vendor/phpunit/php-code-coverage/src/CodeCoverage.php index c53d602c8..c35f27c8c 100644 --- a/vendor/phpunit/php-code-coverage/src/CodeCoverage.php +++ b/vendor/phpunit/php-code-coverage/src/CodeCoverage.php @@ -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; @@ -486,9 +485,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 +524,7 @@ final class CodeCoverage ); foreach ($uncoveredFiles as $uncoveredFile) { - if (is_file($uncoveredFile)) { + if ($this->filter->isFile($uncoveredFile)) { $this->append( RawCodeCoverageData::fromUncoveredFile( $uncoveredFile, @@ -543,7 +549,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 +650,7 @@ final class CodeCoverage } catch (\ReflectionException $e) { throw new ReflectionException( $e->getMessage(), - (int) $e->getCode(), + $e->getCode(), $e ); } -- cgit v1.2.3