Skip to content

SimplifyIfReturnBoolRector #9798

Description

@UweOhse

Bug Report

the SimplifyIfReturnBoolRector simplifies wrongly: (!return_false() { return true; } return true; } to return return_false();

Subject Details
Rector version 2.5.4

Minimal PHP Code Causing Issue

function return_false(): false {     return false; }
function test(): bool
{
    if (!return_false()) {
        return true;
    }
    return true;
}

https://getrector.com/demo/342716f9-36b2-4a70-8965-39a13802f2cb

Expected Behaviour

return true seems logical, leaving the code as-is would be okay, too.

Metadata

Metadata

Assignees

No one assigned

    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