diff --git a/core/modules/user/src/Controller/UserController.php b/core/modules/user/src/Controller/UserController.php index 95f0ff4..5611d2f 100644 --- a/core/modules/user/src/Controller/UserController.php +++ b/core/modules/user/src/Controller/UserController.php @@ -164,9 +164,8 @@ public function logout() { } /** - * Menu callback; Cancel a user account via email confirmation link. - * - * @todo Remove user_cancel_confirm(). + * @todo Refactor user_cancel_confirm() to be encapsulated in this method. + * @see https://www.drupal.org/node/2403729 */ public function confirmCancel(UserInterface $user, $timestamp = 0, $hashed_pass = '') { module_load_include('pages.inc', 'user'); diff --git a/core/modules/user/user.module b/core/modules/user/user.module index 4026dc4..80854ad 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -13,7 +13,7 @@ use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Session\AccountInterface; use Drupal\Core\Session\AnonymousUserSession; -use \Drupal\Core\Entity\Display\EntityViewDisplayInterface; +use Drupal\Core\Entity\Display\EntityViewDisplayInterface; use Drupal\Core\Url; use Drupal\Core\Site\Settings; use Drupal\file\Entity\File; @@ -466,7 +466,7 @@ function user_preprocess_block(&$variables) { /** * Format a username. * - * @param \Drupal\Core\Session\Interface $account + * @param \Drupal\Core\Session\AccountInterface $account * The account object for the user whose name is to be formatted. * * @return string @@ -516,7 +516,7 @@ function user_template_preprocess_default_variables_alter(&$variables) { * * @param array $variables * An associative array containing: - * - account: The user account (Drupal\user\Plugin\Core\Entity\User). + * - account: The user account (Drupal\Core\Session\AccountInterface). */ function template_preprocess_username(&$variables) { $account = $variables['account'] ?: new AnonymousUserSession(); @@ -623,7 +623,7 @@ function user_login_finalize(UserInterface $account) { /** * Implements hook_user_login(). */ -function user_user_login($account) { +function user_user_login(AccountInterface $account) { // Reset static cache of default variables in template_preprocess() to reflect // the new user. drupal_static_reset('template_preprocess'); @@ -632,7 +632,7 @@ function user_user_login($account) { /** * Implements hook_user_logout(). */ -function user_user_logout($account) { +function user_user_logout(AccountInterface $account) { // Reset static cache of default variables in template_preprocess() to reflect // the new user. drupal_static_reset('template_preprocess'); @@ -641,7 +641,7 @@ function user_user_logout($account) { /** * Generates a unique URL for a user to login and reset their password. * - * @param object $account + * @param Drupal\user\UserInterface $account * An object containing the user account, which must contain at least the * following properties: * - uid: The user ID number. @@ -655,7 +655,7 @@ function user_user_logout($account) { * A unique URL that provides a one-time log in for the user, from which * they can change their password. */ -function user_pass_reset_url($account, $options = array()) { +function user_pass_reset_url(UserInterface $account, $options = array()) { $timestamp = REQUEST_TIME; $langcode = isset($options['langcode']) ? $options['langcode'] : $account->getPreferredLangcode(); return \Drupal::url('user.reset', @@ -674,7 +674,7 @@ function user_pass_reset_url($account, $options = array()) { /** * Generates a URL to confirm an account cancellation request. * - * @param object $account + * @param Drupal\user\UserInterface $account * The user account object, which must contain at least the following * properties: * - uid: The user ID number. @@ -692,7 +692,7 @@ function user_pass_reset_url($account, $options = array()) { * @see user_mail_tokens() * @see user_cancel_confirm() */ -function user_cancel_url($account, $options = array()) { +function user_cancel_url(UserInterface $account, $options = array()) { $timestamp = REQUEST_TIME; $langcode = isset($options['langcode']) ? $options['langcode'] : $account->getPreferredLangcode(); $url_options = array('absolute' => TRUE, 'language' => \Drupal::languageManager()->getLanguage($langcode)); @@ -796,6 +796,13 @@ function user_cancel($edit, $uid, $method) { * Since batch and session API require a valid user account, the actual * cancellation of a user account needs to happen last. * + * @param array $edit + * An array of submitted form values. + * @param Drupal\user\UserInterface $account + * The user ID of the user account to cancel. + * @param string $method + * The account cancellation method to use. + * * @see user_cancel() */ function _user_cancel($edit, $account, $method) { @@ -940,7 +947,7 @@ function user_delete_multiple(array $uids) { * To theme user profiles, copy core/modules/user/templates/user.html.twig * to your theme directory, and edit it as instructed in that file's comments. * - * @param \Drupal\Core\Entity\EntityInterface $account + * @param \Drupal\user\UserInterface $account * A user object. * @param string $view_mode * View mode, e.g. 'full'. @@ -951,14 +958,14 @@ function user_delete_multiple(array $uids) { * @return array * An array as expected by drupal_render(). */ -function user_view($account, $view_mode = 'full', $langcode = NULL) { +function user_view(UserInterface $account, $view_mode = 'full', $langcode = NULL) { return entity_view($account, $view_mode, $langcode); } /** * Constructs a drupal_render() style array from an array of loaded users. * - * @param \Drupal\Core\Entity\EntityInterface[] $accounts + * @param \Drupal\user\UserInterface[] $account * An array of user accounts as returned by user_load_multiple(). * @param string $view_mode * (optional) View mode, e.g., 'full', 'teaser'... Defaults to 'teaser'.