Bug report
When I immediately call an anonymous function that uses a passed-by-reference variable, and modify the variable, the type information for the variable in the scope gets corrupted.
For example, this works fine:
https://phpstan.org/r/cff926d5-dcf6-48b8-a72d-7c0bc35d1bde
But as soon as you modify the passed-by-referenced variable, the scope gets corrupted.
You can see that from the assertion above the modification. It already contains the change, that happens after the assertion.
Also the structure of the type changes.
Code snippet that reproduces the problem
https://phpstan.org/r/55207449-fbb3-434e-8871-f07a20514457
Expected output
See assertions in the output.
Did PHPStan help you today? Did it make you happy in any way?
💙💙💙💙💙💙💙💙💙