enums
enums copied to clipboard
Support defining #[Meta] on traits
That way, users can create a trait such as:
/**
* @method string description()
*/
#[Meta(Description::class)
trait HasDescription
{}
And use this across their enums as:
enum Status
{
+ use HasDescription;
+ #[Description('Completed Task')]
case COMPLETED;
}
enum Role
{
+ use HasDescription;
+ #[Description('Administrator')]
case ADMIN;
+ #[Description('Read-only user')]
case GUEST;
}
Implementation
Edit ArchTech\Enums\Meta\Reflection::metaProperties() to also recursively walk through the enum's traits, and extract the enabled meta properties in their #[Meta] attributes, if they're defined.