diff --git a/src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php b/src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php index 6d39e9440f02a..13e155235358b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php +++ b/src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php @@ -14,7 +14,6 @@ use Psr\Container\ContainerInterface; use Psr\Link\EvolvableLinkInterface; use Psr\Link\LinkInterface; -use Symfony\Component\AssetMapper\ImportMap\ImportMapManager; use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; use Symfony\Component\DependencyInjection\ParameterBag\ContainerBagInterface; use Symfony\Component\Form\Extension\Core\Type\FormType; @@ -97,7 +96,6 @@ public static function getSubscribedServices(): array 'security.csrf.token_manager' => '?'.CsrfTokenManagerInterface::class, 'parameter_bag' => '?'.ContainerBagInterface::class, 'web_link.http_header_serializer' => '?'.HttpHeaderSerializer::class, - 'asset_mapper.importmap.manager' => '?'.ImportMapManager::class, ]; } @@ -412,7 +410,7 @@ protected function addLink(Request $request, LinkInterface $link): void /** * @param LinkInterface[] $links */ - protected function sendEarlyHints(iterable $links = [], Response $response = null, bool $preloadJavaScriptModules = false): Response + protected function sendEarlyHints(iterable $links = [], Response $response = null): Response { if (!$this->container->has('web_link.http_header_serializer')) { throw new \LogicException('You cannot use the "sendEarlyHints" method if the WebLink component is not available. Try running "composer require symfony/web-link".'); @@ -421,17 +419,6 @@ protected function sendEarlyHints(iterable $links = [], Response $response = nul $response ??= new Response(); $populatedLinks = []; - - if ($preloadJavaScriptModules) { - if (!$this->container->has('asset_mapper.importmap.manager')) { - throw new \LogicException('You cannot use the JavaScript modules method if the AssetMapper component is not available. Try running "composer require symfony/asset-mapper".'); - } - - foreach ($this->container->get('asset_mapper.importmap.manager')->getModulesToPreload() as $url) { - $populatedLinks[] = new Link('modulepreload', $url); - } - } - foreach ($links as $link) { if ($link instanceof EvolvableLinkInterface && !$link->getRels()) { $link = $link->withRel('preload'); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/AbstractControllerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/AbstractControllerTest.php index 960735e884958..efa9c7becab59 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/AbstractControllerTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/AbstractControllerTest.php @@ -74,7 +74,6 @@ public function testSubscribedServices() 'security.token_storage' => '?Symfony\\Component\\Security\\Core\\Authentication\\Token\\Storage\\TokenStorageInterface', 'security.csrf.token_manager' => '?Symfony\\Component\\Security\\Csrf\\CsrfTokenManagerInterface', 'web_link.http_header_serializer' => '?Symfony\\Component\\WebLink\\HttpHeaderSerializer', - 'asset_mapper.importmap.manager' => '?Symfony\\Component\\AssetMapper\\ImportMap\\ImportMapManager', ]; $this->assertEquals($expectedServices, $subscribed, 'Subscribed core services in AbstractController have changed');