From 6bc27194263558dd130ecfa556d74d3416dc4359 Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Tue, 22 Jul 2025 10:30:55 +0200 Subject: [PATCH] Simplify UriSigner::verify to use match --- .../Component/HttpFoundation/UriSigner.php | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/UriSigner.php b/src/Symfony/Component/HttpFoundation/UriSigner.php index bb870e43c56f3..690021b5bbe8d 100644 --- a/src/Symfony/Component/HttpFoundation/UriSigner.php +++ b/src/Symfony/Component/HttpFoundation/UriSigner.php @@ -121,19 +121,12 @@ public function verify(Request|string $uri): void $uri = self::normalize($uri); $status = $this->doVerify($uri); - if (self::STATUS_VALID === $status) { - return; - } - - if (self::STATUS_MISSING === $status) { - throw new UnsignedUriException(); - } - - if (self::STATUS_INVALID === $status) { - throw new UnverifiedSignedUriException(); - } - - throw new ExpiredSignedUriException(); + match ($status) { + self::STATUS_VALID => null, + self::STATUS_INVALID => throw new UnverifiedSignedUriException(), + self::STATUS_EXPIRED => throw new ExpiredSignedUriException(), + default => throw new UnsignedUriException(), + }; } private function computeHash(string $uri): string pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy