From a65d64bfa30a342c23d56826c6fa65ae07e1ecde Mon Sep 17 00:00:00 2001 From: Ranjit Sahoo <62217-Ranjit1032002@users.noreply.drupalcode.org> Date: Sat, 15 Apr 2023 14:43:59 +0000 Subject: [PATCH] Issue #3354249 by Ranjit1032002: Replace Drupal\automatic_updates\Form\UpdaterForm::getUpdateStatus() with a match expression --- src/Form/UpdaterForm.php | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/src/Form/UpdaterForm.php b/src/Form/UpdaterForm.php index 02dd0bc9c2..ee7768166c 100644 --- a/src/Form/UpdaterForm.php +++ b/src/Form/UpdaterForm.php @@ -439,25 +439,14 @@ final class UpdaterForm extends UpdateFormBase { * The human-readable status. */ private function getUpdateStatus(int $status): TranslatableMarkup { - switch ($status) { - case UpdateManagerInterface::NOT_SECURE: - return $this->t('Security update required!'); - - case UpdateManagerInterface::REVOKED: - return $this->t('Revoked!'); - - case UpdateManagerInterface::NOT_SUPPORTED: - return $this->t('Not supported!'); - - case UpdateManagerInterface::NOT_CURRENT: - return $this->t('Update available'); - - case UpdateManagerInterface::CURRENT: - return $this->t('Up to date'); - - default: - return $this->t('Unknown status'); - } + return match ($status) { + UpdateManagerInterface::NOT_SECURE => $this->t('Security update required!'), + UpdateManagerInterface::REVOKED => $this->t('Revoked!'), + UpdateManagerInterface::NOT_SUPPORTED => $this->t('Not supported!'), + UpdateManagerInterface::NOT_CURRENT => $this->t('Update available'), + UpdateManagerInterface::CURRENT => $this->t('Up to date'), + default => $this->t('Unknown status'), + }; } } -- GitLab