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

[Php80][CodeQuality] Handle crash on ChangeSwitchToMatchRector + TernaryFalseExpressionToIfRector on under if else #5446

Merged
merged 5 commits into from
Jan 8, 2024

Conversation

samsonasik
Copy link
Member

@samsonasik samsonasik commented Jan 8, 2024

…aryFalseExpressionToIfRector on under if else
@samsonasik samsonasik marked this pull request as draft January 8, 2024 13:33
@samsonasik samsonasik marked this pull request as ready for review January 8, 2024 13:41
@samsonasik
Copy link
Member Author

Fixed 🎉 /cc @noother

@samsonasik
Copy link
Member Author

All checks have passed 🎉 @TomasVotruba I am merging it ;)

@samsonasik samsonasik merged commit 7e56672 into main Jan 8, 2024
40 checks passed
@samsonasik samsonasik deleted the crash-change-switch-ternary branch January 8, 2024 13:43
Comment on lines +131 to +132
foreach ($node->stmts as $stmt) {
$stmt->setAttribute(AttributeKey::SCOPE, $mutatingScope);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using $this->nodeScopeResolver->processNodes($node->stmts, $mutatingScope, $nodeCallback); may probably better for reliable enter scope.

I will check if that may cause some performance hit.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing manually with multi stmts, the scope seems linear, so it seems ok (for now), note to myself: it may need to revisit.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Incorrect behavior of ChangeSwitchToMatchRector, TernaryFalseExpressionToIfRector
2 participants