Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Asset/EntrypointLookupInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,6 @@ public function getCssFiles(string $entryName): array;
* Resets the state of this service.
*/
public function reset();

public function entryExists(string $entryName): bool;
}
9 changes: 2 additions & 7 deletions src/Twig/EntryFilesTwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
namespace Symfony\WebpackEncoreBundle\Twig;

use Psr\Container\ContainerInterface;
use Symfony\WebpackEncoreBundle\Asset\EntrypointLookup;
use Symfony\WebpackEncoreBundle\Asset\EntrypointLookupInterface;
use Symfony\WebpackEncoreBundle\Asset\TagRenderer;
use Twig\Extension\AbstractExtension;
Expand Down Expand Up @@ -62,12 +61,8 @@ public function renderWebpackLinkTags(string $entryName, string $packageName = n

public function entryExists(string $entryName, string $entrypointName = '_default'): bool
{
$entrypointLookup = $this->getEntrypointLookup($entrypointName);
if (!$entrypointLookup instanceof EntrypointLookup) {
throw new \LogicException(sprintf('Cannot use entryExists() unless the entrypoint lookup is an instance of "%s"', EntrypointLookup::class));
}

return $entrypointLookup->entryExists($entryName);
return $this->getEntrypointLookup($entrypointName)
->entryExists($entryName);
}

private function getEntrypointLookup(string $entrypointName): EntrypointLookupInterface
Expand Down