Skip to content

[perf] Skip non-test class early in AddProphecyTraitRector - #793

Merged
TomasVotruba merged 1 commit into
mainfrom
perf-prophecy-trait-test-class-guard
Oct 10, 2026
Merged

TomasVotruba merged 1 commit into
mainfrom
perf-prophecy-trait-test-class-guard

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Previously the rule walked every method of every Class_ node looking for a prophesize() call, even in non-test classes.

Add an early isInTestClass() guard so non-test classes bail before the expensive node traversal. Also covers the previously missing case where a non-test class with a $this->prophesize() call would wrongly get the trait added.

New fixture skip_non_test_class.php.inc covers the skip.

@TomasVotruba
TomasVotruba merged commit b136cb8 into main Oct 10, 2026
8 checks passed
@TomasVotruba
TomasVotruba deleted the perf-prophecy-trait-test-class-guard branch October 10, 2026 08:45
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