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

@@ -138,14 +138,14 @@ final class CodeCoverage
*/
public function __construct(Driver $driver = null, Filter $filter = null)
{
if ($driver === null) {
$driver = $this->selectDriver();
}
if ($filter === null) {
$filter = new Filter;
}
if ($driver === null) {
$driver = $this->selectDriver($filter);
}
$this->driver = $driver;
$this->filter = $filter;
@@ -612,6 +612,17 @@ final class CodeCoverage
return $this->ignoredLines[$fileName];
}
try {
return $this->getLinesToBeIgnoredInner($fileName);
} catch (\OutOfBoundsException $e) {
// This can happen with PHP_Token_Stream if the file is syntactically invalid,
// and probably affects a file that wasn't executed.
return [];
}
}
private function getLinesToBeIgnoredInner(string $fileName): array
{
$this->ignoredLines[$fileName] = [];
$lines = \file($fileName);
@@ -878,7 +889,7 @@ final class CodeCoverage
/**
* @throws RuntimeException
*/
private function selectDriver(): Driver
private function selectDriver(Filter $filter): Driver
{
$runtime = new Runtime;
@@ -891,7 +902,7 @@ final class CodeCoverage
}
if ($runtime->hasXdebug()) {
return new Xdebug;
return new Xdebug($filter);
}
throw new RuntimeException('No code coverage driver available');