Skip to content

Fix test fixtures instead of suppressing ClassMustBeFinal and purity issues - #39

Merged
danog merged 1 commit into
masterfrom
annotate-fixtures
Oct 20, 2026
Merged

danog merged 1 commit into
masterfrom
annotate-fixtures

Conversation

@danog

@danog danog commented Oct 20, 2026

Copy link
Copy Markdown
Member

The acceptance test configs suppressed ClassMustBeFinal and Psalm 7's missing purity/immutability annotation issues instead of the fixtures being fixed.

Before:

class User // ClassMustBeFinal, MissingImmutableAnnotation (suppressed)
{
    public function getName(): string { // MissingPureAnnotation (suppressed)
      return 'name';
    }
}
$user = Mockery::mock(User::class);

After:

/** @psalm-immutable */
interface User
{
    /** @psalm-pure */
    public function getName(): string;
}
$user = Mockery::mock(User::class);

https://claude.ai/code/session_01WNSb29tptiTQoc44Tk7XZW

The acceptance configs suppressed ClassMustBeFinal and the missing
purity/immutability annotation issues. Psalm reports ClassMustBeFinal
regardless of findUnusedCode, so fix the fixtures instead: mock
interfaces where a scenario only needs a type, partially mock an
abstract class, keep the alias and overload targets final (those
mocks never extend the class), make the test case final, and declare
the purity of the fixture code.

Claude-Session: https://claude.ai/code/session_01WNSb29tptiTQoc44Tk7XZW
@danog
danog merged commit c89765d into master Oct 20, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant