feat: make mainScript nullable

This commit is contained in:
Younes ENNAJI
2025-01-17 10:28:13 +01:00
parent db485d1ff2
commit c9d3b56346
@@ -27,14 +27,16 @@ final readonly class ResourceManager implements ResourceManagerInterface
public function __construct( public function __construct(
private TemplateEngineInterface $templateEngine, private TemplateEngineInterface $templateEngine,
private AssetManagerInterface $assetManager, private AssetManagerInterface $assetManager,
private string $mainScript, private ?string $mainScript = null,
private array $resources, private array $resources = [],
) { ) {
} }
public function populateResponse(Response $response): Response public function populateResponse(Response $response): Response
{ {
$response->setMainScript($this->assetManager->getPath($this->mainScript)); if (null !== $this->mainScript) {
$response->setMainScript($this->assetManager->getPath($this->mainScript));
}
$plugins = []; $plugins = [];
foreach ($response->getEnvelopes() as $envelope) { foreach ($response->getEnvelopes() as $envelope) {