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:----jCw5c+jJyqZUCQEpX3pQgWvR9ft2JrsVHY9QmfWYrWblqrD35HD7sRvzH27BqlEH6VwoR0JBHvrUuuewu6mPBEfOXrnEbJi4nOtYn0LOhPMYETcPYvchJDggUWCfjTobSsOBRouDMWL7UIhh7m5/0i7WwTxVmLeuWlx5/wazFd7nEAM/11C46FyYYFqcmhRlRG+4tBlV7uhyLiEuVBuYQ/7Vzx3uskfjsG0DwuW7bGDsTm+U71A6HqMj0EoyV/gsj0cOTl1Makv48IfaiCk9+jO68Pti7FT2h1O7d74VW9mr38jarAkpNOytvT1EPxfWHtjzqrBR6hr9gbtRYoPj6XqzrZMB42DKczAuig6jPxWR9KxuewosxgRKPMcM5LFqbhNcTXQhy5uibgyvJx7XfNsrMgmqvVcSDmO956xOmu/YWfDp5fpEK8o5IrHhHlecaMxyrRkt9OuGN22vGHBNoplNlzLX6iv0ghIwx5EOSxeDAE0PmiMTFzGbEr4m/fkc6EhWiHEWWrmqp6ecNAqoCSFQZVkA8YtRFJbzecx1Bh2GdkmlnIdVi+mq7R7M63yWGkrPHEcOu1E+92uWLPAPI+/LZZ33ggoqb0lvovisbxbZo89OvFPd6yl7fCkNOuHlMGNqFoYrZicnNNXvVWMDg/xxrOTFoTzK9UsCEoGqurE=----ATTACHMENT:----NjEwNjczNjc4MTc1MjQxNSA0MTA2NjE1NjAyMjU1ODc3IDk1MjQxNzE0NzUwOTU4NDc=