Skip to content

Conversation

@hrant1020
Copy link
Contributor

@hrant1020 hrant1020 commented May 3, 2024

Removed redundant ! method_exists($enumClass, 'tryFrom') check. Since ! enum_exists($enumClass) already verifies if the class is an enum, it's implicit that 'tryFrom' method exists for enums. This change improves code readability and eliminates unnecessary redundancy.

@taylorotwell
Copy link
Member

If nothing is broken I would leave it. 👍

@hrant1020
Copy link
Contributor Author

hrant1020 commented May 3, 2024

@taylorotwell thanks !

I have open discussion about this PR because I believe its correct

UPD
You're correct, the PR won't work with non-backed enums.

@hrant1020 hrant1020 deleted the remove-redundant-and-formating branch May 4, 2024 14:06
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.

2 participants