Skip to content

[Php56] Skip after infinite loop on AddDefaultValueForUndefinedVariableRector#3390

Merged
samsonasik merged 13 commits intomainfrom
close-3388
Feb 19, 2023
Merged

[Php56] Skip after infinite loop on AddDefaultValueForUndefinedVariableRector#3390
samsonasik merged 13 commits intomainfrom
close-3388

Conversation

@samsonasik
Copy link
Copy Markdown
Member

@samsonasik
Copy link
Copy Markdown
Member Author

Oh, it seems can't be resolved by check first stmt as first stmt can be multiple condition, for example:

        echo 'test';

        while (true !== false) {
        }

that still added. I added more failing fixture for it e78c0ee

@samsonasik
Copy link
Copy Markdown
Member Author

I am not sure about this, the question is why create abvious infinite loop on early code in the first place :)

        while (true !== false) {
        }

        $a = [];

        if ($b = $yes) {
            $a[] = 'test';
        }

        return $a;

I am closing this for now.

@samsonasik samsonasik closed this Feb 19, 2023
@samsonasik samsonasik deleted the close-3388 branch February 19, 2023 08:52
@samsonasik samsonasik restored the close-3388 branch February 19, 2023 10:56
@samsonasik samsonasik reopened this Feb 19, 2023
@samsonasik
Copy link
Copy Markdown
Member Author

Re-open, @jackbentley it seems it can be resolved by check parent Node of Stmt is an Unreachable stmt on PHPStanNodeScopeResolver

@samsonasik
Copy link
Copy Markdown
Member Author

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

@samsonasik
Copy link
Copy Markdown
Member Author

@TomasVotruba I am merging it ;)

@samsonasik samsonasik merged commit c65e60f into main Feb 19, 2023
@samsonasik samsonasik deleted the close-3388 branch February 19, 2023 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unresolvable loop causes incorrect behavior of AddDefaultValueForUndefinedVariableRector

2 participants