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

[Php56] Handle jump not Expression stmt next initialized on AddDefaultValueForUndefinedVariableRector #2725

Merged
merged 6 commits into from Aug 2, 2022

Conversation

samsonasik
Copy link
Member

@samsonasik samsonasik commented Aug 2, 2022

Continue of #2721, when initialized, but jumped in not Expression after Stmt, it should be processed like this:

class InitializedJumpNext
{
    public function run()
    {
        if (rand(0, 1)) {
            echo $a;
        }

        $a = null;

        if (rand(0, 1)) {
            $a = 5;
        } else if (rand(0,1)) {
            unset($a);
        }

        echo $a;
    }
}

should be processed to:

     public function run()
     {
+        $a = null;
         if (rand(0, 1)) {

@samsonasik
Copy link
Member Author

Fixed 🎉

@samsonasik samsonasik changed the title [Php56] Handle jump no Expression stmt next initialized on AddDefaultValueForUndefinedVariableRector [Php56] Handle jump not Expression stmt next initialized on AddDefaultValueForUndefinedVariableRector Aug 2, 2022
@samsonasik
Copy link
Member Author

All checks have passed 🎉 @TomasVotruba it is ready for review.

@TomasVotruba TomasVotruba merged commit 5ec4cff into main Aug 2, 2022
@TomasVotruba TomasVotruba deleted the handle-jump-next branch August 2, 2022 06:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants