Skip to content

Incorrect behavior of RemoveUnusedVariableAssignRector #9298

@calebdw

Description

@calebdw

Bug Report

Subject Details
Rector version last dev-main
Installed as composer dependency

Minimal PHP Code Causing Issue

See https://getrector.com/demo/d41fab65-6532-483d-a019-b82beac55caa

<?php

final class DemoFile
{
    public function example(): array
    {
        $value = 42;
        return get_defined_vars();
    }
}

Responsible rules

  • RemoveUnusedVariableAssignRector

Expected Behavior

Variable should not be removed because of the get_defined_vars()

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions