-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Convert switch cases to match expression #47654
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Imho, only the change in src/Symfony/Component/Serializer/Normalizer/UidNormalizer.php
should be kept.
Changes in existing code increases maintenance (we have to review & merge it, make sure it doesn't break a single thing in a release, fix merge conflicts when upmerging older branches, etc.). As such they must provide value.
For a match
, this value is the fact that is an expression - unlike switch
. So imho, we should only change switch
statements that are used as expression (which is only the one in the Serializer component). This also seems to have been the case with the previous PR introducing most match
expressions to the code base.
@wouterj I understand your POV, however to me it brings value in code readability but also reliability since match is a strict comparison. But you obviously know better than me if it's worth it as I don't realize the impact of the increased maintenance. If that's ok with you I'll let other core members confirm your stance and make the appropriate modifications. Thanks. |
Personally I find the code more readable when using match. The change is fine to me. |
Ok then, I'll dismiss my -1. Thanks for sharing your opinions :)
Thank you @tigitz. |
Continuation of #45433 using rector rule
@fancyweb friendly ping as you've worked on it previously.