Drupal 10 getSubscribedEvents() compatibility

Created on 17 February 2023, almost 2 years ago

Problem/Motivation

Fatal error: Declaration of Drupal\tvi\EventSubscriber\RouteSubscriber::getSubscribedEvents() must be compatible with Drupal\Core\Routing\RouteSubscriberBase::getSubscribedEvents(): array in [SITE]/web/modules/contrib/tvi/src/EventSubscriber/RouteSubscriber.php on line 34

Steps to reproduce

Install on Drupal 10

Proposed resolution

Set return value of RouteSubscriber::getSubscribedEvents()

  /**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents(): array {
    // Run after Views subscriber has ran.
    $events[RoutingEvents::ALTER] = ['onAlterRoutes', -200];
    return $events;
  }
🐛 Bug report
Status

Closed: works as designed

Version

2.0

Component

Code

Created by

🇬🇧United Kingdom mattjones86 🇬🇧 GMT+0

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024