I think it's a good idea. I've been using type hints in my hook implementations, even if the hook itself doesn't specify types. I'm trying to use stricter coding standards.
- Status changed to Closed: duplicate
about 2 months ago 1:41pm 22 January 2025 - πΊπΈUnited States nicxvan
This is a duplicate as noted in the other issue.
- π¦πΊAustralia mstrelan
Re-opening and moving to a child of π [META] Add return types to hook implementations Active because there are a lot of hook definitions (in .api.php files) that were not updated in some of the wildcard issues, like all info hooks. I think we can use this to identify and fix any leftovers.
- π¦πΊAustralia mstrelan
Postponing on π Add void return to @ingroup entity_crud hook implementations Active and π Add return type to remaining hook implementations Active . Added steps to reproduce. Added a draft MR with all the alter hooks updated.
- π¦πΊAustralia mstrelan
No longer postponed. Just realised that the IS is talking about both params and return types. I think initially we should limit this to return types and split off params to another ticket.
- π¦πΊAustralia mstrelan
$ grep -rn --include="*.api.php" -E 'function hook_.*\(.*\) \{' core core/lib/Drupal/Core/Extension/module.api.php:782:function hook_update_N(&$sandbox) { core/lib/Drupal/Core/Extension/module.api.php:784: // function hook_update_N() { core/lib/Drupal/Core/Extension/module.api.php:892:function hook_post_update_NAME(&$sandbox) { core/lib/Drupal/Core/Extension/module.api.php:1303:function hook_update_requirements() { core/modules/shortcut/shortcut.api.php:40:function hook_shortcut_default_set(AccountInterface $account) { core/modules/jsonapi/jsonapi.api.php:276:function hook_jsonapi_entity_filter_access(EntityTypeInterface $entity_type, AccountInterface $account) { core/modules/field/field.api.php:394:function hook_field_info_max_weight($entity_type, $bundle, $context, $context_mode) {
- First commit to issue fork.