Repository: symfony/symfony
File: src/Symfony/Component/Form/Extension/Core/Type/CurrencyType.php (PHP)

Code before:
    {
        $resolver->setDefaults([
            'choice_loader' => function (Options $options) {
                if (!class_exists(Intl::class)) {
                    throw new LogicException(\sprintf('The "symfony/intl" component is required to use "%s". Try running "composer require symfony/intl".', static::class));
                }

                $choiceTranslationLocale = $options['choice_translation_locale'];

                return ChoiceList::loader(
                    $this,
                    new IntlCallbackChoiceLoader(
                        static function () use ($options, $choiceTranslationLocale) {
                            $activeAt = $options['active_at'];

                            $notActiveAt = $options['not_active_at'];

                            $legalTender = $options['legal_tender'];

                            // When the `active_at`, `not_active_at` and `legal_tender` options are null, it is unnecessary to retrieve the currencies from the meta index
                            if (null === $activeAt && null === $notActiveAt && null === $legalTender) {
                                return array_flip(Currencies::getNames($choiceTranslationLocale));
                            }

                            if (null !== $activeAt && null !== $notActiveAt) {
                                throw new InvalidOptionsException('The "active_at" and "not_active_at" options cannot be used at the same time. Remove one of them.');
                            }

                            $filteredCurrencyNames = [];

                            foreach (Currencies::getCurrencyCodes() as $code) {
                                $active = match (true) {
                                    null !== $activeAt => true,
                                    null !== $notActiveAt => false,
                                    default => null,
                                };

                                if (!Currencies::isValidInAnyCountry($code, $legalTender, $active, $activeAt ?? $notActiveAt)) {
                                    continue;
                                }

                                $filteredCurrencyNames[$code] = Currencies::getName($code, $choiceTranslationLocale);
                            }

                            return array_flip($filteredCurrencyNames);
                        },
                    ),
                    $choiceTranslationLocale
                );
            },
            'choice_translation_domain' => false,

Review comment (suggestion):
```suggestion
                                throw new InvalidOptionsException('The "active_at" and "not_active_at" options cannot be used together.');
```

Code after:
    {
        $resolver->setDefaults([
            'choice_loader' => function (Options $options) {
                if (!class_exists(Intl::class)) {
                    throw new LogicException(\sprintf('The "symfony/intl" component is required to use "%s". Try running "composer require symfony/intl".', static::class));
                }

                $choiceTranslationLocale = $options['choice_translation_locale'];
                $activeAt = $options['active_at'];
                $notActiveAt = $options['not_active_at'];
                $legalTender = $options['legal_tender'];

                if (null !== $activeAt && null !== $notActiveAt) {
                    throw new InvalidOptionsException('The "active_at" and "not_active_at" options cannot be used together.');
                }

                $legalTenderCacheKey = match ($legalTender) {
                    null => '',
                    true => '1',
                    false => '0',
                };

                return ChoiceList::loader(
                    $this,
                    new IntlCallbackChoiceLoader(
                        static function () use ($choiceTranslationLocale, $activeAt, $notActiveAt, $legalTender) {
                            if (null === $activeAt && null === $notActiveAt && null === $legalTender) {
                                return array_flip(Currencies::getNames($choiceTranslationLocale));
                            }

                            $filteredCurrencyNames = [];

                            $active = match (true) {
                                null !== $activeAt => true,
                                null !== $notActiveAt => false,
                                default => null,
                            };

                            foreach (Currencies::getCurrencyCodes() as $code) {
                                if (!Currencies::isValidInAnyCountry($code, $legalTender, $active, $activeAt ?? $notActiveAt)) {
                                    continue;
                                }

                                $filteredCurrencyNames[$code] = Currencies::getName($code, $choiceTranslationLocale);
                            }

                            return array_flip($filteredCurrencyNames);
                        },
                    ),
                    $choiceTranslationLocale.($activeAt ?? $notActiveAt)?->format('Y-m-d\TH:i:s').$legalTenderCacheKey,
                );