sebastianbergmann/php-code-coverage

`@codeCoverageIgnore` annotation does not work on `enum`

KorDum opened this issue · 0 comments

Q A
PHPUnit version 10.5.12
PHP version 8.3.3
Installation Method Composer

Summary

If you specify an annotation at a class, code coverage ignores the class and its methods. This is correct behavior.
But the same does not work for enum, but it works for its methods.

Current behavior

Annotation codeCoverageIgnore ingores for enums.

How to reproduce

/**
 * @codeCoverageIgnore
 */
enum Some
{
    case SomeCase;

    // not ignored, red coverage
    public function isSomeCase(): bool
    {
        return $this === self::SomeCase;
    }
}
enum Some
{
    case SomeCase;

    /**
     * @codeCoverageIgnore
     * ok ignored, without coverage
     */
    public function isSomeCase(): bool
    {
        return $this === self::SomeCase;
    }
}

Expected behavior

Code coverage will ignore enum and predicate.