Skip to content

Failling test: MergeWithCallableAndWillReturnRector forgest to introduce closure use#604

Closed
staabm wants to merge 1 commit into
rectorphp:mainfrom
staabm:patch-1
Closed

Failling test: MergeWithCallableAndWillReturnRector forgest to introduce closure use#604
staabm wants to merge 1 commit into
rectorphp:mainfrom
staabm:patch-1

Conversation

@staabm

@staabm staabm commented Dec 17, 2025

Copy link
Copy Markdown
Contributor

rector currently transforms the source into a syntax error

grafik

because it forgets to introduce a use ($initialStatements) for the variable involved

@staabm

staabm commented Dec 17, 2025

Copy link
Copy Markdown
Contributor Author

I don't plan to work on it, just reporting the bug

@TomasVotruba TomasVotruba marked this pull request as ready for review June 26, 2026 09:30
TomasVotruba added a commit that referenced this pull request Jun 26, 2026
… use() for variables nested in willReturn expr (#683)

Previously only a bare Variable willReturn arg got a closure use().
A variable nested inside an array (e.g. willReturn([$initialStatements, []]))
was moved into the closure without a use(), producing a syntax error.

Now all variables referenced in the returned expression are collected
(skipping closure params and $this) and added as closure uses.

Fixes #604
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