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

[CodeQuality] Skip Generator on SimplifyForeachToCoalescingRector #6221

Merged
merged 4 commits into from
Aug 6, 2024

Conversation

samsonasik
Copy link
Member

@samsonasik samsonasik commented Aug 6, 2024

@samsonasik
Copy link
Member Author

Fixed 🎉 /cc @pilot114

Comment on lines +173 to +176
$foreachExprType = $this->nodeTypeResolver->getNativeType($foreach->expr);
if (! $foreachExprType->isArray()->yes()) {
return null;
}
Copy link
Member Author

Choose a reason for hiding this comment

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

this ensure it only change native array type, as change other type can be any type, eg: Generator or object extends stdClass, see https://3v4l.org/6i6kj

@samsonasik
Copy link
Member Author

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

@samsonasik samsonasik merged commit 69a3e31 into main Aug 6, 2024
34 checks passed
@samsonasik samsonasik deleted the skip-generator branch August 6, 2024 13:52
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 rule SimplifyForeachToCoalescingRector with generators
2 participants