plugin icon indicating copy to clipboard operation
plugin copied to clipboard

[Feature Request]: Enum's from(), cases(), tryFrom(), value property

Open eyedroot opened this issue 2 years ago • 0 comments

Feature Description

I'm using PHP 8.1.

PHP's Enum Class has from(), cases() built-in method and ->value property.

https://stitcher.io/blog/php-enums#serializing-backed-enums

/**
 * @method static UserBioEnum from(mixed $input)
 * @method static array cases()
 * @property-read string value
 */
enum UserBioEnum: string
{
    case BODY = 'BODY';
    case HEIGHT = 'HEIGHT';
    case RELIGION = 'RELIGION';
    case MAKEUP = 'MAKEUP';
    case DRINK = 'DRINK';
    case PET = 'PET';

    public static function in(): array
    {
        return Arr::map(array: UserBioEnum::cases(), callback: fn (UserBioEnum $enum) => $enum->value);
    }

    ...

Is feature support available in laravel-idea?

eyedroot avatar Sep 18 '22 04:09 eyedroot