Skip to content

Collapse intersection with one type, like union - #541

Merged
TomasVotruba merged 1 commit into
rectorphp:mainfrom
ondrejmirtes:collapse-single-intersection
Oct 28, 2026
Merged

TomasVotruba merged 1 commit into
rectorphp:mainfrom
ondrejmirtes:collapse-single-intersection

Conversation

@ondrejmirtes

Copy link
Copy Markdown
Contributor

When an intersection has only one type left, replace it with that type. Union already does this.

Without this change, the format-preserving printer in rectorphp/rector-src# prints ( & Collection<…>). This change also passes with current rector-src main.

@TomasVotruba
TomasVotruba merged commit 5794a54 into rectorphp:main Oct 28, 2026
8 checks passed
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.

2 participants