Unverified Commit ac623bf9 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2954825 by rakesh.gectcr, tresti88, gnuget, borisson_, DamienGR,...

Issue #2954825 by rakesh.gectcr, tresti88, gnuget, borisson_, DamienGR, Prashant.c, amietpatial, alexpott, joachim, Berdir: Update the user.api.php documentation and add the correct type hints in the user's hooks implementations

(cherry picked from commit 400413fa)
parent 84800034
Loading
Loading
Loading
Loading
+2 −1
Changes for core/modules/comment/comment.module: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@
use Drupal\field\FieldStorageConfigInterface;
use Drupal\node\NodeInterface;
use Drupal\user\RoleInterface;
use Drupal\user\UserInterface;

/**
 * Anonymous posters cannot enter their contact information.
@@ -518,7 +519,7 @@ function comment_node_search_result(EntityInterface $node) {
/**
 * Implements hook_user_cancel().
 */
function comment_user_cancel($edit, $account, $method) {
function comment_user_cancel($edit, UserInterface $account, $method) {
  switch ($method) {
    case 'user_cancel_block_unpublish':
      $comments = entity_load_multiple_by_properties('comment', ['uid' => $account->id()]);
+2 −1
Changes for core/modules/history/history.module: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\user\UserInterface;

/**
 * Entities changed before this time are always shown as read.
@@ -159,7 +160,7 @@ function history_node_delete(EntityInterface $node) {
/**
 * Implements hook_user_cancel().
 */
function history_user_cancel($edit, $account, $method) {
function history_user_cancel($edit, UserInterface $account, $method) {
  switch ($method) {
    case 'user_cancel_reassign':
      db_delete('history')
+2 −1
Changes for core/modules/node/node.module: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@
use Drupal\node\Entity\NodeType;
use Drupal\node\NodeInterface;
use Drupal\node\NodeTypeInterface;
use Drupal\user\UserInterface;

/**
 * Denotes that the node is not published.
@@ -713,7 +714,7 @@ function node_ranking() {
/**
 * Implements hook_user_cancel().
 */
function node_user_cancel($edit, $account, $method) {
function node_user_cancel($edit, UserInterface $account, $method) {
  switch ($method) {
    case 'user_cancel_block_unpublish':
      // Unpublish nodes (current revisions).
+3 −1
Changes for core/modules/system/tests/modules/session_test/session_test.module: 3 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -5,10 +5,12 @@
 * Test module.
 */

use Drupal\user\UserInterface;

/**
 * Implements hook_user_login().
 */
function session_test_user_login($account) {
function session_test_user_login(UserInterface $account) {
  if ($account->getUsername() == 'session_test_user') {
    // Exit so we can verify that the session was regenerated
    // before hook_user_login() was called.
+2 −1
Changes for core/modules/user/tests/modules/user_hooks_test/user_hooks_test.module: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -6,11 +6,12 @@
 */

use Drupal\Component\Render\FormattableMarkup;
use Drupal\Core\Session\AccountInterface;

/**
 * Implements hook_user_format_name_alter().
 */
function user_hooks_test_user_format_name_alter(&$name, $account) {
function user_hooks_test_user_format_name_alter(&$name, AccountInterface $account) {
  if (\Drupal::state()->get('user_hooks_test_user_format_name_alter', FALSE)) {
    if (\Drupal::state()->get('user_hooks_test_user_format_name_alter_safe', FALSE)) {
      $name = new FormattableMarkup('<em>@uid</em>', ['@uid' => $account->id()]);
Loading