Menu Item Extras dies on RouteSubscriber error

Created on 14 August 2023, over 1 year ago
Updated 16 August 2023, over 1 year ago

Problem/Motivation

PHP Fatal error: Declaration of Drupal\\menu_item_extras\\Routing\\RouteSubscriber::getSubscribedEvents() must be compatible with Drupal\\Core\\Routing\\RouteSubscriberBase::getSubscribedEvents(): array

This is the error I am recieving on a Drupal 10.0.10 website. The fix seems to be to add the : array to the end of the getSubscribedEvents() function. The issue with adding it is that the function isnt in the source code. This function only shows up when the module is installed it seems. I am not sure where this code is being added/generated from.

See Routing code for the source.

Steps to reproduce

Add "drupal/menu_item_extras": "^3.0", to your composer.json file. Run drush updb -y or similar.

Should see the above error. This could also be a red herring to something else though.

Proposed resolution

Add the : array to the end of the getSubscribedEvents() function.

See similar error 🐛 Commerce shipping EventSubscriber\RouteSubscriber::getSubscribedEvents() is not compatible with Drupal 10 RouteSubscriberBase::getSubscribedEvents() Fixed as an example.

🐛 Bug report
Status

Closed: works as designed

Version

3.0

Component

Code

Created by

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Status changed to Closed: works as designed over 1 year ago
  • This can be closed. I figured out the problem. It was a patch adding the extra function. Sorry.

Production build 0.71.5 2024