diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index 56e5f43..3e0a14b 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -2040,7 +2040,8 @@ function drupal_array_merge_deep_array($arrays) { /** * Generates a default anonymous $user object. * - * @return Object - the user object. + * @return Drupal\user\User + * The user object. */ function drupal_anonymous_user() { $user = new stdClass(); @@ -3346,7 +3347,7 @@ function registry_update() { * * Example: * @code - * function user_access($string, $account = NULL) { + * function user_access($string, User $account = NULL) { * // Use the advanced drupal_static() pattern, since this is called very often. * static $drupal_static_fast; * if (!isset($drupal_static_fast)) { diff --git a/core/includes/password.inc b/core/includes/password.inc index b052a4a..f89156d 100644 --- a/core/includes/password.inc +++ b/core/includes/password.inc @@ -13,6 +13,8 @@ * user_needs_new_hash() functions. */ +use Drupal\user\User; + /** * The standard log2 number of iterations for password stretching. This should * increase by 1 every Drupal version in order to counteract increases in the @@ -221,13 +223,13 @@ function user_hash_password($password, $count_log2 = 0) { * * @param $password * A plain-text password - * @param $account + * @param Drupal\user\User $account * A user object with at least the fields from the {users} table. * * @return * TRUE or FALSE. */ -function user_check_password($password, $account) { +function user_check_password($password, User $account) { if (substr($account->pass, 0, 2) == 'U$') { // This may be an updated password from user_update_7000(). Such hashes // have 'U' added as the first character and need an extra md5() (see the @@ -270,13 +272,13 @@ function user_check_password($password, $account) { * Alternative implementations of this function might use other criteria based * on the fields in $account. * - * @param $account + * @param Drupal\user\User $account * A user object with at least the fields from the {users} table. * * @return * TRUE or FALSE. */ -function user_needs_new_hash($account) { +function user_needs_new_hash(User $account) { // Check whether this was an updated password. if ((substr($account->pass, 0, 3) != '$S$') || (strlen($account->pass) != DRUPAL_HASH_LENGTH)) { return TRUE; diff --git a/core/modules/block/block.module b/core/modules/block/block.module index 2592137..63fd9d2 100644 --- a/core/modules/block/block.module +++ b/core/modules/block/block.module @@ -5,6 +5,8 @@ * Controls the visual building blocks a page is constructed with. */ +use Drupal\user\User; + /** * Denotes that a block is not enabled in any region and should not be shown. */ @@ -641,7 +643,7 @@ function block_field_extra_fields() { /** * Implements hook_user_presave(). */ -function block_user_presave($account) { +function block_user_presave(User $account) { if (isset($account->block)) { $account->data['block'] = $account->block; } diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index 8ab8070..4a92a65 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -1444,7 +1444,7 @@ function comment_node_search_result(Node $node) { /** * Implements hook_user_cancel(). */ -function comment_user_cancel($edit, $account, $method) { +function comment_user_cancel($edit, User $account, $method) { switch ($method) { case 'user_cancel_block_unpublish': $comments = entity_load_multiple_by_properties('comment', array('uid' => $account->uid)); @@ -1467,7 +1467,7 @@ function comment_user_cancel($edit, $account, $method) { /** * Implements hook_user_predelete(). */ -function comment_user_predelete($account) { +function comment_user_predelete(User $account) { $cids = db_query('SELECT c.cid FROM {comment} c WHERE uid = :uid', array(':uid' => $account->uid))->fetchCol(); comment_delete_multiple($cids); } diff --git a/core/modules/contact/contact.module b/core/modules/contact/contact.module index 1ba70b9..156a072 100644 --- a/core/modules/contact/contact.module +++ b/core/modules/contact/contact.module @@ -5,6 +5,8 @@ * Enables the use of personal and site-wide contact forms. */ +use Drupal\user\User; + /** * Implements hook_help(). */ @@ -109,12 +111,12 @@ function contact_menu() { /** * Access callback: Checks access for a user's personal contact form. * - * @param $account + * @param Drupal\user\User $account * The user object of the user whose contact form is being requested. * * @see contact_menu() */ -function _contact_personal_tab_access($account) { +function _contact_personal_tab_access(User $account) { global $user; // Anonymous users cannot have contact forms. @@ -233,7 +235,7 @@ function contact_form_user_profile_form_alter(&$form, &$form_state) { /** * Implements hook_user_presave(). */ -function contact_user_presave($account) { +function contact_user_presave(User $account) { $account->data['contact'] = isset($account->contact) ? $account->contact : config('contact.settings')->get('user_default_enabled'); } diff --git a/core/modules/contact/lib/Drupal/contact/Tests/ContactPersonalTest.php b/core/modules/contact/lib/Drupal/contact/Tests/ContactPersonalTest.php index 16d26b0..539634d 100644 --- a/core/modules/contact/lib/Drupal/contact/Tests/ContactPersonalTest.php +++ b/core/modules/contact/lib/Drupal/contact/Tests/ContactPersonalTest.php @@ -7,6 +7,7 @@ namespace Drupal\contact\Tests; +use Drupal\user\User; use Drupal\simpletest\WebTestBase; /** @@ -159,12 +160,12 @@ class ContactPersonalTest extends WebTestBase { /** * Fills out a user's personal contact form and submits it. * - * @param $account + * @param Drupal\user\User $account * A user object of the user being contacted. * @param $message * An optional array with the form fields being used. */ - protected function submitPersonalContact($account, array $message = array()) { + protected function submitPersonalContact(User $account, array $message = array()) { $message += array( 'subject' => $this->randomName(16), 'message' => $this->randomName(64), diff --git a/core/modules/field/field.api.php b/core/modules/field/field.api.php index d77eca1..2b8f2a9 100644 --- a/core/modules/field/field.api.php +++ b/core/modules/field/field.api.php @@ -2666,13 +2666,13 @@ function hook_field_storage_purge($entity_type, $entity, $field, $instance) { * The type of $entity; for example, 'node' or 'user'. * @param $entity * (optional) The entity for the operation. - * @param $account + * @param Drupal\user\User $account * (optional) The account to check; if not given use currently logged in user. * * @return * TRUE if the operation is allowed, and FALSE if the operation is denied. */ -function hook_field_access($op, $field, $entity_type, $entity, $account) { +function hook_field_access($op, $field, $entity_type, $entity, Drupal\user\User $account) { if ($field['field_name'] == 'field_of_interest' && $op == 'edit') { return user_access('edit field of interest', $account); } diff --git a/core/modules/field/field.module b/core/modules/field/field.module index 8157971..7654b04 100644 --- a/core/modules/field/field.module +++ b/core/modules/field/field.module @@ -4,6 +4,7 @@ * Attach custom data fields to Drupal entities. */ +use Drupal\user\User; use Drupal\entity\EntityFieldQuery; /* @@ -995,14 +996,14 @@ function field_has_data($field) { * The type of $entity; e.g., 'node' or 'user'. * @param $entity * (optional) The entity for the operation. - * @param $account + * @param Drupal\user\User $account * (optional) The account to check, if not given use currently logged in user. * * @return * TRUE if the operation is allowed; * FALSE if the operation is denied. */ -function field_access($op, $field, $entity_type, $entity = NULL, $account = NULL) { +function field_access($op, $field, $entity_type, $entity = NULL, User $account = NULL) { global $user; if (!isset($account)) { diff --git a/core/modules/field/tests/modules/field_test/field_test.field.inc b/core/modules/field/tests/modules/field_test/field_test.field.inc index 8933d8b..1d5f1b2 100644 --- a/core/modules/field/tests/modules/field_test/field_test.field.inc +++ b/core/modules/field/tests/modules/field_test/field_test.field.inc @@ -6,6 +6,7 @@ */ use Drupal\field\FieldException; +use Drupal\user\User; /** * Implements hook_field_info(). @@ -405,7 +406,7 @@ function field_test_default_value($entity_type, $entity, $field, $instance) { /** * Implements hook_field_access(). */ -function field_test_field_access($op, $field, $entity_type, $entity, $account) { +function field_test_field_access($op, $field, $entity_type, $entity, User $account) { if ($field['field_name'] == "field_no_{$op}_access") { return FALSE; } diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module index 4d9bfef..8d5b910 100644 --- a/core/modules/filter/filter.module +++ b/core/modules/filter/filter.module @@ -389,7 +389,7 @@ function filter_modules_disabled($modules) { /** * Retrieve a list of text formats, ordered by weight. * - * @param $account + * @param Drupal\user\User $account * (optional) If provided, only those formats that are allowed for this user * account will be returned. All formats will be returned otherwise. * @return @@ -398,7 +398,7 @@ function filter_modules_disabled($modules) { * * @see filter_formats_reset() */ -function filter_formats($account = NULL) { +function filter_formats(User $account = NULL) { $language_interface = language(LANGUAGE_TYPE_INTERFACE); $formats = &drupal_static(__FUNCTION__, array()); @@ -499,7 +499,7 @@ function filter_get_formats_by_role($rid) { * returned by filter_fallback_format() should be used, since that is intended * to be a safe, consistent format that is always available to all users. * - * @param $account + * @param Drupal\user\User $account * (optional) The user account to check. Defaults to the currently logged-in * user. * @return @@ -507,7 +507,7 @@ function filter_get_formats_by_role($rid) { * * @see filter_fallback_format() */ -function filter_default_format($account = NULL) { +function filter_default_format(User $account = NULL) { global $user; if (!isset($account)) { $account = $user; @@ -981,14 +981,14 @@ function theme_text_format_wrapper($variables) { * * @param $format * An object representing the text format. - * @param $account + * @param Drupal\user\User $account * (optional) The user account to check access for; if omitted, the currently * logged-in user is used. * * @return * Boolean TRUE if the user is allowed to access the given format. */ -function filter_access($format, $account = NULL) { +function filter_access($format, User $account = NULL) { global $user; if (!isset($account)) { $account = $user; diff --git a/core/modules/node/node.api.php b/core/modules/node/node.api.php index a73b851..765be5d 100644 --- a/core/modules/node/node.api.php +++ b/core/modules/node/node.api.php @@ -181,7 +181,7 @@ use Drupal\entity\EntityInterface; * sure to restore your {node_access} record after node_access_rebuild() is * called. * - * @param $account + * @param Drupal\user\User $account * The user object whose grants are requested. * @param $op * The node operation to be performed, such as "view", "update", or "delete". @@ -196,7 +196,7 @@ use Drupal\entity\EntityInterface; * @see node_access_rebuild() * @ingroup node_access */ -function hook_node_grants($account, $op) { +function hook_node_grants(Drupal\user\User $account, $op) { if (user_access('access private content', $account)) { $grants['example'] = array(1); } @@ -363,7 +363,7 @@ function hook_node_access_records_alter(&$grants, Drupal\node\Node $node) { * * @param $grants * The $grants array returned by hook_node_grants(). - * @param $account + * @param Drupal\user\User $account * The user account requesting access to content. * @param $op * The operation being performed, 'view', 'update' or 'delete'. @@ -373,7 +373,7 @@ function hook_node_access_records_alter(&$grants, Drupal\node\Node $node) { * @see hook_node_access_records_alter() * @ingroup node_access */ -function hook_node_grants_alter(&$grants, $account, $op) { +function hook_node_grants_alter(&$grants, Drupal\user\User $account, $op) { // Our sample module never allows certain roles to edit or delete // content. Since some other node access modules might allow this // permission, we expressly remove it by returning an empty $grants @@ -594,7 +594,7 @@ function hook_node_load($nodes, $types) { * - "delete" * - "update" * - "view" - * @param object $account + * @param Drupal\user\User $account * The user object to perform the access check operation on. * @param object $langcode * The language code to perform the access check operation on. @@ -606,7 +606,7 @@ function hook_node_load($nodes, $types) { * * @ingroup node_access */ -function hook_node_access($node, $op, $account, $langcode) { +function hook_node_access($node, $op, Drupal\user\User $account, $langcode) { $type = is_string($node) ? $node : $node->type; $configured_types = node_permissions_get_configured_types(); diff --git a/core/modules/node/node.module b/core/modules/node/node.module index 89032d1..20d1e4a 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -1667,7 +1667,7 @@ function node_user_cancel($edit, $account, $method) { /** * Implements hook_user_predelete(). */ -function node_user_predelete($account) { +function node_user_predelete(User $account) { // Delete nodes (current revisions). // @todo Introduce node_mass_delete() or make node_mass_update() more flexible. $nodes = db_select('node', 'n') @@ -1723,7 +1723,7 @@ function theme_node_search_admin($variables) { * The node to check. * @param $op * (optional) The specific operation being checked. Defaults to 'view.' - * @param object $account + * @param Drupal\user\User $account * (optional) A user object representing the user for whom the operation is * to be performed. Determines access for a user other than the current user. * @param $langcode @@ -1736,7 +1736,7 @@ function theme_node_search_admin($variables) { * * @see node_menu() */ -function _node_revision_access(Node $node, $op = 'view', $account = NULL, $langcode = NULL) { +function _node_revision_access(Node $node, $op = 'view', User $account = NULL, $langcode = NULL) { $access = &drupal_static(__FUNCTION__, array()); $map = array( @@ -2864,7 +2864,7 @@ function node_form_system_themes_admin_form_submit($form, &$form_state) { * @param Drupal\node\Node|string|stdClass $node * The node entity on which the operation is to be performed, or the node type * object, or node type string (e.g., 'forum') for the 'create' operation. - * @param $account + * @param Drupal\user\User $account * (optional) A user object representing the user for whom the operation is to * be performed. Determines access for a user other than the current user. * @param $langcode @@ -2881,7 +2881,7 @@ function node_form_system_themes_admin_form_submit($form, &$form_state) { * Add langcode support to node_access schema / queries. * http://drupal.org/node/1658846 */ -function node_access($op, $node, $account = NULL, $langcode = NULL) { +function node_access($op, $node, User $account = NULL, $langcode = NULL) { $rights = &drupal_static(__FUNCTION__, array()); if (!$node || !in_array($op, array('view', 'update', 'delete', 'create'), TRUE)) { @@ -2987,7 +2987,7 @@ function node_access($op, $node, $account = NULL, $langcode = NULL) { /** * Implements hook_node_access(). */ -function node_node_access($node, $op, $account) { +function node_node_access($node, $op, User $account) { $type = is_string($node) ? $node : $node->type; $configured_types = node_permissions_get_configured_types(); @@ -3080,7 +3080,7 @@ function node_permissions_get_configured_types() { * * @param $op * The operation that the user is trying to perform. - * @param $account + * @param Drupal\user\User $account * (optional) The user object for the user performing the operation. If * omitted, the current user is used. * @@ -3088,7 +3088,7 @@ function node_permissions_get_configured_types() { * An associative array in which the keys are realms, and the values are * arrays of grants for those realms. */ -function node_access_grants($op, $account = NULL) { +function node_access_grants($op, User $account = NULL) { if (!isset($account)) { $account = $GLOBALS['user']; @@ -3114,7 +3114,7 @@ function node_access_grants($op, $account = NULL) { * 'node_access'; when this function returns TRUE, no node access joins are * added to the query. * - * @param $account + * @param Drupal\user\User $account * (optional) The user object for the user whose access is being checked. If * omitted, the current user is used. * @@ -3124,7 +3124,7 @@ function node_access_grants($op, $account = NULL) { * @see hook_node_grants() * @see _node_query_node_access_alter() */ -function node_access_view_all_nodes($account = NULL) { +function node_access_view_all_nodes(User $account = NULL) { global $user; if (!$account) { $account = $user; diff --git a/core/modules/node/tests/modules/node_access_test/node_access_test.module b/core/modules/node/tests/modules/node_access_test/node_access_test.module index 402093f..13bdb21 100644 --- a/core/modules/node/tests/modules/node_access_test/node_access_test.module +++ b/core/modules/node/tests/modules/node_access_test/node_access_test.module @@ -14,7 +14,7 @@ use Drupal\node\Node; /** * Implements hook_node_grants(). */ -function node_access_test_node_grants($account, $op) { +function node_access_test_node_grants(User $account, $op) { $grants = array(); // First grant a grant to the author for own content. $grants['node_access_test_author'] = array($account->uid); diff --git a/core/modules/node/tests/modules/node_test/node_test.module b/core/modules/node/tests/modules/node_test/node_test.module index bfad466..2d40199 100644 --- a/core/modules/node/tests/modules/node_test/node_test.module +++ b/core/modules/node/tests/modules/node_test/node_test.module @@ -7,6 +7,7 @@ */ use Drupal\node\Node; +use Drupal\user\User; /** * Implements hook_node_load(). @@ -54,7 +55,7 @@ function node_test_node_view(Node $node, $view_mode) { /** * Implements hook_node_grants(). */ -function node_test_node_grants($account, $op) { +function node_test_node_grants(User $account, $op) { // Give everyone full grants so we don't break other node tests. // Our node access tests asserts three realms of access. // See testGrantAlter(). @@ -117,7 +118,7 @@ function node_test_node_access_records_alter(&$grants, Node $node) { /** * Implements hook_node_grants_alter(). */ -function node_test_node_grants_alter(&$grants, $account, $op) { +function node_test_node_grants_alter(&$grants, User $account, $op) { // Return an empty array of grants to prove that we can alter by reference. $grants = array(); } diff --git a/core/modules/openid/openid.api.php b/core/modules/openid/openid.api.php index bd286ff..0b4064a 100644 --- a/core/modules/openid/openid.api.php +++ b/core/modules/openid/openid.api.php @@ -15,10 +15,10 @@ * * @param $request * An associative array of request parameters. - * @param $service + * @param Drupal\user\User $service * A service array as returned by openid_discovery(). */ -function hook_openid_request_alter(&$request, $service) { +function hook_openid_request_alter(&$request, Drupal\user\User $service) { if ($request['openid.mode'] == 'checkid_setup') { $request['openid.identity'] = 'http://myname.myopenid.com/'; } @@ -29,11 +29,11 @@ function hook_openid_request_alter(&$request, $service) { * * @param $response * Response values from the OpenID Provider. - * @param $account + * @param Drupal\user\User $account * The Drupal user account that logged in * */ -function hook_openid_response($response, $account) { +function hook_openid_response($response, User $account) { if (isset($response['openid.ns.ax'])) { _mymodule_store_ax_fields($response, $account); } diff --git a/core/modules/openid/openid.module b/core/modules/openid/openid.module index 51d3f5c..4a2096f 100644 --- a/core/modules/openid/openid.module +++ b/core/modules/openid/openid.module @@ -5,6 +5,8 @@ * Implement OpenID Relying Party support for Drupal */ +use Drupal\user\User; + /** * Implements hook_menu(). */ @@ -83,7 +85,7 @@ function openid_help($path, $arg) { /** * Implements hook_user_insert(). */ -function openid_user_insert($account) { +function openid_user_insert(User $account) { if (!empty($account->openid_claimed_id)) { // The user has registered after trying to log in via OpenID. if (config('user.settings')->get('verify_mail')) { @@ -100,7 +102,7 @@ function openid_user_insert($account) { * * Save openid_identifier to visitor cookie. */ -function openid_user_login(&$edit, $account) { +function openid_user_login(&$edit, User $account) { if (isset($_SESSION['openid'])) { // The user has logged in via OpenID. user_cookie_save(array_intersect_key($_SESSION['openid']['user_login_values'], array_flip(array('openid_identifier')))); @@ -113,7 +115,7 @@ function openid_user_login(&$edit, $account) { * * Delete any openid_identifier in visitor cookie. */ -function openid_user_logout($account) { +function openid_user_logout(User $account) { if (isset($_COOKIE['Drupal_visitor_openid_identifier'])) { user_cookie_delete('openid_identifier'); } diff --git a/core/modules/openid/tests/openid_test.module b/core/modules/openid/tests/openid_test.module index 89f3ddf..17009a3 100644 --- a/core/modules/openid/tests/openid_test.module +++ b/core/modules/openid/tests/openid_test.module @@ -20,6 +20,7 @@ * key is used for verifying the signed messages from the provider. */ +use Drupal\user\User; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; @@ -362,7 +363,7 @@ function openid_test_openid_request_alter(&$request, $service) { /** * Implements hook_openid_response(). */ -function openid_test_openid_response($response, $account) { +function openid_test_openid_response($response, User $account) { variable_set('openid_test_hook_openid_response_response', $response); variable_set('openid_test_hook_openid_response_account', $account ? $account : FALSE); } diff --git a/core/modules/overlay/overlay.module b/core/modules/overlay/overlay.module index 3aaed7d..dc2feb6 100644 --- a/core/modules/overlay/overlay.module +++ b/core/modules/overlay/overlay.module @@ -5,6 +5,7 @@ * Displays the Drupal administration interface in an overlay. */ +use Drupal\user\User; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; @@ -105,7 +106,7 @@ function overlay_form_user_profile_form_alter(&$form, &$form_state) { /** * Implements hook_user_presave(). */ -function overlay_user_presave($account) { +function overlay_user_presave(User $account) { if (isset($account->overlay)) { $account->data['overlay'] = $account->overlay; } diff --git a/core/modules/poll/poll.module b/core/modules/poll/poll.module index dc4722e..849987b 100644 --- a/core/modules/poll/poll.module +++ b/core/modules/poll/poll.module @@ -7,6 +7,7 @@ */ use Drupal\node\Node; +use Drupal\user\User; /** * Implements hook_help(). @@ -964,7 +965,7 @@ function poll_cancel($form, &$form_state) { /** * Implements hook_user_cancel(). */ -function poll_user_cancel($edit, $account, $method) { +function poll_user_cancel($edit, User $account, $method) { switch ($method) { case 'user_cancel_reassign': db_update('poll_vote') @@ -978,7 +979,7 @@ function poll_user_cancel($edit, $account, $method) { /** * Implements hook_user_predelete(). */ -function poll_user_predelete($account) { +function poll_user_predelete(User $account) { db_delete('poll_vote') ->condition('uid', $account->uid) ->execute(); diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/CommentAttributesTest.php b/core/modules/rdf/lib/Drupal/rdf/Tests/CommentAttributesTest.php index e765436..3cbe7ab 100644 --- a/core/modules/rdf/lib/Drupal/rdf/Tests/CommentAttributesTest.php +++ b/core/modules/rdf/lib/Drupal/rdf/Tests/CommentAttributesTest.php @@ -163,10 +163,10 @@ class CommentAttributesTest extends CommentTestBase { * * @param $comment * Comment object. - * @param $account + * @param Drupal\user\User $account * An array containing information about an anonymous user. */ - function _testBasicCommentRdfaMarkup($comment, $account = array()) { + function _testBasicCommentRdfaMarkup($comment, User $account) { $comment_container = $this->xpath('//div[contains(@class, "comment") and contains(@typeof, "sioct:Comment")]'); $this->assertTrue(!empty($comment_container), t("Comment RDF type for comment found.")); $comment_title = $this->xpath('//div[contains(@class, "comment") and contains(@typeof, "sioct:Comment")]//h3[@property="dc:title"]'); diff --git a/core/modules/shortcut/shortcut.admin.inc b/core/modules/shortcut/shortcut.admin.inc index 3345c59..4fe6ab4 100644 --- a/core/modules/shortcut/shortcut.admin.inc +++ b/core/modules/shortcut/shortcut.admin.inc @@ -5,6 +5,7 @@ * Administrative page callbacks for the shortcut module. */ +use Drupal\user\User; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; /** @@ -14,7 +15,7 @@ use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; * An associative array containing the structure of the form. * @param $form_state * An associative array containing the current state of the form. - * @param $account + * @param Drupal\user\User $account * (optional) The user account whose shortcuts will be switched. Defaults to * the current logged-in user. * @@ -25,7 +26,7 @@ use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; * @see shortcut_set_switch_validate() * @see shortcut_set_switch_submit() */ -function shortcut_set_switch($form, &$form_state, $account = NULL) { +function shortcut_set_switch($form, &$form_state, User $account = NULL) { global $user; if (!isset($account)) { $account = $user; diff --git a/core/modules/shortcut/shortcut.api.php b/core/modules/shortcut/shortcut.api.php index 2fcbdc9..d653710 100644 --- a/core/modules/shortcut/shortcut.api.php +++ b/core/modules/shortcut/shortcut.api.php @@ -24,13 +24,13 @@ * modules implement this hook, the last (i.e., highest weighted) module which * returns a valid shortcut set name will prevail. * - * @param $account + * @param Drupal\user\User $account * The user account whose default shortcut set is being requested. * @return * The name of the shortcut set that this module recommends for that user, if * there is one. */ -function hook_shortcut_default_set($account) { +function hook_shortcut_default_set(Drupal\user\User $account) { // Use a special set of default shortcuts for administrators only. if (in_array(config('user.settings')->get('admin_role'), $account->roles)) { return variable_get('mymodule_shortcut_admin_default_set'); diff --git a/core/modules/shortcut/shortcut.module b/core/modules/shortcut/shortcut.module index 27eb8c2..2dedf76 100644 --- a/core/modules/shortcut/shortcut.module +++ b/core/modules/shortcut/shortcut.module @@ -5,6 +5,8 @@ * Allows users to manage customizable lists of shortcut links. */ +use Drupal\user\User; + /** * The name of the default shortcut set. * @@ -256,7 +258,7 @@ function shortcut_set_delete_access($shortcut_set) { /** * Access callback for switching the shortcut set assigned to a user account. * - * @param object $account + * @param Drupal\user\User $account * (optional) The user account whose shortcuts will be switched. If not set, * permissions will be checked for switching the logged-in user's own * shortcut set. @@ -265,7 +267,7 @@ function shortcut_set_delete_access($shortcut_set) { * TRUE if the current user has access to switch the shortcut set of the * provided account, FALSE otherwise. */ -function shortcut_set_switch_access($account = NULL) { +function shortcut_set_switch_access(User $account = NULL) { global $user; if (user_access('administer shortcuts')) { @@ -435,10 +437,10 @@ function shortcut_set_reset_link_weights(&$shortcut_set) { * * @param $shortcut_set * An object representing the shortcut set. - * @param $account + * @param Drupal\user\User $account * A user account that will be assigned to use the set. */ -function shortcut_set_assign_user($shortcut_set, $account) { +function shortcut_set_assign_user($shortcut_set, User $account) { db_merge('shortcut_set_users') ->key(array('uid' => $account->uid)) ->fields(array('set_name' => $shortcut_set->set_name)) @@ -451,7 +453,7 @@ function shortcut_set_assign_user($shortcut_set, $account) { * * The user will go back to using whatever default set applies. * - * @param $account + * @param Drupal\user\User $account * A user account that will be removed from the shortcut set assignment. * * @return @@ -459,7 +461,7 @@ function shortcut_set_assign_user($shortcut_set, $account) { * successfully removed from it. FALSE if the user was already not assigned * to any set. */ -function shortcut_set_unassign_user($account) { +function shortcut_set_unassign_user(User $account) { $deleted = db_delete('shortcut_set_users') ->condition('uid', $account->uid) ->execute(); @@ -469,7 +471,7 @@ function shortcut_set_unassign_user($account) { /** * Returns the current displayed shortcut set for the provided user account. * - * @param $account + * @param Drupal\user\User $account * (optional) The user account whose shortcuts will be returned. Defaults to * the currently logged-in user. * @@ -478,7 +480,7 @@ function shortcut_set_unassign_user($account) { * current user. If the user does not have an explicit shortcut set defined, * the default set is returned. */ -function shortcut_current_displayed_set($account = NULL) { +function shortcut_current_displayed_set(Drupal\user\User $account = NULL) { $shortcut_sets = &drupal_static(__FUNCTION__, array()); global $user; if (!isset($account)) { @@ -510,7 +512,7 @@ function shortcut_current_displayed_set($account = NULL) { /** * Returns the default shortcut set for a given user account. * - * @param object $account + * @param Drupal\user\User $account * (optional) The user account whose default shortcut set will be returned. * If not provided, the function will return the currently logged-in user's * default shortcut set. @@ -518,7 +520,7 @@ function shortcut_current_displayed_set($account = NULL) { * @return * An object representing the default shortcut set. */ -function shortcut_default_set($account = NULL) { +function shortcut_default_set(User $account = NULL) { global $user; if (!isset($account)) { $account = $user; diff --git a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php index 25139e6..52117a4 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php @@ -369,7 +369,7 @@ abstract class WebTestBase extends TestBase { * Array of permission names to assign to user. Note that the user always * has the default permissions derived from the "authenticated users" role. * - * @return object|false + * @return \Drupal\user\User|false * A fully loaded user object with pass_raw property, or FALSE if account * creation fails. */ @@ -515,7 +515,7 @@ abstract class WebTestBase extends TestBase { * $account->pass_raw = $pass_raw; * @endcode * - * @param $user + * @param \Drupal\user\User $user * User object representing the user to log in. * * @see drupalCreateUser() diff --git a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsAdminTest.php b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsAdminTest.php index a24ec95..92ceff6 100644 --- a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsAdminTest.php +++ b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsAdminTest.php @@ -24,7 +24,7 @@ class StatisticsAdminTest extends WebTestBase { /** * A user that has permission to administer and access statistics. * - * @var object|FALSE + * @var \Drupal\user\User|false * * A fully loaded user object, or FALSE if user creation failed. */ diff --git a/core/modules/statistics/statistics.module b/core/modules/statistics/statistics.module index 35f625a..b9cd00c 100644 --- a/core/modules/statistics/statistics.module +++ b/core/modules/statistics/statistics.module @@ -6,6 +6,7 @@ */ use Drupal\node\Node; +use Drupal\user\User; /** * Implements hook_help(). @@ -206,7 +207,7 @@ function statistics_menu() { /** * Implements hook_user_cancel(). */ -function statistics_user_cancel($edit, $account, $method) { +function statistics_user_cancel($edit, User $account, $method) { switch ($method) { case 'user_cancel_reassign': db_update('accesslog') @@ -220,7 +221,7 @@ function statistics_user_cancel($edit, $account, $method) { /** * Implements hook_user_predelete(). */ -function statistics_user_predelete($account) { +function statistics_user_predelete(User $account) { db_delete('accesslog') ->condition('uid', $account->uid) ->execute(); diff --git a/core/modules/system/system.module b/core/modules/system/system.module index de7241f..30bb8d7 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -5,6 +5,7 @@ * Configuration system that lets administrators modify the workings of the site. */ +use Drupal\user\User; use Drupal\Core\Utility\ModuleInfo; use Symfony\Component\HttpFoundation\JsonResponse; @@ -2237,7 +2238,7 @@ function system_form_user_register_form_alter(&$form, &$form_state) { /** * Implements hook_user_presave(). */ -function system_user_presave($account) { +function system_user_presave(User $account) { if (variable_get('configurable_timezones', 1) && empty($account->timezone) && !variable_get('user_default_timezone', DRUPAL_USER_TIMEZONE_DEFAULT)) { $account->timezone = variable_get('date_default_timezone', ''); } @@ -2246,7 +2247,7 @@ function system_user_presave($account) { /** * Implements hook_user_login(). */ -function system_user_login(&$edit, $account) { +function system_user_login(&$edit, User $account) { // If the user has a NULL time zone, notify them to set a time zone. if (!$account->timezone && variable_get('configurable_timezones', 1) && variable_get('empty_timezone_message', 0)) { drupal_set_message(t('Configure your account time zone setting.', array('@user-edit' => url("user/$account->uid/edit", array('query' => drupal_get_destination(), 'fragment' => 'edit-timezone'))))); diff --git a/core/modules/system/tests/modules/session_test/session_test.module b/core/modules/system/tests/modules/session_test/session_test.module index 689ff09..c1fe030 100644 --- a/core/modules/system/tests/modules/session_test/session_test.module +++ b/core/modules/system/tests/modules/session_test/session_test.module @@ -1,5 +1,7 @@ name == 'session_test_user') { // Exit so we can verify that the session was regenerated // before hook_user() was called. diff --git a/core/modules/tracker/tracker.module b/core/modules/tracker/tracker.module index 7060a87..f4ced98 100644 --- a/core/modules/tracker/tracker.module +++ b/core/modules/tracker/tracker.module @@ -157,8 +157,8 @@ function tracker_cron() { /** * Access callback: Determines access permission for a user's own account. * - * @param int $account - * The account ID to check. + * @param Drupal\user\User $account + * The user object to check. * * @return boolean * TRUE if a user is accessing tracking info for their own account and @@ -166,7 +166,7 @@ function tracker_cron() { * * @see tracker_menu() */ -function _tracker_myrecent_access($account) { +function _tracker_myrecent_access(User $account) { // This path is only allowed for authenticated users looking at their own content. return $account->uid && ($GLOBALS['user']->uid == $account->uid) && user_access('access content'); } diff --git a/core/modules/tracker/tracker.pages.inc b/core/modules/tracker/tracker.pages.inc index f012264..cc890e5 100644 --- a/core/modules/tracker/tracker.pages.inc +++ b/core/modules/tracker/tracker.pages.inc @@ -12,12 +12,15 @@ * Queries the database for info, adds RDFa info if applicable, and generates * the render array that will be used to render the page. * + * @param Drupal\user\User $account + * The account object for the user whose name is to be formatted. + * * @return array * A renderable array. * * @see tracker_menu() */ -function tracker_page($account = NULL, $set_title = FALSE) { +function tracker_page(User $account = NULL, $set_title = FALSE) { if ($account) { $query = db_select('tracker_user', 't') ->extend('Drupal\Core\Database\Query\PagerSelectExtender'); diff --git a/core/modules/user/lib/Drupal/user/Tests/UserLoginTest.php b/core/modules/user/lib/Drupal/user/Tests/UserLoginTest.php index b5e8882..12212dc 100644 --- a/core/modules/user/lib/Drupal/user/Tests/UserLoginTest.php +++ b/core/modules/user/lib/Drupal/user/Tests/UserLoginTest.php @@ -7,6 +7,7 @@ namespace Drupal\user\Tests; +use Drupal\user\User; use Drupal\simpletest\WebTestBase; /** @@ -124,13 +125,13 @@ class UserLoginTest extends WebTestBase { /** * Make an unsuccessful login attempt. * - * @param $account - * A user object with name and pass_raw attributes for the login attempt. + * @param Drupal\user\User $account + * A user entity with name and pass_raw attributes for the login attempt. * @param $flood_trigger * Whether or not to expect that the flood control mechanism will be * triggered. */ - function assertFailedLogin($account, $flood_trigger = NULL) { + function assertFailedLogin(User $account, $flood_trigger = NULL) { $edit = array( 'name' => $account->name, 'pass' => $account->pass_raw, diff --git a/core/modules/user/lib/Drupal/user/Tests/UserRolesAssignmentTest.php b/core/modules/user/lib/Drupal/user/Tests/UserRolesAssignmentTest.php index eaabdd2..3884d38 100644 --- a/core/modules/user/lib/Drupal/user/Tests/UserRolesAssignmentTest.php +++ b/core/modules/user/lib/Drupal/user/Tests/UserRolesAssignmentTest.php @@ -83,7 +83,7 @@ class UserRolesAssignmentTest extends WebTestBase { /** * Check role on user object. * - * @param object $account + * @param \Drupal\user\User $account * The user account to check. * @param string $rid * The role ID to search for. @@ -91,7 +91,7 @@ class UserRolesAssignmentTest extends WebTestBase { * (optional) Whether to assert that $rid exists (TRUE) or not (FALSE). * Defaults to TRUE. */ - private function userLoadAndCheckRoleAssigned($account, $rid, $is_assigned = TRUE) { + private function userLoadAndCheckRoleAssigned(User $account, $rid, $is_assigned = TRUE) { $account = user_load($account->uid, TRUE); if ($is_assigned) { $this->assertTrue(array_key_exists($rid, $account->roles), t('The role is present in the user object.')); diff --git a/core/modules/user/user.api.php b/core/modules/user/user.api.php index 98b9887..1cf9bd6 100644 --- a/core/modules/user/user.api.php +++ b/core/modules/user/user.api.php @@ -42,13 +42,13 @@ function hook_user_load($users) { * Modules should additionally implement hook_user_cancel() to process stored * user data for other account cancellation methods. * - * @param $account + * @param Drupal\user\User $account * The account that is about to be deleted. * * @see hook_user_delete() * @see user_delete_multiple() */ -function hook_user_predelete($account) { +function hook_user_predelete(Drupal\user\User $account) { db_delete('mytable') ->condition('uid', $account->uid) ->execute(); @@ -63,13 +63,13 @@ function hook_user_predelete($account) { * Modules should additionally implement hook_user_cancel() to process stored * user data for other account cancellation methods. * - * @param $account + * @param Drupal\user\User $account * The account that has been deleted. * * @see hook_user_predelete() * @see user_delete_multiple() */ -function hook_user_delete($account) { +function hook_user_delete(Drupal\user\User $account) { drupal_set_message(t('User: @name has been deleted.', array('@name' => $account->name))); } @@ -91,7 +91,7 @@ function hook_user_delete($account) { * * @param $edit * The array of form values submitted by the user. - * @param $account + * @param Drupal\user\User $account * The user object on which the operation is being performed. * @param $method * The account cancellation method. @@ -99,7 +99,7 @@ function hook_user_delete($account) { * @see user_cancel_methods() * @see hook_user_cancel_methods_alter() */ -function hook_user_cancel($edit, $account, $method) { +function hook_user_cancel($edit, Drupal\user\User $account, $method) { switch ($method) { case 'user_cancel_block_unpublish': // Unpublish nodes (current revisions). @@ -182,12 +182,12 @@ function hook_user_cancel_methods_alter(&$methods) { * @param $name * The string that user_format_name() will return. * - * @param $account + * @param Drupal\user\User $account * The account object passed to user_format_name(). * * @see user_format_name() */ -function hook_user_format_name_alter(&$name, $account) { +function hook_user_format_name_alter(&$name, Drupal\user\User $account) { // Display the user's uid instead of name. if (isset($account->uid)) { $name = t('User !uid', array('!uid' => $account->uid)); @@ -238,13 +238,13 @@ function hook_user_operations() { * add their properties to $account->data in order to have their data serialized * on save. * - * @param $account + * @param Drupal\user\User $account * The user account object. * * @see hook_user_insert() * @see hook_user_update() */ -function hook_user_presave($account) { +function hook_user_presave(Drupal\user\User $account) { // Make sure that our form value 'mymodule_foo' is stored as // 'mymodule_bar' in the 'data' (serialized) column. if (isset($account->mymodule_foo)) { @@ -255,13 +255,13 @@ function hook_user_presave($account) { /** * Respond to creation of a new user account. * - * @param $account + * @param Drupal\user\User $account * The user account object. * * @see hook_user_presave() * @see hook_user_update() */ -function hook_user_insert($account) { +function hook_user_insert(Drupal\user\User $account) { db_insert('user_changes') ->fields(array( 'uid' => $account->uid, @@ -273,13 +273,13 @@ function hook_user_insert($account) { /** * Respond to updates to a user account. * - * @param $account + * @param Drupal\user\User $account * The user account object. * * @see hook_user_presave() * @see hook_user_insert() */ -function hook_user_update($account) { +function hook_user_update(Drupal\user\User $account) { db_insert('user_changes') ->fields(array( 'uid' => $account->uid, @@ -293,10 +293,10 @@ function hook_user_update($account) { * * @param $edit * The array of form values submitted by the user. - * @param $account + * @param Drupal\user\User $account * The user object on which the operation was just performed. */ -function hook_user_login(&$edit, $account) { +function hook_user_login(&$edit, Drupal\user\User $account) { // If the user has a NULL time zone, notify them to set a time zone. if (!$account->timezone && variable_get('configurable_timezones', 1) && variable_get('empty_timezone_message', 0)) { drupal_set_message(t('Configure your account time zone setting.', array('@user-edit' => url("user/$account->uid/edit", array('query' => drupal_get_destination(), 'fragment' => 'edit-timezone'))))); @@ -306,10 +306,10 @@ function hook_user_login(&$edit, $account) { /** * The user just logged out. * - * @param $account + * @param Drupal\user\User $account * The user object on which the operation was just performed. */ -function hook_user_logout($account) { +function hook_user_logout(Drupal\user\User $account) { db_insert('logouts') ->fields(array( 'uid' => $account->uid, @@ -324,7 +324,7 @@ function hook_user_logout($account) { * The module should format its custom additions for display and add them to the * $account->content array. * - * @param $account + * @param Drupal\user\User $account * The user object on which the operation is being performed. * @param $view_mode * View mode, e.g. 'full'. @@ -334,7 +334,7 @@ function hook_user_logout($account) { * @see hook_user_view_alter() * @see hook_entity_view() */ -function hook_user_view($account, $view_mode, $langcode) { +function hook_user_view(Drupal\user\User $account, $view_mode, $langcode) { $account->content['user_picture'] = array( '#markup' => theme('user_picture', array('account' => $account)), '#weight' => -10, diff --git a/core/modules/user/user.module b/core/modules/user/user.module index e90c907..b252136 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -91,11 +91,11 @@ function user_help($path, $arg) { * @param $edit * An associative array variable containing form values to be passed * as the first parameter of the hook function. - * @param $account + * @param Drupal\user\User $account * The user account object to be passed as the second parameter of the hook * function. */ -function user_module_invoke($type, &$edit, $account) { +function user_module_invoke($type, &$edit, User $account) { foreach (module_implements('user_' . $type) as $module) { $function = $module . '_user_' . $type; $function($edit, $account); @@ -257,7 +257,7 @@ function user_field_extra_fields() { * @param string $authname * The external authentication username. * - * @return + * @return Drupal\user\User|false * A fully-loaded user object if the user is found or FALSE if not found. */ function user_external_load($authname) { @@ -315,11 +315,9 @@ function user_load_multiple(array $uids = NULL, $reset = FALSE) { * TRUE to reset the internal cache and load from the database; FALSE * (default) to load from the internal cache, if set. * - * @return object + * @return Drupal\user\User|false * A fully-loaded user object upon successful user load, or FALSE if the user * cannot be loaded. - * - * @see user_load_multiple() */ function user_load($uid, $reset = FALSE) { return entity_load('user', $uid, $reset); @@ -330,7 +328,7 @@ function user_load($uid, $reset = FALSE) { * * @param string $mail * String with the account's e-mail address. - * @return object|bool + * @return Drupal\user\User|false * A fully-loaded $user object upon successful user load or FALSE if user * cannot be loaded. * @@ -346,7 +344,7 @@ function user_load_by_mail($mail) { * * @param string $name * String with the account's user name. - * @return object|bool + * @return Drupal\user\User|false * A fully-loaded $user object upon successful user load or FALSE if user * cannot be loaded. * @@ -494,7 +492,7 @@ function user_role_permissions($roles = array()) { * * @param $string * The permission, such as "administer nodes", being checked for. - * @param $account + * @param Drupal\user\User $account * (optional) The account to check, if not given use currently logged in user. * * @return @@ -504,7 +502,7 @@ function user_role_permissions($roles = array()) { * way, we guarantee consistent behavior, and ensure that the superuser * can perform all actions. */ -function user_access($string, $account = NULL) { +function user_access($string, User $account = NULL) { global $user; if (!isset($account)) { @@ -684,7 +682,7 @@ function user_search_execute($keys = NULL, $conditions = NULL) { /** * Implements hook_user_view(). */ -function user_user_view($account) { +function user_user_view(User $account) { $account->content['user_picture'] = array( '#markup' => theme('user_picture', array('account' => $account)), '#weight' => -10, @@ -908,7 +906,7 @@ function user_preprocess_block(&$variables) { * * @see hook_user_format_name_alter() * - * @param $account + * @param Drupal\user\User $account * The account object for the user whose name is to be formatted. * * @return @@ -916,7 +914,7 @@ function user_preprocess_block(&$variables) { * this result must ensure that check_plain() is called on it before it is * printed to the page. */ -function user_format_name($account) { +function user_format_name(User $account) { $name = !empty($account->name) ? $account->name : config('user.settings')->get('anonymous'); drupal_alter('user_format_name', $name, $account); return $name; @@ -1128,6 +1126,8 @@ function user_register_access() { * * @param $account * Can either be a full user object or a $uid. + * + * @todo: refactor into seperate functions. */ function user_view_access($account) { $uid = is_object($account) ? $account->uid : (int) $account; @@ -1152,7 +1152,7 @@ function user_view_access($account) { /** * Access callback for user account editing. */ -function user_edit_access($account) { +function user_edit_access(User $account) { return (($GLOBALS['user']->uid == $account->uid) || user_access('administer users')) && $account->uid > 0; } @@ -1162,7 +1162,7 @@ function user_edit_access($account) { * Limit access to users with the 'cancel account' permission or administrative * users, and prevent the anonymous user from cancelling the account. */ -function user_cancel_access($account) { +function user_cancel_access(User $account) { return ((($GLOBALS['user']->uid == $account->uid) && user_access('cancel account')) || user_access('administer users')) && $account->uid > 0; } @@ -1472,7 +1472,7 @@ function user_uid_only_optional_to_arg($arg) { * @param $uid * An optional user ID of the user to load. If not provided, the current * user's ID will be used. - * @return + * @return Drupal\user\User|false * A fully-loaded $user object upon successful user load, FALSE if user * cannot be loaded. * @@ -1532,7 +1532,7 @@ function user_get_authmaps($authname = NULL) { * Save mappings of which external authentication module(s) authenticated * a user. Maps external usernames to user ids in the users table. * - * @param $account + * @param Drupal\user\User $account * A user object. * @param $authmaps * An associative array with a compound key and the username as the value. @@ -1540,7 +1540,7 @@ function user_get_authmaps($authname = NULL) { * module. * @see user_external_login_register() */ -function user_set_authmaps($account, $authmaps) { +function user_set_authmaps(User $account, $authmaps) { foreach ($authmaps as $key => $value) { $module = explode('_', $key, 2); if ($value) { @@ -1815,8 +1815,8 @@ function user_external_login_register($name, $module) { /** * Generates a unique URL for a user to login and reset their password. * - * @param object $account - * An object containing the user account. + * @param Drupal\user\User $account + * A user object. * @param array $options * (optional) A keyed array of settings. Supported options are: * - langcode: A language code to be used when generating locale-sensitive @@ -1826,7 +1826,7 @@ function user_external_login_register($name, $module) { * 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(User $account, $options = array()) { $timestamp = REQUEST_TIME; $url_options = array('absolute' => TRUE); if (isset($options['langcode'])) { @@ -1841,7 +1841,7 @@ function user_pass_reset_url($account, $options = array()) { /** * Generates a URL to confirm an account cancellation request. * - * @param object $account + * @param Drupal\user\User $account * The user account object, which must contain at least the following * properties: * - uid: The user uid number. @@ -1859,7 +1859,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(User $account, $options = array()) { $timestamp = REQUEST_TIME; $url_options = array('absolute' => TRUE); if (isset($options['langcode'])) { @@ -1959,7 +1959,7 @@ function user_cancel($edit, $uid, $method) { * * @see user_cancel() */ -function _user_cancel($edit, $account, $method) { +function _user_cancel($edit, User $account, $method) { global $user; switch ($method) { @@ -2082,7 +2082,7 @@ function user_view_page($account) { * To theme user profiles, copy modules/user/user-profile.tpl.php * to your theme directory, and edit it as instructed in that file's comments. * - * @param $account + * @param Drupal\user\User $account * A user object. * @param $view_mode * View mode, e.g. 'full'. @@ -2093,7 +2093,7 @@ function user_view_page($account) { * @return * An array as expected by drupal_render(). */ -function user_view($account, $view_mode = 'full', $langcode = NULL) { +function user_view(User $account, $view_mode = 'full', $langcode = NULL) { if (!isset($langcode)) { $langcode = language(LANGUAGE_TYPE_CONTENT)->langcode; } @@ -2121,7 +2121,7 @@ function user_view($account, $view_mode = 'full', $langcode = NULL) { /** * Builds a structured array representing the profile content. * - * @param $account + * @param Drupal\user\User $account * A user object. * @param $view_mode * View mode, e.g. 'full'. @@ -2129,7 +2129,7 @@ function user_view($account, $view_mode = 'full', $langcode = NULL) { * (optional) A language code to use for rendering. Defaults to the global * content language of the current request. */ -function user_build_content($account, $view_mode = 'full', $langcode = NULL) { +function user_build_content(User $account, $view_mode = 'full', $langcode = NULL) { if (!isset($langcode)) { $langcode = language(LANGUAGE_TYPE_CONTENT)->langcode; } @@ -2982,13 +2982,13 @@ function theme_user_signature($variables) { * choose a preferred language, or is the anonymous user, the $default * value, or if it is not set, the site default language will be returned. * - * @param $account + * @param Drupal\user\User $account * User account to look up language for. * @param $default * Optional default language object to return if the account * has no valid language. */ -function user_preferred_language($account, $default = NULL) { +function user_preferred_language(User $account, $default = NULL) { $language_list = language_list(); if (!empty($account->preferred_langcode) && isset($language_list[$account->preferred_langcode])) { return $language_list[$account->preferred_langcode]; @@ -3018,7 +3018,7 @@ function user_preferred_language($account, $default = NULL) { * - 'cancel_confirm': Account cancellation request. * - 'status_canceled': Account canceled. * - * @param $account + * @param Drupal\user\User $account * The user object of the account being notified. Must contain at * least the fields 'uid', 'name', and 'mail'. * @param $language @@ -3028,7 +3028,7 @@ function user_preferred_language($account, $default = NULL) { * The return value from drupal_mail_system()->mail(), if ends up being * called. */ -function _user_mail_notify($op, $account, $language = NULL) { +function _user_mail_notify($op, User $account, $language = NULL) { // By default, we always notify except for canceled and blocked. $notify = config('user.settings')->get('notify.' . $op); if ($notify || ($op != 'status_canceled' && $op != 'status_blocked')) {