diff --git a/core/core.services.yml b/core/core.services.yml index 1bceb3c..345a54e 100644 --- a/core/core.services.yml +++ b/core/core.services.yml @@ -1558,7 +1558,6 @@ services: class: Drupal\Core\File\MimeType\MimeTypeMapper calls: - [alterMapping, ['@module_handler']] - lazy: true file.mime_type.guesser: class: Drupal\Core\File\MimeType\MimeTypeGuesser arguments: ['@stream_wrapper_manager'] diff --git a/core/lib/Drupal/Core/File/MimeType/MimeTypeMapperInterface.php b/core/lib/Drupal/Core/File/MimeType/MimeTypeMapperInterface.php index 0c9d097..1e8578a 100644 --- a/core/lib/Drupal/Core/File/MimeType/MimeTypeMapperInterface.php +++ b/core/lib/Drupal/Core/File/MimeType/MimeTypeMapperInterface.php @@ -39,7 +39,7 @@ public function alterMapping(ModuleHandlerInterface $module_handler); * * @return $this */ - public function setMapping($mimetype, $extension); + public function setMapping(array $mapping); /** * Adds a mapping between a MIME type and an extension. diff --git a/core/lib/Drupal/Core/ProxyClass/File/MimeType/MimeTypeMapper.php b/core/lib/Drupal/Core/ProxyClass/File/MimeType/MimeTypeMapper.php deleted file mode 100644 index 7066840..0000000 --- a/core/lib/Drupal/Core/ProxyClass/File/MimeType/MimeTypeMapper.php +++ /dev/null @@ -1,136 +0,0 @@ -container = $container; - $this->drupalProxyOriginalServiceId = $drupal_proxy_original_service_id; - } - - /** - * Lazy loads the real service from the container. - * - * @return object - * Returns the constructed real service. - */ - protected function lazyLoadItself() - { - if (!isset($this->service)) { - $this->service = $this->container->get($this->drupalProxyOriginalServiceId); - } - - return $this->service; - } - - /** - * {@inheritdoc} - */ - public function alterMapping(\Drupal\Core\Extension\ModuleHandlerInterface $module_handler) - { - return $this->lazyLoadItself()->alterMapping($module_handler); - } - - /** - * {@inheritdoc} - */ - public function setMapping(array $mapping) - { - return $this->lazyLoadItself()->setMapping($mapping); - } - - /** - * {@inheritdoc} - */ - public function addMapping($mimetype, $extension) - { - return $this->lazyLoadItself()->addMapping($mimetype, $extension); - } - - /** - * {@inheritdoc} - */ - public function removeMapping($extension) - { - return $this->lazyLoadItself()->removeMapping($extension); - } - - /** - * {@inheritdoc} - */ - public function removeMimeType($mimetype) - { - return $this->lazyLoadItself()->removeMimeType($mimetype); - } - - /** - * {@inheritdoc} - */ - public function getMimeTypes() - { - return $this->lazyLoadItself()->getMimeTypes(); - } - - /** - * {@inheritdoc} - */ - public function getMimeTypeForExtension($extension) - { - return $this->lazyLoadItself()->getMimeTypeForExtension($extension); - } - - /** - * {@inheritdoc} - */ - public function getExtensionsForMimeType($mimetype) - { - return $this->lazyLoadItself()->getExtensionsForMimeType($mimetype); - } - - } - -} diff --git a/core/tests/Drupal/KernelTests/Core/File/MimeTypeTest.php b/core/tests/Drupal/KernelTests/Core/File/MimeTypeTest.php index f507aed..9979d9c 100644 --- a/core/tests/Drupal/KernelTests/Core/File/MimeTypeTest.php +++ b/core/tests/Drupal/KernelTests/Core/File/MimeTypeTest.php @@ -89,6 +89,7 @@ public function testFileMimeTypeDetection() { // Now test that MIME types added via alter hook or directly via // MimeTypeMapper::addMapping are present in the list returned by // MimeTypeMapper::getMimeTypes. + $mime_type_mapper = $this->container->get('file.mime_type.mapper'); $test_case = [ 'bar/foo' => ['jar'], 'fox/trot' => ['jpg'],