src/Enums/EnumTrait.php
protected static function initialize()
    {
        $class = static::class;

        if (static::$constants === null) {
            static::$constants = (new \ReflectionClass($class))->getConstants();

            foreach (static::names() as $name) {
                static::$lcKeyMap[strtolower($name)] = $name;
            }
        }
    }
protected static function initialize()
    {
        $class = static::class;

        if (static::$constants === null) {
            static::$constants = (new \ReflectionClass($class))->getConstants();

            foreach (static::names() as $name) {
                static::$lcKeyMap[strtolower($name)] = $name;
            }
        }
    }
protected static function initialize ( ) { $ class = static :: class ; if ( static :: $ constants === null ) { static :: $ constants = ( new \ ReflectionClass ( $ class ) ) -> getConstants ( ) ; foreach ( static :: names ( ) as $ name ) { static :: $ lcKeyMap [ strtolower ( $ name ) ] = $ name ; } } }
Cache the enum array statically so we only have to do reflection a single time.
Cache the enum array statically so we only have to do reflection a single time .