Skip to content

Conversation

@nebojsa10
Copy link

Adds a reusable trait that provides a tryFromName() method for PHP enums. This method looks up enum cases by their name property and returns the matching case or null if not found.

🤖 Generated with Claude Code

  • Added automated tests
  • Documented for all relevant versions

Changes

Breaking changes

Adds a reusable trait that provides a tryFromName() method for PHP enums.
This method looks up enum cases by their name property and returns the
matching case or null if not found.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@nebojsa10 nebojsa10 requested a review from spawnia November 12, 2025 14:02
Nebojsa Vrtic and others added 3 commits November 12, 2025 15:16
…enums

Adds tests for TryFromNameTrait to handle edge cases such as empty strings, spaces, and special characters. Also includes support for pure enums. Updates PHPStan configuration for enum compatibility.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants