final class ChoiceList{ /**
* Creates a cacheable loader from any callable providing iterable choices.
*
* @param callable $choices A callable that must return iterable choices or grouped choices
* @param mixed $vary Dynamic data used to compute a unique hash when caching the loader
*/
public static function lazy(FormTypeInterface|FormTypeExtensionInterface
$formType, callable
$choices, mixed
$vary = null
): ChoiceLoader
{ return self::
loader($formType,
new CallbackChoiceLoader($choices),
$vary);
} /**
* Decorates a loader to make it cacheable.
*
* @param ChoiceLoaderInterface $loader A loader responsible for creating loading choices or grouped choices
* @param mixed $vary Dynamic data used to compute a unique hash when caching the loader
*/
public static function loader(FormTypeInterface|FormTypeExtensionInterface
$formType, ChoiceLoaderInterface
$loader, mixed
$vary = null
): ChoiceLoader
{ return new ChoiceLoader($formType,
$loader,
$vary);
}