Commit 1aed8cdf authored by Matthew Turland's avatar Matthew Turland

Minor optimization in ValidatorServiceProvider

ReflectionClass is only needed if a translator is present. Moving usage of it inside the related conditional means one less object instantiation.
parent 4f813476
......@@ -29,9 +29,8 @@ class ValidatorServiceProvider implements ServiceProviderInterface
public function register(Application $app)
{
$app['validator'] = $app->share(function ($app) {
$r = new \ReflectionClass('Symfony\Component\Validator\Validator');
if (isset($app['translator'])) {
$r = new \ReflectionClass('Symfony\Component\Validator\Validator');
$app['translator']->addResource('xliff', dirname($r->getFilename()).'/Resources/translations/validators.'.$app['locale'].'.xlf', $app['locale'], 'validators');
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment