Skip to content

declare(strict_types=1) line in interfaces and enum cases are being marked as uncovered lines of code #897

@davidbyoung

Description

@davidbyoung
Q A
php-code-coverage version 9.2.11
PHP version 8.1.2
Driver Xdebug
Xdebug version (if used) 3.1.2
Installation Method Composer
Usage Method PHPUnit
PHPUnit version (if used) 9.5.14

I have tried for several hours to create a simple, self-contained example of what is broken, but am really struggling. When I run with php-code-coverage version 9.2.10, everything works fine and I get 100% test coverage in my monorepo. However, when updating to 9.2.11, I am getting lines like declare(strict_types=1); and enum cases being marked as uncovered for a few interfaces and enums.

Because I am having a hard time reproducing, I thought I'd at least share links to some coverage difference examples. For reference, the only difference in the following is what version of php-code-coverage I'm running:

Here is my PhpUnit config. If there is any other useful info I can give you, let me know and I'll be glad to assist. I'll keep trying to reproduce this with a simple example, but copy-pasting the broken interfaces and enums into a new, empty project doesn't repro the issue for some reason.

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