Open andrewprofile opened 2 years ago
The problem is caused by this workaround https://github.com/sebastianbergmann/php-code-coverage/blob/fe7247675ceced8048b1cef147bda58e14afe35a/src/StaticAnalysis/IgnoredLinesFindingVisitor.php#L56 which starts ignoring the line and then because this is the infterface in the next condition
https://github.com/sebastianbergmann/php-code-coverage/blob/fe7247675ceced8048b1cef147bda58e14afe35a/src/StaticAnalysis/IgnoredLinesFindingVisitor.php#L67
it already returns $node
without defining the end of the ignore.
I modified the code and in my case it solved the problem
if ($node instanceof Interface_) {
$this->ignoredLines = array_merge(
$this->ignoredLines,
range($node->getStartLine(), $node->getEndLine())
);
return;
}
But I don't know if this global change broke something, that's why I didn't create a Pull Request
@sebastianbergmann what do you think?
@sebastianbergmann Could you take a look at it because I don't know whether to give a pull request?
We're experiencing the same issue with the following (newer) versions:
Q | A |
---|---|
php-code-coverage version | 9.2.21 and 9.2.22 |
PHP version | 8.1.13 |
Driver | both PCOV and Xdebug |
PCOV version | 1.0.11 |
Xdebug version | 3.1.6 |
Installation Method | Composer |
Usage Method | PHPUnit |
PHPUnit version | 9.5.25 |
But with version 9.2.20 everything works as expected.
Same issue for me, some lines from interfaces reported as uncovered, starting from 9.2.21
. With 9.2.20
and before it was fine. I guess issue introduced here #964.
Q | A |
---|---|
php-code-coverage version | 9.2.21 |
PHP version | 8.1.13 |
Driver | Xdebug |
Xdebug version | 3.2.0 |
Installation Method | Composer |
Usage Method | PHPUnit |
PHPUnit version | 9.5.27 |
For reproducible example see https://github.com/vstelmakh/url-highlight
composer install
XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-clover var/coverage.xml
var/coverage.xml
for results.Additionally, attaching a coverage.xml part here. It shrieked (to 13 lines) just to display an issue. The same issue is with HTML coverage.
Seems like got fixed. Not reproducible in 9.2.23
for me.
Hi. I'm sorry to dig up this issue, but I'm encountering something similar an I didn't want to create a duplicate of it.
The coverage reports a false positive on interfaces when signature of methods are described on multiple lines.
You can see the version of CodeCoverage/PHP/PHPUnit I'm using to report this coverage. I'm using XDebug 3.2.0.
Thanks a lot
When I use code coverage in the report I get false-positive information that I partially have un-covered methods from the interface, which is a contract and has no implementation at all in this repository in my case.