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] Skip already initialized on next Stmt on AddDefaultValueForUndefinedVariableRector #2721

Merged
merged 5 commits into from Jul 29, 2022

Conversation

samsonasik
Copy link
Member

@samsonasik samsonasik commented Jul 29, 2022

Given the following code should be skipped:

<?php

namespace Rector\Tests\Php56\Rector\FunctionLike\AddDefaultValueForUndefinedVariableRector\Fixture;

class SkipAlreadyInitializedNext
{
    public function run()
    {
        $a = null;
        $b = null;

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

        echo $a;
        echo $b;
    }
}

Fixes rectorphp/rector#7327

@samsonasik
Copy link
Member Author

Fixed 🎉 /cc @brandelc

@samsonasik
Copy link
Member Author

[ci-review] Rector Rectify change seems due to new ECS release https://github.com/symplify/easy-coding-standard/releases/tag/11.0.9 with latest php-cs-fixer

@samsonasik
Copy link
Member Author

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

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