Problem/Motivation
The new D11 hooks autoregister every class in the Hooks namespace as a service.
This is nice for DX and OK for small projects.
For any medium to large object, it is bad for DX, as the hook classes should better be where related funcitonality is.
Proposed resolution
Autoregister every class namale *Hooks as a service.
Remaining tasks
Code, review, commit.
User interface changes
None.
Introduced terminology
None.
API changes
None.
No more BC issues that autoregistering the Hooks directory made.
Data model changes
None
Release notes snippet
*Hooks classes are autoregistered.
Comments
Comment #2
geek-merlinComment #3
quietone commentedComment #4
longwaveI am not sure more magic naming here is better, maybe it would be better to explicitly declare this in services.yml, which Symfony already supports but Drupal does not: #3021899: Support resource key in services.yml
Comment #5
nicxvan commentedI think this is a duplicate of #3481903: Support hooks (Hook attribute) in any registered service
Comment #6
nicxvan commentedI'm going to close this as a duplicate as the other issue will cover this use case.
Please feel free to comment if I am mistaken.