Problem/Motivation

  • one_time_password.module still contains four procedural hook implementations, each tagged #[LegacyHook] and forwarding to an equivalent method already implemented in src/Hook/OneTimePasswordHooks.php.
  • #[LegacyHook] only exists to support Drupal core versions older than 11.1.0, where attribute-based hooks aren't available.
  • The module's core_version_requirement is ^11.3 || ^12, so no supported version of core will ever execute these procedural fallbacks, making them dead code.
  • Separately, one_time_password.install implements hook_requirements() procedurally, but only ever returns data for the runtime phase.

Steps to reproduce

Proposed resolution

  • The one_time_password.module file will be deleted, since it will contain no remaining logic once the legacy stubs are removed.
  • hook_requirements() will be replaced with an OOP #[Hook('runtime_requirements')] implementation on OneTimePasswordHooks, dropping the now-unnecessary $phase check.
  • hook_install() will remain procedural in one_time_password.install, as Drupal core does not support class-based/attribute implementations of install-time hooks.
  • The kernel test covering requirements will be updated to invoke the hook via \Drupal::moduleHandler()->invoke() instead of calling the removed procedural function directly.

Remaining tasks

User interface changes

API changes

Data model changes

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

kim.pepper created an issue. See original summary.

  • kim.pepper committed 3674b66a on 2.x
    task: #3614187 Convert remaining procedural hooks to OOP hooks
    
    By: kim....
kim.pepper’s picture

Status: Active » Fixed

Committed to 2.x

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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