minor #37223 [FrameworkBundle] Move identity translator configuration to PHP (smmd)

This PR was merged into the 5.2-dev branch.

Discussion
----------

[FrameworkBundle] Move identity translator configuration to PHP

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | https://github.com/symfony/symfony/issues/37186
| License       | MIT

Move identity translator file to php

Commits
-------

335c9dba71 [FrameworkBundle] Move identity translator configuration to PHP
This commit is contained in:
Fabien Potencier 2020-06-11 18:39:46 +02:00
commit 4b22f97926
3 changed files with 26 additions and 15 deletions

View File

@ -213,7 +213,7 @@ class FrameworkExtension extends Extension
}
if (class_exists(Translator::class)) {
$loader->load('identity_translator.xml');
$phpLoader->load('identity_translator.php');
}
}

View File

@ -0,0 +1,25 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
use Symfony\Component\Translation\IdentityTranslator;
use Symfony\Contracts\Translation\TranslatorInterface;
return static function (ContainerConfigurator $container) {
$container->services()
->set('translator', IdentityTranslator::class)
->public()
->alias(TranslatorInterface::class, 'translator')
->set('identity_translator', IdentityTranslator::class)
;
};

View File

@ -1,14 +0,0 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<defaults public="false" />
<service id="translator" class="Symfony\Component\Translation\IdentityTranslator" public="true" />
<service id="Symfony\Contracts\Translation\TranslatorInterface" alias="translator" />
<service id="identity_translator" class="Symfony\Component\Translation\IdentityTranslator" />
</services>
</container>