diff --git a/src/CodeCoverage.php b/src/CodeCoverage.php index 67ba40359..b960ea234 100644 --- a/src/CodeCoverage.php +++ b/src/CodeCoverage.php @@ -138,6 +138,7 @@ final class CodeCoverage */ public function __construct(Driver $driver = null, Filter $filter = null) { + //IVAN!!! if ($filter === null) { $filter = new Filter; } @@ -377,6 +378,7 @@ public function merge(self $that): void continue; } + // we should compare the lines if any of two contains data $compareLineNumbers = \array_unique( \array_merge( @@ -385,6 +387,39 @@ public function merge(self $that): void ) ); + $aaa_lines_orig = $this->data[$file]; + $aaa_lines_second = $that->data[$file]; + + $dif1 = \array_keys(\array_diff_key($this->data[$file], $that->data[$file])); + $dif2 = \array_keys(\array_diff_key($that->data[$file], $this->data[$file])); +// if (!empty($dif1)) { +// foreach ($dif1 as $key) { +// $this->data[$file][$key][] = 'Unknown'; +// } +// } +// if (!empty($dif2)) { +// foreach ($dif2 as $key) { +// if (empty($that->data[$file][$key])) { +// $this->data[$file][$key][] = 'Unknown'; +// } +// } +// } + + if (!empty($dif1)) { + foreach ($dif1 as $key) { + if (empty($that->data[$file][$key]) && empty($that->data[$file][$key])) { + unset($this->data[$file][$key]); + } + } + } + if (!empty($dif2)) { + foreach ($dif2 as $key) { + if (empty($that->data[$file][$key])) { + unset($that->data[$file][$key]); + } + } + } + foreach ($compareLineNumbers as $line) { $thatPriority = $this->getLinePriority($that->data[$file], $line); $thisPriority = $this->getLinePriority($this->data[$file], $line);