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:----bLtbV2Fqd6ajdyP9Y18zEeb42upQ3zo1Cjl2XspT0cc0vKlUvPGoGXC/Xex8ma2qf7kqCmweJtn47Mp266apdyn33cSZLRxQ1JIdnVABtWNjZ2H7/eCdBFZl6U0LcNXVGNrEBQxbna+tV157gAZmebGrQKIXm3QmULE03Zyv/izHF+WOqj3Pgy+ddKKhOz3j7R4s1HUQ2iWBNwJ5MdwCsjH6ZCANeDjizduWxw7cLUHb9AQ+zhL/JIxYg12QGLF9rrKt8dflkfZaFWlFAytZl+8r1hckmMTS4WSIn5+SFBqBmZUD1Nbo4RRw2R0LF2Mk51BuaLI74fp0eoUUNN5gycICCOK7LD293kQgUmtUro7RJR4xIvQxOnvxlHMs13DJSEybc+Y1A1J8X+RQGCqBOFdE4J+4wqVm1bBc+HkfSBvI2ayY7ShGOFngdsmcxgOSuYRpHR6QJBP3PWjzCaT0LGmtniWRgo3bI5P3GIwMvFULFyHLntFCVS5mDtYEFLB6HerhIoco9fLvWygDvX2TJ6XBoomyZqe7dhCYiL/2YNhqbZ1Ky/8DRh7wReOMBCcqc/SXy57RzuJ9eSUPzNqISA4K/gy7Ca3qPI9/26mvx4fRguzK7BH1t+dnHYJOvh2dA+O5rCBZWFXNIXscPM39lVmCaybvw+5Be9S/ml0L6C4=----ATTACHMENT:----MzM1NzM0MzU2ODcxMjE5IDMxNTkwMzQwMDY0NDk2ODYgNTkxMTk1ODA4MTUyNTgyMw==