Skip to content

Latest commit

 

History

History
30 lines (21 loc) · 577 Bytes

constructor.md

File metadata and controls

30 lines (21 loc) · 577 Bytes

Constructor

For people coming from Spatie's PHP Enum, this one will allow you to easily migrate away to actual enums.

Usage

Add the Constructor trait and add the docblock just like you would with Spatie's package.

use Henzeb\Enumhancer\Concerns\Constructor;

/**
 * @method static self CALLABLE()
 */
enum yourEnum {
    use Constructor;

    case CALLABLE;
}

Examples

YourEnum::CALLABLE(); // will return YourEnum::CALLABLE;

Note: This trait is not enabled by default when using the Enhancers trait.