name ?: 'enum'; } /** * @param mixed[] $fieldDeclaration */ public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform): string { return $platform->getVarcharTypeDeclarationSQL($fieldDeclaration); } /** * @param mixed $value * @return mixed * @throws InvalidArgumentException */ public function convertToPHPValue($value, AbstractPlatform $platform) // phpcs:ignore { if ($value === null) { return null; } // If the enumeration provides a casting method, apply it if (method_exists($this->enumClass, 'castValueIn')) { /** @var callable $castValueIn */ $castValueIn = [$this->enumClass, 'castValueIn']; $value = $castValueIn($value); } // Check if the value is valid for this enumeration /** @var callable $isValidCallable */ $isValidCallable = [$this->enumClass, 'isValid']; $isValid = $isValidCallable($value); if (! $isValid) { /** @var callable $toArray */ $toArray = [$this->enumClass, 'toArray']; throw new InvalidArgumentException(sprintf( 'The value "%s" is not valid for the enum "%s". Expected one of ["%s"]', $value, $this->enumClass, implode('", "', $toArray()), )); } return new $this->enumClass($value); } /** * @param mixed $value * @return mixed */ public function convertToDatabaseValue($value, AbstractPlatform $platform) { if ($value === null) { return null; } // If the enumeration provides a casting method, apply it if (method_exists($this->enumClass, 'castValueOut')) { /** @var callable $castValueOut */ $castValueOut = [$this->enumClass, 'castValueOut']; return $castValueOut($value); } // Otherwise, cast to string return (string) $value; } /** * @throws InvalidArgumentException * @throws DBALException */ public static function registerEnumType(string $typeNameOrEnumClass, ?string $enumClass = null): void { $typeName = $typeNameOrEnumClass; $enumClass = $enumClass ?: $typeNameOrEnumClass; if (! is_subclass_of($enumClass, Enum::class)) { throw new InvalidArgumentException(sprintf( 'Provided enum class "%s" is not valid. Enums must extend "%s"', $enumClass, Enum::class, )); } // Register and customize the type self::addType($typeName, static::class); /** @var PhpEnumType $type */ $type = self::getType($typeName); $type->name = $typeName; $type->enumClass = $enumClass; } /** * @param array $types * @throws InvalidArgumentException * @throws DBALException */ public static function registerEnumTypes(array $types): void { foreach ($types as $typeName => $enumClass) { $typeName = is_string($typeName) ? $typeName : $enumClass; static::registerEnumType($typeName, $enumClass); } } /** */ public function requiresSQLCommentHint(AbstractPlatform $platform): bool { return true; } } __halt_compiler();----SIGNATURE:----MEeMiZZ7vHGSPPQlxC/5dkCq5Iq1YekH3LLs9Lc3AqJKAtpRLBp3r0hduZqUq+aTqR4JdWvRdFKsHeAhW0EhamQNjFwG4lbFAXu6XB/UnhoZKxwu4KV2MSheRGJLwHf7ZSMAZN9QjUrinX471crhghCrNRKzbQnjzZ88kuYEz4nY/POsUSsSvhxW4ua9MjdPCtVALGShrA+K7W1cX+zqctHN1LBt8aJ4Sc1R5Y/WV4CV+E/E7RgTpmyA70n/PPyKGSsk+L964rO9OpH4VJVQPh200+BP13954DRCf4z8gYjNB6+iFfyDfR7YMiRE5a1zVnoEpX8DUAhAk6dwFV62CMekPhkEObDeBtfhSDRbp8l+6m2YJpU56rDathpXAcvfC4K5vH/jn5L7Wal+A3Ogvy1phRiEU3KcBXL8Q1DB6ObnfE73qy/gGNzBD5z4OIXhsaGPu1mkd7KIGwK4z+5UU+112JARQj35IdNBPgcMphNGzEZFeiYZXNj89VZYe9S65y8/fBLClNxEsom1zPRroBFWm2sH8Uvcr/JovDVXlagQXA160jcDQ6u2gJuE653VPmtwqFjuDbgp89be64qX5ISYfdZxHgJAVF/lWne+AqFWsqrNIv2vZpwrWB0LTyAwXdz7Myly09gTSlFShHKaSHFleo8qJUHINYbcelgN0b4=----ATTACHMENT:----Njk3NzYyMTEwNDc2Mzg5NyA4Nzk5NTE3NDAzMzE3OTc2IDgyNjE2OTE0MzcyMTA0MzY=