Restrict new hook attributes to use on methods, drop $method parameter

Created on 7 May 2025, 5 days ago

Problem/Motivation

The #[Hook] attribute can be used on classes and methods.
When used on class level, it can either specify a method name, or it will apply to the __invoke() method.

There is hardly ever a technical reason why one would use the attribute on a class, instead of a method.
The only reason people would do this is personal taste.

As such, this provides an unnecessary alternative to achieve the same thing.
The cost is added complexity in the Hook class, where we now have to explain the different cases.

Steps to reproduce

Proposed resolution

We cannot remove this functionality from the existing #[Hook] class.
But we can remove it from any new attributes that extend Hook, which are not in any stable release yet.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

Active

Version

11.0 πŸ”₯

Component

base system

Created by

πŸ‡©πŸ‡ͺGermany donquixote

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024