Skip to content

Commit

Permalink
RuntimeExtension fix return type
Browse files Browse the repository at this point in the history
  • Loading branch information
Cavasin F committed Dec 12, 2023
1 parent 0cd3d5f commit 75f8c4a
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/Twig/RuntimeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@ final class RuntimeExtension implements RuntimeExtensionInterface
{
/**
* @param array<string, string|null> $routes
* @param array<string, string> $icons
* @param array<string, string> $icons
*/
public function __construct(private EventDispatcherInterface $eventDispatcher, private ContextHelper $helper, private array $routes, private array $icons)
{
public function __construct(
private EventDispatcherInterface $eventDispatcher,
private ContextHelper $helper,
private array $routes,
private array $icons
) {
}

public function getRouteByAlias(string $routeName): string
Expand Down Expand Up @@ -68,6 +72,7 @@ public function containerClass(string $class = ''): string

/**
* @param Request $request
*
* @return MenuItemInterface[]|null
*/
public function getMenu(Request $request): ?array
Expand All @@ -82,10 +87,10 @@ public function getMenu(Request $request): ?array
return $event->getItems();
}

public function getNotifications(): ?NotificationEvent
public function getNotifications(): NotificationEvent
{
if (!$this->eventDispatcher->hasListeners(NotificationEvent::class)) {
return new NotificationEvent();
return new NotificationEvent(false);
}

/** @var NotificationEvent $listEvent */
Expand Down

0 comments on commit 75f8c4a

Please sign in to comment.