Implementation of hook_user_logout() should use AccountInterface instead of AccountProxy, in other case I get an error:

The website encountered an unexpected error. Please try again later.
TypeError: Argument 1 passed to discourse_sso_user_logout() must be an instance of Drupal\Core\Session\AccountProxy, instance of Drupal\Core\Session\UserSession given in discourse_sso_user_logout() (line 13 of modules/contrib/discourse_sso/discourse_sso.module).
discourse_sso_user_logout(Object)
call_user_func_array('discourse_sso_user_logout', Array) (Line: 403)
...

Comments

lebster created an issue. See original summary.

ugolek’s picture

ugolek’s picture

Assigned: Unassigned » ugolek
Status: Active » Needs review
jurgenhaas’s picture

Assigned: ugolek » jurgenhaas
Issue tags: +Drupal 9 porting weekend
jungle’s picture

Status: Needs review » Reviewed & tested by the community
/**
 * The user just logged out.
 *
 * @param \Drupal\Core\Session\AccountInterface $account
 *   The user object on which the operation was just performed.
 */
function hook_user_logout(AccountInterface $account) {

Per core/modules/user/user.api.php, the patch looks good to me, thanks @lebster!

jurgenhaas’s picture

Version: 8.x-1.0-beta2 » 2.0.x-dev
Status: Reviewed & tested by the community » Fixed

Thanks @lebster and @jungle, fix got committed as part of the rector cleanup already but providing credit here.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.