minor #30001 [FrameworkBundle] consolidate the mime types service definition (xabbuh)

This PR was merged into the 4.3-dev branch.

Discussion
----------

[FrameworkBundle] consolidate the mime types service definition

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

I wonder if we couldn't simplify things by just initializing the default `MimeTypes` instance once the first one is going to be created.

Commits
-------

ce546f5e5b consolidate the mime types service definition
This commit is contained in:
Fabien Potencier 2019-02-12 08:31:46 +01:00
commit b9b8f9da98
2 changed files with 5 additions and 6 deletions

View File

@ -73,11 +73,6 @@ class FrameworkBundle extends Bundle
if ($trustedHosts = $this->container->getParameter('kernel.trusted_hosts')) {
Request::setTrustedHosts($trustedHosts);
}
if ($this->container->has('mime_types')) {
$mt = $this->container->get('mime_types');
$mt->setDefault($mt);
}
}
public function build(ContainerBuilder $container)

View File

@ -7,6 +7,10 @@
<services>
<defaults public="false" />
<service id="mime_types" class="Symfony\Component\Mime\MimeTypes" public="true" />
<service id="mime_types" class="Symfony\Component\Mime\MimeTypes">
<call method="setDefault">
<argument type="service" id="mime_types" />
</call>
</service>
</services>
</container>