Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect behavior of RemoveAlwaysTrueIfConditionRector #7757

Closed
Naugrimm opened this issue Feb 4, 2023 · 0 comments · Fixed by rectorphp/rector-src#3447
Closed

Incorrect behavior of RemoveAlwaysTrueIfConditionRector #7757

Naugrimm opened this issue Feb 4, 2023 · 0 comments · Fixed by rectorphp/rector-src#3447
Labels

Comments

@Naugrimm
Copy link

Naugrimm commented Feb 4, 2023

Bug Report

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

Minimal PHP Code Causing Issue

See https://getrector.com/demo/e8d55b28-49e1-46ff-81df-2866f17b85f3

<?php

final class DemoFile
{
    public function run()
    {
        if (($value = "foo") !== null) {
        	echo $value;
        }
    }
}

Responsible rules

  • RemoveAlwaysTrueIfConditionRector

Expected Behavior

The Rector should either not touch the code or extract the assignment before removing the if-statement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant