Skip to content

Commit 71ae4ba

Browse files
committed
Tweaks after feedback
1 parent 0ef6264 commit 71ae4ba

File tree

3 files changed

+5
-13
lines changed

3 files changed

+5
-13
lines changed

src/Asset/TagRenderer.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ class TagRenderer implements ResetInterface
2525
private $defaultAttributes;
2626
private $defaultScriptAttributes;
2727
private $defaultLinkAttributes;
28-
/**
29-
* @var EventDispatcherInterface|null
30-
*/
3128
private $eventDispatcher;
3229

3330
private $renderedFiles = [];
@@ -37,7 +34,8 @@ public function __construct(
3734
Packages $packages,
3835
array $defaultAttributes = [],
3936
array $defaultScriptAttributes = [],
40-
array $defaultLinkAttributes = []
37+
array $defaultLinkAttributes = [],
38+
EventDispatcherInterface $eventDispatcher = null
4139
) {
4240
if ($entrypointLookupCollection instanceof EntrypointLookupInterface) {
4341
@trigger_error(sprintf('The "$entrypointLookupCollection" argument in method "%s()" must be an instance of EntrypointLookupCollection.', __METHOD__), E_USER_DEPRECATED);
@@ -57,15 +55,11 @@ public function __construct(
5755
$this->defaultAttributes = $defaultAttributes;
5856
$this->defaultScriptAttributes = $defaultScriptAttributes;
5957
$this->defaultLinkAttributes = $defaultLinkAttributes;
58+
$this->eventDispatcher = $eventDispatcher;
6059

6160
$this->reset();
6261
}
6362

64-
public function setEventDispatcher(EventDispatcherInterface $eventDispatcher)
65-
{
66-
$this->eventDispatcher = $eventDispatcher;
67-
}
68-
6963
public function renderWebpackScriptTags(string $entryName, string $packageName = null, string $entrypointName = null, array $extraAttributes = []): string
7064
{
7165
$entrypointName = $entrypointName ?: '_default';

src/Event/RenderAssetTagEvent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
/**
1313
* Dispatched each time a script or link tag is rendered.
1414
*/
15-
class RenderAssetTagEvent
15+
final class RenderAssetTagEvent
1616
{
1717
public const TYPE_SCRIPT = 'script';
1818
public const TYPE_LINK = 'link';

src/Resources/config/services.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@
2020
<argument type="collection"/> <!-- Default attributes-->
2121
<argument type="collection"/> <!-- Default script attributes -->
2222
<argument type="collection"/> <!-- Default link attributes -->
23-
<call method="setEventDispatcher">
24-
<argument type="service" id="event_dispatcher" />
25-
</call>
23+
<argument type="service" id="event_dispatcher" />
2624
</service>
2725

2826
<service id="webpack_encore.twig_entry_files_extension" class="Symfony\WebpackEncoreBundle\Twig\EntryFilesTwigExtension">

0 commit comments

Comments
 (0)