Skip to content

[PHPUnit120] Skip PropertyCreateMockToCreateStubRector on abstract/base test classes#696

Merged
TomasVotruba merged 2 commits into
mainfrom
tv-false-positive
Jun 29, 2026
Merged

[PHPUnit120] Skip PropertyCreateMockToCreateStubRector on abstract/base test classes#696
TomasVotruba merged 2 commits into
mainfrom
tv-false-positive

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

PropertyCreateMockToCreateStubRector incorrectly changed property from Mock to Stub when defined in an abstract/base class.

In abstract classes, the mock property is often used for mocking in child classes, so the rule cannot detect the usage and produces a false positive.

Fix

Skip class in shouldSkipClass() when:

  • class is abstract
  • class name ends with TestCase
  • class name starts with Abstract

Added 2 skip fixtures.

@TomasVotruba TomasVotruba merged commit 5048feb into main Jun 29, 2026
8 checks passed
@TomasVotruba TomasVotruba deleted the tv-false-positive branch June 29, 2026 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant