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

The #[CoversClass] and #[UsesClass] attributes can no longer target traits #5798

Closed
sebastianbergmann opened this issue Apr 6, 2024 · 1 comment
Assignees
Labels
feature/code-coverage Issues related to code coverage (but not php-code-coverage) feature/metadata/attributes type/bug Something is broken version/11 Something affects PHPUnit 11

Comments

@sebastianbergmann
Copy link
Owner

sebastianbergmann commented Apr 6, 2024

Prior to PHPUnit 11.1, the #[CoversClass] and #[UsesClass] attributes could target traits. This was not intentional, which is why there were no tests covering this behaviour. This behaviour was broken while working on #5733 and this breakage was only noticed after the release: Roave/BetterReflection#1420 (comment).

@sebastianbergmann
Copy link
Owner Author

sebastianbergmann commented Apr 6, 2024

The previous behaviour has been restored in 1b743cf. This fix will be released soon with PHPUnit 11.1.1.

In the long run, I do not think that it makes sense to support targeting traits with #[CoversClass] and #[UsesClass]. Therefore, I will deprecate this in PHPUnit 11.2 (#5800). PHPUnit 11.2 will introduce #[CoversTrait] and #[UsesTrait] (#5799) to explicitly target traits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/code-coverage Issues related to code coverage (but not php-code-coverage) feature/metadata/attributes type/bug Something is broken version/11 Something affects PHPUnit 11
Projects
None yet
Development

No branches or pull requests

1 participant