Skip to content

Inline deprecated symplify/rule-doc-generator-contracts under Rector\RuleDoc - #8586

Merged
TomasVotruba merged 5 commits into
mainfrom
inline-rule-doc-contracts
Oct 10, 2026
Merged

TomasVotruba merged 5 commits into
mainfrom
inline-rule-doc-contracts

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

symplify/rule-doc-generator-contracts is deprecated. This moves its classes into src/RuleDoc under the Rector\RuleDoc namespace and drops the dependency.

What changed

  • 13 contract classes inlined into src/RuleDoc/ (Contract, ValueObject, Exception), namespace Rector\RuleDoc\*
  • 520 internal files switched from Symplify\RuleDocGenerator\* to Rector\RuleDoc\*
  • symplify/rule-doc-generator-contracts removed from composer.json

Backward compatibility

A thin alias layer (src/functions/rule_doc_generator_class_aliases.php, wired via autoload.files) maps every old Symplify\RuleDocGenerator\* FQCN onto the new class. Extension packages (doctrine, symfony, phpunit, downgrade) and 3rd party rules that still reference the old namespace keep working unchanged - no code change required on their side.

The #^Symplify\RuleDocGenerator# scoper exclude is kept so the alias names stay unprefixed in the built PHAR, same as before.

Fixture/Source stubs intentionally keep the old namespace - they ride the alias and act as a live BC check.

…RuleDoc

The symplify/rule-doc-generator-contracts package is deprecated. Move its
classes into src/RuleDoc under the Rector\RuleDoc namespace and drop the
dependency.

A BC alias layer (src/functions/rule_doc_generator_class_aliases.php) maps the
old Symplify\RuleDocGenerator\* FQCNs onto the new ones, so extension and 3rd
party rules that reference the old namespace keep working unchanged. The scoper
exclude for that namespace is kept so the alias names stay unprefixed in the
built PHAR.
@TomasVotruba
TomasVotruba force-pushed the inline-rule-doc-contracts branch from fb1fff3 to b8bc004 Compare October 10, 2026 10:00
Drops the hard skip that bails out before refactor() when a node was
already rectified by the same rule or just reprinted without a refreshed
scope.

Breaks ChangeSwitchTernaryTest: a rule firing on a freshly reprinted
Expression node hits ScopeFetcher::fetch() on a scopeless node and
throws 'Scope not available'. The guard was the safety net for that
case (and for consecutive CREATED_BY_RULE re-application loops).
@TomasVotruba
TomasVotruba merged commit 300fbc1 into main Oct 10, 2026
44 of 59 checks passed
@TomasVotruba
TomasVotruba deleted the inline-rule-doc-contracts branch October 10, 2026 13:14
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