Incorrect warning "Call to deprecated method getImplementations()"

Created on 25 September 2023, over 1 year ago
Updated 28 September 2023, over 1 year ago

Problem/Motivation

I just upgraded from version 1. to 2.0.1.

Upgrade Status report is reporting 2 issues for 2.0.1.

File name |Line |Error
modules/contrib/scheduler/scheduler.module | 1037 | Call to deprecated method getImplementations() of class Drupal\Core\Extension\ModuleHandlerInterface. Deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. Instead you should use ModuleHandlerInterface::invokeAllWith() for hook invocations or you should use ModuleHandlerInterface::hasImplementations() to determine if hooks implementations exist.

modules/contrib/scheduler/src/SchedulerManager.php | 747 | Call to deprecated method getImplementations() of class Drupal\Core\Extension\ModuleHandlerInterface. Deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. Instead you should use ModuleHandlerInterface::invokeAllWith() for hook invocations or you should use ModuleHandlerInterface::hasImplementations() to determine if hooks implementations exist.

Steps to reproduce

Proposed resolution

📌 Task
Status

Active

Version

2.0

Component

Code

Created by

🇺🇸United States chambers

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

Comments & Activities

  • Issue created by @chambers
  • 🇺🇸United States chambers

    I just realized both of these places has a version check and if it is an older drupal version to use the deprecated method. Its throwing an error but there should be no issues for Drupal 10.

  • Assigned to abhishek_virasat
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    227 pass
  • @abhishek_virasat opened merge request.
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India abhishek_virasat

    @chambers, I fixed this issue and created MR kindly review the changes

  • Status changed to Active over 1 year ago
  • 🇬🇧United Kingdom jonathan1055

    @abhishek_virasat Maybe you did not read comment #3 before you created the MR and you did not understand what was reported in this issue. There is no problem with trying to use getImplementations() because this is only done when the core version is earlier than 9.4. So there is nothing that needs changing here.

    @chambers I presume the warnings you posted in the issue summary were from a code scan like PHPstan or something similar? It would be useful if PHPstan had a way to make a code line as "OK this is not an error" so that we do not keep getting these warning. PHPCS has this functionality and it very useful.

    @steinmb Scheduler still maintains support for sites back to Core 8.8.3 currently, to help them during upgrade to 9.x and 10.x See the system requirement in scheduler.info.yml When that becomes too difficult or tedious or time-comsuming then Scheduler 2.0 will drop early core version support.

Production build 0.71.5 2024