From bccd3ac43daaa4b5531e42c7b0e97ccd7c02116e Mon Sep 17 00:00:00 2001
From: catch <6915-catch@users.noreply.drupalcode.org>
Date: Tue, 14 Jan 2025 21:50:12 +0000
Subject: [PATCH] Issue #3498909 by benjifisher: Clean up code in
 UserRolesCacheContext::getContext()

---
 core/lib/Drupal/Core/Cache/Context/UserRolesCacheContext.php | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/core/lib/Drupal/Core/Cache/Context/UserRolesCacheContext.php b/core/lib/Drupal/Core/Cache/Context/UserRolesCacheContext.php
index 48e13b037cc5..cc978750c4da 100644
--- a/core/lib/Drupal/Core/Cache/Context/UserRolesCacheContext.php
+++ b/core/lib/Drupal/Core/Cache/Context/UserRolesCacheContext.php
@@ -30,9 +30,8 @@ public function getContext($role = NULL) {
     if ($role === NULL) {
       return implode(',', $this->user->getRoles());
     }
-    else {
-      return (in_array($role, $this->user->getRoles()) ? 'true' : 'false');
-    }
+
+    return in_array($role, $this->user->getRoles(), TRUE) ? 'true' : 'false';
   }
 
   /**
-- 
GitLab