Skip to content

Incorrect behavior of CombineIfRector #9331

@mspirkov

Description

@mspirkov

Bug Report

Subject Details
Rector version dev-main

Minimal PHP Code Causing Issue

https://getrector.com/demo/9209bf10-bb30-4028-96a2-0e8cd7ca8cf8

<?php

final class DemoFile
{
    public function run()
    {
        if ($cond1) {
            if (($cond2 = $this->getCond2Value()) === null) {
                return 'foo';
            }
        }
    }
}

Expected Behaviour

<?php

final class DemoFile
{
    public function run()
    {
        if ($cond1 && ($cond2 = $this->getCond2Value()) === null) {
            return 'foo';
        }
    }
}

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