src/EnumerationBridge.php
public static function registerEnumType($name, callable $constructor, callable $serializer = null)
    {
        if (static::hasType($name)) {
            return;
        }

        $serializer = $serializer ?? function ($value) { return ($value === null) ? null : (string)$value; };

        // Register and customize the type
        static::addType($name, static::class);

        /** @var EnumerationBridge $type */
        $type              = static::getType($name);
        $type->name        = $name;
        $type->constructor = $constructor;
        $type->serializer  = $serializer;
    }
public static function registerEnumType($name, callable $constructor, callable $serializer = null)
    {
        if (static::hasType($name)) {
            return;
        }

        $serializer = $serializer ?? function ($value) { return ($value === null) ? null : (string)$value; };

        // Register and customize the type
        static::addType($name, static::class);

        /** @var EnumerationBridge $type */
        $type              = static::getType($name);
        $type->name        = $name;
        $type->constructor = $constructor;
        $type->serializer  = $serializer;
    }
public static function registerEnumType ( $ name , callable $ constructor , callable $ serializer = null ) { if ( static :: hasType ( $ name ) ) { return ; } $ serializer = $ serializer ?? function ( $ value ) { return ( $ value === null ) ? null : ( string ) $ value ; } ; // Register and customize the type static :: addType ( $ name , static :: class ) ; /** @var EnumerationBridge $type */ $ type = static :: getType ( $ name ) ; $ type -> name = $ name ; $ type -> constructor = $ constructor ; $ type -> serializer = $ serializer ; }
Registers an enumerable handler

@param string   $name
@param callable $constructor Receives: value, enum name, platform
@param callable $serializer  Receives: value, enum name, platform

@throws InvalidArgumentException
@throws DBALException
Registers an enumerable handler