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:----Hi0Hh5dMuIHMhjzpgGPfJmNisfgSm0iHioSM5Ep7EIpHXMvr5ztP4szRtDpsWos4JV2n+Svi7rhPVnLPk4TkVICBtRbw3lR2RlO39e5J7u3AohscU2MsU13YWKUB1PmAe1vKA1aECGPbagI9Ok32/Q8HWDojQgC9in2y54WSZQacfxdlm7X5V7v5YEtEOIDHNoVa1rmm+NlTBBP0Gq9cBljU/IbeCQel6CGemWfjGi4u2H0l+avqujeZYVOj5Q4bW+h1ekfpBz3Jit6Yf4hzoqm7EU0JOa5NjeLt+ZSUjnBErxB8Djeh/HEz74WItdV66Y+GzqlsAnJwCTnM2q+xJsHjgjG/JNNKqgeJsQBzejquxeIT+TLpNfEnyX9O2NAFqKlyyBwpKe5YWT/SjA/jV2O8XRQ1V6I5Xf/F27KUwfMlebSLYGL5mdl3RKEHdnr+2fKujJYAg5mpCkxJoyCIJlwYs0Nx260i0sDC6ptr9dyCS8me6oJhd2HoYDnLr2bpb6YJ1AQa8F4HTf8SHZrFVKB17f7wQ+IHVNFpvEOW2c9Qp+fW9TA4g0lENlcJtInJHnGiSZzrjcWhMotR3G0LWzBYmn7I7ZT6d6ERzeefCxU/c4nQRXKKfWzsQO/WvY8gouNblZ/mHc3H0Yh2H9CaBDLtJzjzt6OSIEhhpNPfEyM=----ATTACHMENT:----ODAxNzQyNzMwMTMzNTY5MyAxMDQ4MjUyMjU5Mjg1MzkgNzA2MzUzNjcyMzQzMzY2Nw==