Skip to content

NoDynamicNameRule: Fix union type handling #212

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

Merged
merged 1 commit into from
Apr 7, 2025

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Apr 7, 2025

No description provided.

@staabm staabm marked this pull request as ready for review April 7, 2025 09:04
@TomasVotruba
Copy link
Member

Thank you 👍

@TomasVotruba TomasVotruba merged commit a920b42 into symplify:main Apr 7, 2025
6 checks passed
Comment on lines -23 to -27
if ($unwrappedNameStaticType instanceof CallableType) {
return true;
}

if ($unwrappedNameStaticType instanceof ClosureType) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

cases and code like this is the main reason why instanceof on Type is bad practice and discouraged

Copy link
Member

Choose a reason for hiding this comment

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

Depends. We have the exact opposite experience on many Rector rules. The ->is*() method have different behavior and are more tolerant, not 100 % reliable.

@staabm staabm deleted the unionSkip branch April 7, 2025 09:06
@staabm
Copy link
Contributor Author

staabm commented Apr 7, 2025

ahh nice, thanks for the fast merge 😄

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.

3 participants