Change the type of the request parameter in middleware handle functions to use app\Request instead of the plain $request. This update clarifies the expected request object type for better type checking and autocompletion support.