if (null ===
$translator) { $translator =
new class() implements TranslatorInterface, LocaleAwareInterface
{ use TranslatorTrait;
};
// Force the locale to be 'en' when no translator is provided rather than relying on the Intl default locale
// This avoids depending on Intl or the stub implementation being available. It also ensures that Symfony
// validation messages are pluralized properly even when the default locale gets changed because they are in
// English.
$translator->
setLocale('en'
);
} $contextFactory =
new ExecutionContextFactory($translator,
$this->translationDomain
);
return new RecursiveValidator($contextFactory,
$metadataFactory,
$validatorFactory,
$this->initializers
);
} private function createAnnotationReader(): Reader
{ if (!
class_exists(AnnotationReader::
class)) { throw new LogicException('Enabling annotation based constraint mapping requires the packages doctrine/annotations and symfony/cache to be installed.'
);
} if (class_exists(ArrayAdapter::
class)) {