Skip to content

Add EnumHelpers trait for utility methods on backed enums#13

Merged
iqbalhasandev merged 5 commits intomainfrom
feat/add-enum-helpers-concern
Mar 10, 2026
Merged

Add EnumHelpers trait for utility methods on backed enums#13
iqbalhasandev merged 5 commits intomainfrom
feat/add-enum-helpers-concern

Conversation

@iqbalhasandev
Copy link
Copy Markdown
Member

This pull request introduces a new trait, EnumHelpers, that provides utility methods for backed enums. The trait is designed to simplify working with enums by adding common helpers for listing options, values, names, and checking if a value exists. These methods are especially useful for generating frontend select options and validating enum values.

Enum utility methods:

  • Added EnumHelpers trait in src/Concerns/EnumHelpers.php with methods for listing enum options (options), generating frontend select options (selectOptions), retrieving values (values), retrieving names (names), and checking value existence (hasValue).

@iqbalhasandev iqbalhasandev self-assigned this Mar 10, 2026
Copilot AI review requested due to automatic review settings March 10, 2026 05:57
@iqbalhasandev iqbalhasandev added the enhancement New feature or request label Mar 10, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a new EnumHelpers trait intended to add common convenience methods for PHP backed enums (options/values/names/existence checks), aimed at simplifying enum usage (e.g., building frontend select data).

Changes:

  • Added DevWizardHQ\Enumify\Concerns\EnumHelpers trait with helpers: options(), selectOptions(), values(), names(), hasValue().
  • Updated .gitignore to ignore macOS .DS_Store files.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 5 comments.

File Description
src/Concerns/EnumHelpers.php Adds a trait providing utility methods for backed enums (options/select options/value/name lookups).
.gitignore Ignores .DS_Store files.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread src/Concerns/EnumHelpers.php
Comment thread src/Concerns/EnumHelpers.php
Comment thread src/Concerns/EnumHelpers.php
Comment thread src/Concerns/EnumHelpers.php
Comment thread src/Concerns/EnumHelpers.php
@iqbalhasandev iqbalhasandev force-pushed the feat/add-enum-helpers-concern branch from 5dec98d to eef03bc Compare March 10, 2026 06:06
@iqbalhasandev iqbalhasandev merged commit 0391d8c into main Mar 10, 2026
@iqbalhasandev iqbalhasandev deleted the feat/add-enum-helpers-concern branch March 10, 2026 06:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants