-
-
Notifications
You must be signed in to change notification settings - Fork 84
Description
Feature request
Hooks are not typed and we have no way of knowing what hooks are available in the system, since hooks are not defined and only arbitrarily invoked.
We can't just scan *.api.php files as we tried this and it randomly broke on contrib code. In fact in DeprecatedHookImplementation we hardcode two specific hooks.
I think the solution is to build specific rules for known hooks. Maybe it can be made scalable, but I'd like to start with a rule per-hook until we find repeatable patterns.
Initial idea
Rules\Hooks\FormAlterRule (OOP, target class method nodes) and Rules\Hooks\ProceduralFormAlterRule (function, target function definition
Find things matching hook_form_alter and friends by base ID, etc. Verify the arguments and order of array, FormStateInterface, string. Not all are required to exist.