package updates

This commit is contained in:
2018-12-19 23:27:43 -06:00
parent aa1da4d4fb
commit 1ffd21369f
1181 changed files with 51194 additions and 11046 deletions

View File

@@ -9,6 +9,7 @@
*/
namespace SebastianBergmann\CodeCoverage\Driver;
use SebastianBergmann\CodeCoverage\Filter;
use SebastianBergmann\CodeCoverage\RuntimeException;
/**
@@ -23,10 +24,15 @@ final class Xdebug implements Driver
*/
private $cacheNumLines = [];
/**
* @var Filter
*/
private $filter;
/**
* @throws RuntimeException
*/
public function __construct()
public function __construct(Filter $filter = null)
{
if (!\extension_loaded('xdebug')) {
throw new RuntimeException('This driver requires Xdebug');
@@ -35,6 +41,12 @@ final class Xdebug implements Driver
if (!\ini_get('xdebug.coverage_enable')) {
throw new RuntimeException('xdebug.coverage_enable=On has to be set in php.ini');
}
if ($filter === null) {
$filter = new Filter;
}
$this->filter = $filter;
}
/**
@@ -66,13 +78,15 @@ final class Xdebug implements Driver
foreach (\array_keys($data) as $file) {
unset($data[$file][0]);
if (\strpos($file, 'xdebug://debug-eval') !== 0 && \file_exists($file)) {
$numLines = $this->getNumberOfLinesInFile($file);
if (!$this->filter->isFile($file)) {
continue;
}
foreach (\array_keys($data[$file]) as $line) {
if ($line > $numLines) {
unset($data[$file][$line]);
}
$numLines = $this->getNumberOfLinesInFile($file);
foreach (\array_keys($data[$file]) as $line) {
if ($line > $numLines) {
unset($data[$file][$line]);
}
}
}