Skip to content

Single line method is ignored #1020

Closed
@mvorisek

Description

@mvorisek
Q A
php-code-coverage version 9.2.29
PHP version 8.2.12
Driver Xdebug
PCOV version (if used) n/a
Xdebug version (if used) 3.2.2
Installation Method Composer
Usage Method PHPUnit
PHPUnit version (if used) 9.6.13

repro code:

class InitializerTraitTest extends TestCase
{
    public function testInitDeclaredPublicException(): void
    {
        $m = new class() extends AbstractInitializerMock {
            public function init(): void {}
        };
    }
}

(full source code: https://github.com/atk4/core/blob/5.0.0/tests/InitializerTraitTest.php#L72)

when the code above is modified like:

+            #[\Override]
             public function init(): void {}

then the coverage is collected. It seems this lib does not account for single line methods (methods starting and ending at the same line, even a method attribute on another line is enough to enable coverage).

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions