Skip to content

Commit 15337d7

Browse files
committed
refactor config checks
1 parent 06b6c07 commit 15337d7

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/LiveComponent/src/EventListener/AddLiveAttributesSubscriber.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function __construct(private ContainerInterface $container)
2020

2121
public function onPreRender(PreRenderEvent $event): void
2222
{
23-
if (!isset($event->config['live'])) {
23+
if (!($event->config['live'] ?? false)) {
2424
// not a live component, skip
2525
return;
2626
}

src/LiveComponent/src/EventListener/LiveComponentSubscriber.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function onKernelRequest(RequestEvent $event): void
7878
throw new NotFoundHttpException(sprintf('Component "%s" not found.', $componentName), $e);
7979
}
8080

81-
if (!isset($config['live'])) {
81+
if (!($config['live'] ?? false)) {
8282
throw new NotFoundHttpException(sprintf('"%s" is not a Live Component.', $config['class']));
8383
}
8484

src/LiveComponent/src/Twig/LiveComponentRuntime.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function getComponentUrl(object $component, string $name = null): string
5353

5454
public function getLiveAttributes(object $component, array $config): ComponentAttributes
5555
{
56-
if (!isset($config['live'])) {
56+
if (!($config['live'] ?? false)) {
5757
throw new \LogicException(sprintf('"%s" is not a Live Component.', $config['class']));
5858
}
5959

0 commit comments

Comments
 (0)