Skip to content

[PHPUnit60] Change AddDoesNotPerformAssertionToNonAssertingTestRector node from ClassMethod to Class_ - #830

Merged
TomasVotruba merged 2 commits into
mainfrom
does-not-perform-assertion-on-class
Nov 14, 2026
Merged

TomasVotruba merged 2 commits into
mainfrom
does-not-perform-assertion-on-class

Conversation

@TomasVotruba

@TomasVotruba TomasVotruba commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Rule now visits Class_ and walks its methods, keeping the same name.

  • class-level checks run once per class, before walking methods: test class, abstract class, Twig integration test case (via Scope class reflection), asserting lifecycle methods
  • resolveCurrentClass() lookup in file stmts is gone, the lifecycle check gets the Class_ directly
  • trait skip is now implicit, traits are not Class_ nodes
  • benches pass Class_ nodes
  • attribute order in PHPUnit10DataProvider fixture changed, as this rule now runs before the method-level DataProviderAnnotationToAttributeRector

@TomasVotruba
TomasVotruba force-pushed the does-not-perform-assertion-on-class branch from ede393c to c11dd51 Compare November 14, 2026 17:23
@TomasVotruba

Copy link
Copy Markdown
Member Author

By convention, PHPUnit test-related Rector rules that need to have context of both class method and class, should always hook into Class_ node. This also quickly solves all issues like inheritance class reflection, current trait/class context etc.

@TomasVotruba
TomasVotruba merged commit 82a7251 into main Nov 14, 2026
11 checks passed
@TomasVotruba
TomasVotruba deleted the does-not-perform-assertion-on-class branch November 14, 2026 19:58
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