Skip to content

Incorrect behavior of RemoveAlwaysElseRector #7441

@kkmuffme

Description

@kkmuffme

Bug Report

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

Minimal PHP Code Causing Issue

See https://getrector.org/demo/eb0f5c8f-86e3-40ed-bb38-86675496f0c8

<?php

final class DemoFile
{
    public function run()
    {
        if ( rand( 0, 5 ) > 2 ) {
 	       return;
		} else { ?>
			this is <?php echo "hello"; ?> world
		<?php }
    }
}

Responsible rules

  • RemoveAlwaysElseRector

Expected Behavior

Not create a fatal error

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