Skip to content

Incorrect behavior of SplitDoubleAssignRector #7838

@kduma

Description

@kduma

Bug Report

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

Minimal PHP Code Causing Issue

See https://getrector.com/demo/03059092-b305-4602-b5ae-468d91dea199

<?php

final class DemoFile
{
    public function run()
    {
        $vouchers[] = $voucher = new stdObject;
        $vouchers->test = 'test';
        
        return $vouchers;
    }
}

Responsible rules

  • SplitDoubleAssignRector

Expected Behavior

<?php

final class DemoFile
{
    public function run()
    {
        $voucher = new stdObject;
        $vouchers[] = $voucher;
        $voucher->test = 'test';
        
        return $vouchers;
    }
}

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