8000 initialize the default MimeTypes instance in its constructor · symfony/symfony@a6a5fab · GitHub
[go: up one dir, main page]

Skip to content

Commit a6a5fab

Browse files
committed
initialize the default MimeTypes instance in its constructor
1 parent 1aa652e commit a6a5fab

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,6 @@ public function boot()
7373
if ($trustedHosts = $this->container->getParameter('kernel.trusted_hosts')) {
7474
Request::setTrustedHosts($trustedHosts);
7575
}
76-
77-
if ($this->container->has('mime_types')) {
78-
$mt = $this->container->get('mime_types');
79-
$mt->setDefault($mt);
80-
}
8176
}
8277

8378
public function build(ContainerBuilder $container)

src/Symfony/Component/Mime/MimeTypes.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ public function __construct(array $map = [])
4545
}
4646
$this->registerGuesser(new FileBinaryMimeTypeGuesser());
4747
$this->registerGuesser(new FileinfoMimeTypeGuesser());
48+
49+
if (null === self::$default) {
50+
self::$default = $this;
51+
}
4852
}
4953

5054
public static function setDefault(self $default)
@@ -54,7 +58,7 @@ public static function setDefault(self $default)
5458

5559
public static function getDefault(): self
5660
{
57-
return self::$default ?? self::$default = new self();
61+
return self::$default;
5862
}
5963

6064
/**

0 commit comments

Comments
 (0)
0