Skip to content

RemoveUnusedVariableAssignRector does not consider variables bound by reference #7963

Description

@spawnia

Bug Report

Subject Details
Rector version 0.17.0

Rector is overly eager in removing variable assignments.
Even when the variable is not referenced after assignment, it may still be bound by reference.

Minimal PHP Code Causing Issue

https://getrector.com/demo/18574ffe-1c32-4d81-9d0d-9f41b9e1c193

Expected Behaviour

Rector should not remove variable assignments when the variable is bound by reference.

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions