diff --git a/core/lib/Drupal/Component/HttpFoundation/SecuredRedirectResponse.php b/core/lib/Drupal/Component/HttpFoundation/SecuredRedirectResponse.php
index 7d4a3f7754d0214c3e381db88973dc738a29aef9..37c01a1b56471c36db5a7bfee150a1c2b4b482ee 100644
--- a/core/lib/Drupal/Component/HttpFoundation/SecuredRedirectResponse.php
+++ b/core/lib/Drupal/Component/HttpFoundation/SecuredRedirectResponse.php
@@ -53,7 +53,7 @@ protected function fromResponse(RedirectResponse $response) {
   /**
    * {@inheritdoc}
    */
-  public function setTargetUrl($url) {
+  public function setTargetUrl($url): static {
     if (!$this->isSafe($url)) {
       throw new \InvalidArgumentException(sprintf('It is not safe to redirect to %s', $url));
     }