Skip to content

Conversation

@kalifg
Copy link

@kalifg kalifg commented Jan 24, 2026

Summary

This PR adds the PHPUnit\Framework\Attributes\CoversClass attribute errors to the phpstan baseline.

Problem

When running make static-code-analysis with PHPUnit 9 installed (the default when running composer install), phpstan reports errors for the PHPUnit 10/11/12 test files that use attributes:

test/Phar/Version10/SleeperTest.php - Attribute class PHPUnit\Framework\Attributes\CoversClass does not exist.
test/Phar/Version11/SleeperTest.php - Attribute class PHPUnit\Framework\Attributes\CoversClass does not exist.
test/Phar/Version12/SleeperTest.php - Attribute class PHPUnit\Framework\Attributes\CoversClass does not exist.

These errors occur because the CoversClass attribute was introduced in PHPUnit 10, but phpstan runs against whatever PHPUnit version is installed (typically 9.x based on the platform config).

Solution

Regenerated the phpstan baseline to include these expected errors, allowing make static-code-analysis to pass.

Verification

make static-code-analysis
# [OK] No errors

The PHPUnit\Framework\Attributes\CoversClass attribute is only available
in PHPUnit 10+. When running phpstan with PHPUnit 9 installed, these
attributes are not recognized, causing static analysis errors.

Adding these to the baseline allows CI to pass regardless of which
PHPUnit version is installed during static analysis.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants