Issue #3614999: Add type hints to hook implementations and callbacks
Procedural code and closures carried no type information, so nothing verified what hooks received or what callbacks returned.
.module / .inc files:
- myrest_help(): string $route_name, ?string return, explicit NULL in the default branch instead of an implicit one.
- myrest_toolbar_alter(), myrest_mail_alter(): array &$...
- myrest_views_data(): array return.
- myrest_translatable_menu_link_uri_iterate_menu(): array &$item, void.
Closures and callbacks in src/ now declare parameter and return types: MyrestHelper (translation/raw-value helpers, achievements, messenger options, menu filter, facet uksort, stage totals), MyrestNormalizer, StaticDataGetResource, CtaOnlineConsultationAddResource, ReviewAddGetDataResource and ServicesListGetResource.
Also in scope, both found while adding the hints:
- Rename translatable_menu_link_uri_iterate_menu() to myrest_translatable_menu_link_uri_iterate_menu(). The copied function squatted another project's function namespace, so installing translatable_menu_link_uri alongside myrest was a fatal "cannot redeclare function". Callers in MyrestHelper updated.
- Catch \Throwable instead of Exception in that function and log to the myrest channel rather than an ad-hoc translatable_menu_link_uri one.
- Drop myrest_query_search_api_db_search_alter(): an empty hook implementation whose only content was a commented-out dump() block. Its AlterableInterface import went with it.
Co-Authored-By: Claude Opus 5 noreply@anthropic.com
Closes #3614999