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

Code before:
                // When the `active` and `legal_tender` options are null, it is unnecessary no need to retrieve the currencies from the meta indice.
                if (null !== ($active = $options['active']) && null !== ($legalTender = $options['legal_tender'])) {
                    $filteredCurrencyNames = [];

                    foreach (Currencies::getCurrencyCodes() as $code) {
                        if (!Currencies::isValidInAnyCountry($code, $legalTender, $active, $options['date'])) {
                            continue;
                        }

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

                    return ChoiceList::loader(
                        $this,
                        new IntlCallbackChoiceLoader(static fn () => array_flip($filteredCurrencyNames)),
                        $choiceTranslationLocale
                    );
                }

                return ChoiceList::loader($this, new IntlCallbackChoiceLoader(static fn () => array_flip(Currencies::getNames($choiceTranslationLocale))), $choiceTranslationLocale);
            },
            'choice_translation_domain' => false,
            'choice_translation_locale' => null,
            'active' => null,
            'legal_tender' => null,
            'date' => new \DateTimeImmutable('today', new \DateTimeZone('Etc/UTC')),
            'invalid_message' => 'Please select a valid currency.',
        ]);

        $resolver->setAllowedTypes('choice_translation_locale', ['null', 'string']);
        $resolver->setAllowedTypes('active', ['bool', 'null']);
        $resolver->setAllowedTypes('legal_tender', ['bool', 'null']);
        $resolver->setAllowedTypes('date', [\DateTimeInterface::class]);
    }

    public function getParent(): ?string
    {
        return ChoiceType::class;
    }

    public function getBlockPrefix(): string
    {
        return 'currency';
    }
}


Review comment (suggestion):
I'd go with filtering by default - there's no BC to preserve IMHO (but let's add a mention in the upgrade and changelog files):
```suggestion
            'valid_at' => new \DateTimeImmutable(),
            'legal_tender' => true,
```

Code after:
                $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,
                );
            },
            'choice_translation_domain' => false,
            'choice_translation_locale' => null,
            'active_at' => new \DateTimeImmutable('today', new \DateTimeZone('Etc/UTC')),
            'not_active_at' => null,
            'legal_tender' => true,
            'invalid_message' => 'Please select a valid currency.',
        ]);