Skip to content

Commit 8bd511b

Browse files
committed
AbstractGenerator: filter-out non existent files from coverage data
If $source was null, common folder search below resulted to '' and it was converted to CWD by realpath().
1 parent ca80e7b commit 8bd511b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/CodeCoverage/Generators/AbstractGenerator.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ public function __construct(string $file, string $source = null)
5151
throw new \Exception("Content of file '$file' is invalid.");
5252
}
5353

54+
$this->data = array_filter($this->data, function (string $path) {
55+
return @is_file($path); // @ some files or wrappers may not exist, i.e. mock://
56+
}, ARRAY_FILTER_USE_KEY);
57+
5458
if (!$source) {
5559
$source = key($this->data);
5660
for ($i = 0; $i < strlen($source); $i++) {

0 commit comments

Comments
 (0)