diff --git a/src/Asset/EntrypointLookup.php b/src/Asset/EntrypointLookup.php index e2e98e95..13891abe 100644 --- a/src/Asset/EntrypointLookup.php +++ b/src/Asset/EntrypointLookup.php @@ -127,11 +127,11 @@ private function getEntriesData(): array $this->entriesData = json_decode(file_get_contents($this->entrypointJsonPath), true); if (null === $this->entriesData) { - throw new \InvalidArgumentException(sprintf('There was a problem JSON decoding the "%s" file', $this->entrypointJsonPath)); + throw new \InvalidArgumentException(sprintf('There was a problem JSON decoding the "%s" file.', $this->entrypointJsonPath)); } if (!isset($this->entriesData['entrypoints'])) { - throw new \InvalidArgumentException(sprintf('Could not find an "entrypoints" key in the "%s" file', $this->entrypointJsonPath)); + throw new \InvalidArgumentException(sprintf('Could not find an "entrypoints" key in the "%s" file.', $this->entrypointJsonPath)); } if ($this->cache) { diff --git a/src/EventListener/ResetAssetsEventListener.php b/src/EventListener/ResetAssetsEventListener.php index 7d126289..f24de05e 100644 --- a/src/EventListener/ResetAssetsEventListener.php +++ b/src/EventListener/ResetAssetsEventListener.php @@ -1,7 +1,5 @@ diff --git a/src/Twig/EntryFilesTwigExtension.php b/src/Twig/EntryFilesTwigExtension.php index 253704c0..439b217e 100644 --- a/src/Twig/EntryFilesTwigExtension.php +++ b/src/Twig/EntryFilesTwigExtension.php @@ -10,13 +10,14 @@ namespace Symfony\WebpackEncoreBundle\Twig; use Psr\Container\ContainerInterface; +use Symfony\Contracts\Service\ServiceSubscriberInterface; use Symfony\WebpackEncoreBundle\Asset\EntrypointLookup; use Symfony\WebpackEncoreBundle\Asset\EntrypointLookupInterface; use Symfony\WebpackEncoreBundle\Asset\TagRenderer; use Twig\Extension\AbstractExtension; use Twig\TwigFunction; -final class EntryFilesTwigExtension extends AbstractExtension +final class EntryFilesTwigExtension extends AbstractExtension implements ServiceSubscriberInterface { private $container; @@ -80,4 +81,12 @@ private function getTagRenderer(): TagRenderer { return $this->container->get('webpack_encore.tag_renderer'); } + + public static function getSubscribedServices(): array + { + return [ + 'webpack_encore.entrypoint_lookup_collection' => EntrypointLookupInterface::class, + 'webpack_encore.tag_renderer' => TagRenderer::class, + ]; + } }