Skip to content

Make generators methods public static; document the convention#11

Merged
rasuvaeff merged 1 commit into
masterfrom
chore/public-static-generators
Jul 11, 2026
Merged

Make generators methods public static; document the convention#11
rasuvaeff merged 1 commit into
masterfrom
chore/public-static-generators

Conversation

@rasuvaeff

Copy link
Copy Markdown
Owner

Generators/examples methods are invoked via property-testing's reflection only — they have no static call sites. Rector's RemoveUnusedPrivateMethodRector (deadCode set) therefore deletes private ones, silently killing property tests on rector:fix (recent rector releases tightened the rule; every consumer with private generators is latently red on a fresh install).

The convention fix that needs no rector configuration anywhere: declare them public static (public if the body needs $this). No dead-code rule touches public methods, and Testo never treats a non-void-returning method as a test.

  • Sweep own tests (GenPropertyTest) and examples (property_test.php, state_machine.php) — stubs already were public static.
  • Document the rule in README, llms.txt and AGENTS.md.

No code changes: the resolver accepts any visibility. Docs+tests only — no release needed.

Generators/examples methods are invoked via reflection only, so Rector's
RemoveUnusedPrivateMethodRector (deadCode set) deletes private ones. Public
static is safe: no dead-code rule touches public methods and Testo never
treats a non-void-returning method as a test.
@rasuvaeff rasuvaeff merged commit ef7dddb into master Jul 11, 2026
7 checks passed
@rasuvaeff rasuvaeff deleted the chore/public-static-generators branch July 11, 2026 14:36
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