User login

hook_help

Argument 2 passed to hook help() must be an instance of RouteMatchInterface

I got this error message, that argument two passed to my module's implementation of hook_help() "must be an instance of RouteMatchInterface, instance of Drupal\Core\Routing\CurrentRouteMatch given", and it's a misleading one.

CurrentRouteMatch in fact (unsurprisingly) implements the RouteMatchInterface. The problem was i hadn't actually defined CurrentRouteMatch— i needed to have a use statement at the top of my module (or use the full PSR4 path in the parameter definition of the hook implementation, but i went with the former). Like so:

Syndicate content