Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@codeCoverageIgnore annotation does not work on enum #1033

Closed
KorDum opened this issue Mar 12, 2024 · 0 comments
Closed

@codeCoverageIgnore annotation does not work on enum #1033

KorDum opened this issue Mar 12, 2024 · 0 comments
Assignees
Labels

Comments

@KorDum
Copy link

KorDum commented Mar 12, 2024

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.

@sebastianbergmann sebastianbergmann self-assigned this Mar 12, 2024
@sebastianbergmann sebastianbergmann transferred this issue from sebastianbergmann/phpunit Mar 12, 2024
@sebastianbergmann sebastianbergmann changed the title Annotation codeCoverageIgnore does not work for enum @codeCoverageIgnore annotation does not work on enum Mar 12, 2024
sebastianbergmann added a commit that referenced this issue Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants