Skip to content

@codeCoverageIgnore annotation does not work on enum #1033

Closed
@KorDum

Description

@KorDum
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.

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions