Skip to content

Commit 2298e19

Browse files
committed
add kernel.reset
1 parent 15ac89c commit 2298e19

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/TwigComponent/src/ComponentFactory.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Psr\EventDispatcher\EventDispatcherInterface;
1515
use Symfony\Component\DependencyInjection\ServiceLocator;
1616
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
17+
use Symfony\Contracts\Service\ResetInterface;
1718
use Symfony\UX\TwigComponent\Attribute\AsTwigComponent;
1819
use Symfony\UX\TwigComponent\Event\PostMountEvent;
1920
use Symfony\UX\TwigComponent\Event\PreMountEvent;
@@ -23,7 +24,7 @@
2324
*
2425
* @internal
2526
*/
26-
final class ComponentFactory
27+
final class ComponentFactory implements ResetInterface
2728
{
2829
private static $mountMethods = [];
2930
private static $preMountMethods = [];
@@ -252,4 +253,11 @@ private function throwUnknownComponentException(string $name): void
252253

253254
throw new \InvalidArgumentException($message);
254255
}
256+
257+
public function reset(): void
258+
{
259+
self::$mountMethods = [];
260+
self::$preMountMethods = [];
261+
self::$postMountMethods = [];
262+
}
255263
}

src/TwigComponent/src/DependencyInjection/TwigComponentExtension.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ static function (ChildDefinition $definition, AsTwigComponent $attribute) {
9292
new Reference('event_dispatcher'),
9393
new AbstractArgument(\sprintf('Added in %s.', TwigComponentPass::class)),
9494
])
95+
->addTag('kernel.reset', ['method' => 'reset'])
9596
;
9697

9798
$container->register('ux.twig_component.component_stack', ComponentStack::class);

0 commit comments

Comments
 (0)