Needs work
Project:
Smart Date
Version:
4.2.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
13 Nov 2025 at 18:50 UTC
Updated:
25 Nov 2025 at 06:00 UTC
Jump to comment: Most recent
Saw this deprecation notice while working on my module. Cheers!
1) /app/web/core/lib/Drupal/Core/Hook/HookCollectorPass.php:513
smart_date_module_implements_alter without a #[LegacyModuleImplementsAlter] attribute is deprecated in drupal:11.2.0 and removed in drupal:12.0.0. See https://www.drupal.org/node/3496788
Triggered by:
* Drupal\Tests\date_ap_style\Functional\DateRangeFormatterTest::testDateRangeFormatterWithToSeparator (2 times)
/usr/local/date_ap_style/tests/src/Functional/DateRangeFormatterTest.php:165
Run phpunit tests locally with deprecations turned on.
Follow steps on https://www.drupal.org/node/3496788
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:
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
Comment #2
trackleft2Comment #3
trackleft2Comment #4
ritarshi_chakraborty commentedWorking on it.
Comment #6
ritarshi_chakraborty commentedThe
Drupal\Core\Hook\Attribute\LegacyModuleImplementsAlterattribute class does exist but it seems like PHPStan does not scan or autoload it automatically.Comment #7
trackleft2Thanks for taking this on, please add a note to remove the entire function once the minimum supported version of Drupal for the module is 11.2 or greater and link to the change record as well. https://www.drupal.org/node/3496788
Additionally, according to the instructions in the linked change record, step 1 is "Achieve the same functionality as your hook_module_implements_alter. Dynamic ordering is currently not supported."
The current state of the merge request seems to only address step #2
"Add the #[LegacyModuleImplementsAlter] to your implementation of hook_module_implements_alter. Once the minimum supported version of Drupal for the module is 11.2 or larger you may delete the entire function and attribute."
In my opinion we should change the scope of this issue to "Modernize Smart Date’s hooks to use Drupal 11’s attribute-based system" otherwise, the changes in the merge request are solely there to hide deprecation notices, which is probably not what we want.
If you agree please update the issue title to "Modernize Smart Date’s hooks to use Drupal 11’s attribute-based system"
See https://www.md-systems.ch/de/blog/2025-10-19/converting-legacy-hooks
See https://git.drupalcode.org/project/smart_date/-/blob/4.2.x/smart_date.to...
See https://git.drupalcode.org/project/smart_date/-/blob/4.2.x/smart_date.vi...
I believe this would involve adding the
LegacyHookattribute to existing hooks, and creating new OOP Hook implementations for each existing hook.Possible example
Alternatively we can create a new issue to modernize and block this one with that one.
Comment #8
ritarshi_chakraborty commentedHey @trackleft2, do you want me to make the changes here or on a new issue ticket?