Verified Commit a51813d2 authored by Dave Long's avatar Dave Long
Browse files

refactor: #3619763 Clean up UpdateMessageTrait::getText return type

By: nicxvan
By: danielveza
By: berdir
parent 595e1cff
Loading
Loading
Loading
Loading
Loading
+1 −1
Changes for core/modules/update/src/Hook/UpdateHooks.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -126,7 +126,7 @@ public function mail($key, &$message, $params): void {
    $language = \Drupal::languageManager()->getLanguage($langcode);
    $message['subject'] .= $this->t('New release(s) available for @site_name', ['@site_name' => \Drupal::config('system.site')->get('name')], ['langcode' => $langcode]);
    foreach ($params as $msg_type => $msg_reason) {
      $message['body'][] = $this->getText($msg_type, $msg_reason, $langcode, TRUE);
      $message['body'][] = $this->getText($msg_type, $msg_reason, $langcode, TRUE) ?? '';
    }
    $message['body'][] = $this->t('See the available updates page for more information:',
      [],
+5 −4
Changes for core/modules/update/src/UpdateMessageTrait.php: 5 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -44,11 +44,12 @@ protected function noData(): TranslatableMarkup {
   *   If FALSE, links will be relative and will only be included if the
   *   current user can access them. Defaults to FALSE.
   *
   * @return string|\Drupal\Core\StringTranslation\TranslatableMarkup
   *   The properly translated error message for the given key.
   * @return \Drupal\Core\StringTranslation\TranslatableMarkup|null
   *   The properly translated error message for the given key, or NULL if
   *   there is no message for the given key.
   */
  protected function getText(string $msg_type, int $msg_reason, ?string $langcode = NULL, bool $is_email = FALSE): string|TranslatableMarkup {
    $text = '';
  protected function getText(string $msg_type, int $msg_reason, ?string $langcode = NULL, bool $is_email = FALSE): ?TranslatableMarkup {
    $text = NULL;
    switch ($msg_reason) {
      case UpdateManagerInterface::NOT_SECURE:
        if ($msg_type == 'core') {