Problem/Motivation

When a deprecated hook is altered using a hook attribute instead of a procedural hook the method is not stored for the deprecation.

Steps to reproduce

Convert the test module deprecation_test to OOP hooks and core/tests/Drupal/KernelTests/Core/Extension/ModuleHandlerDeprecatedHookTest.php will fail.

Proposed resolution

Handle both alter deprecations for both OOP and procedural hooks.
Update the message to refer to only the location so it works for both procedural and OOP.

Remaining tasks

Also should we add a message if the alter test is failing that the deprecation procedural hook should not be converted until it's the last one?
Is the module implementing the hook enough for the deprecation message?

User interface changes

N/A

Introduced terminology

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

N/A

Issue fork drupal-3482618

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

nicxvan created an issue. See original summary.

nicxvan’s picture

Issue summary: View changes
Status: Active » Needs review

Ok this test should be passing, it likely needs some cleanup, but it's getting really late and I'd like a review on direction.

I'm not sure if major is correct, please downgrade if not.

nicxvan’s picture

nicxvan’s picture

Issue summary: View changes
godotislate’s picture

Status: Needs review » Needs work

Nits: I think the convention is document as {class name}::{method name} instead of {class name}->{method name}.

nicxvan’s picture

Status: Needs work » Needs review

Great catch thanks! I've updated it.

godotislate’s picture

Status: Needs review » Reviewed & tested by the community

lgtm

  • catch committed 9c75e92a on 11.1.x
    Issue #3482618 by nicxvan, godotislate: ModuleHandler->alterDeprecated...

  • catch committed 1afb8711 on 11.x
    Issue #3482618 by nicxvan, godotislate: ModuleHandler->alterDeprecated...
catch’s picture

Version: 11.x-dev » 11.1.x-dev
Status: Reviewed & tested by the community » Fixed

This looks good to me, couldn't find anything to complain about.

Committed/pushed to 11.x and cherry-picked to 11.1.x, thanks!

Status: Fixed » Closed (fixed)

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