Problem/Motivation

I got this error for the Drupal 10 and php 8.1

NOTICE: PHP message: Uncaught PHP Exception Error: "Call to undefined method Drupal\Core\Extension\ModuleHandler::getImplementations()" at /var/www/html/web/modules/contrib/hook_event_dispatcher/src/HookEventDispatcherModuleHandlerProxyTrait.php line 114

CR: https://www.drupal.org/node/3000490

Proposed resolution

We should remove the method getImplementations() from HookEventDispatcherModuleHandlerProxyTrait.php

 /**
   * {@inheritdoc}
   */
  public function getImplementations($hook) {
    return $this->inner->getImplementations($hook);
  }
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

rishabjasrotia created an issue. See original summary.

rishabjasrotia’s picture

Issue summary: View changes

rishabjasrotia’s picture

Issue summary: View changes
rishabjasrotia’s picture

StatusFileSize
new889 bytes
rishabjasrotia’s picture

Status: Active » Needs review
rishabjasrotia’s picture

Assigned: rishabjasrotia » Unassigned
dineshkumarbollu’s picture

Hi
Removing code results functionality changes getImplementations() now is replacing with invokeAllWith()can you check once.

rishabjasrotia’s picture

Hello @dineshkumarbollu,

The invokeAllWith() method is already defined in HookEventDispatcherModuleHandlerProxyTrait.php
The old Drupal 9 method was defined which causes the fata error. Removal of Deprecated code is the possible solution.

The 4.x branch is strictly for Drupal 10.

el7cosmos’s picture

Status: Needs review » Needs work

Thanks @rishab, there is one PHPCS error (https://git.drupalcode.org/project/hook_event_dispatcher/-/pipelines/157...), can you fix that?

akshay.singh made their first commit to this issue’s fork.

akshay.singh’s picture

Status: Needs work » Needs review

@el7cosmos,

Please review

Thanks

rishabjasrotia’s picture

StatusFileSize
new1.58 KB

Hello @el7cosmos,
It is handled by @akshay.singh

el7cosmos’s picture

Issue summary: View changes
Status: Needs review » Needs work

According to https://www.drupal.org/node/3000490, we should also remove implementsHook() method.

rishabjasrotia’s picture

Hello @el7cosmos,
Please Review.

rishabjasrotia’s picture

Status: Needs work » Needs review
StatusFileSize
new2.44 KB

el7cosmos’s picture

Status: Needs review » Fixed

Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

broon’s picture

I am not sure if I am missing something, but when using the patch from #16 or using the current dev version, I'll got the following error:

Fatal error: Class Drupal\hook_event_dispatcher\HookEventDispatcherModuleHandler contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (Drupal\Core\Extension\ModuleHandlerInterface::getImplementations, Drupal\Core\Extension\ModuleHandlerInterface::implementsHook) in web/modules/contrib/hook_event_dispatcher/src/HookEventDispatcherModuleHandler.php on line 15

broon’s picture

Scrap that, working as designed. Due to an unmet dependency, my dev system was not updated to 10.0.10 as intended but rather to 10.0.0-alpha4.