diff --git a/core/lib/Drupal/Component/Render/FormattableMarkup.php b/core/lib/Drupal/Component/Render/FormattableMarkup.php
index e26f90e9b8..ae6cd5bad2 100644
--- a/core/lib/Drupal/Component/Render/FormattableMarkup.php
+++ b/core/lib/Drupal/Component/Render/FormattableMarkup.php
@@ -115,6 +115,7 @@ public function count() {
    * @return string
    *   The safe string content.
    */
+  #[\ReturnTypeWillChange]
   public function jsonSerialize() {
     return $this->__toString();
   }
diff --git a/core/lib/Drupal/Component/Render/HtmlEscapedText.php b/core/lib/Drupal/Component/Render/HtmlEscapedText.php
index 0ddc4fa4c5..286a7aa022 100644
--- a/core/lib/Drupal/Component/Render/HtmlEscapedText.php
+++ b/core/lib/Drupal/Component/Render/HtmlEscapedText.php
@@ -48,6 +48,7 @@ public function count() {
   /**
    * {@inheritdoc}
    */
+  #[\ReturnTypeWillChange]
   public function jsonSerialize() {
     return $this->__toString();
   }
diff --git a/core/lib/Drupal/Component/Render/MarkupTrait.php b/core/lib/Drupal/Component/Render/MarkupTrait.php
index c7faa81aba..25ab172720 100644
--- a/core/lib/Drupal/Component/Render/MarkupTrait.php
+++ b/core/lib/Drupal/Component/Render/MarkupTrait.php
@@ -68,6 +68,7 @@ public function count() {
    * @return string
    *   The safe string content.
    */
+  #[\ReturnTypeWillChange]
   public function jsonSerialize() {
     return $this->__toString();
   }
diff --git a/core/lib/Drupal/Core/GeneratedLink.php b/core/lib/Drupal/Core/GeneratedLink.php
index 62f10a5df7..8b92e43e07 100644
--- a/core/lib/Drupal/Core/GeneratedLink.php
+++ b/core/lib/Drupal/Core/GeneratedLink.php
@@ -57,6 +57,7 @@ public function __toString() {
   /**
    * {@inheritdoc}
    */
+  #[\ReturnTypeWillChange]
   public function jsonSerialize() {
     return $this->__toString();
   }
diff --git a/core/lib/Drupal/Core/Session/SessionHandler.php b/core/lib/Drupal/Core/Session/SessionHandler.php
index eb694921af..420864e623 100644
--- a/core/lib/Drupal/Core/Session/SessionHandler.php
+++ b/core/lib/Drupal/Core/Session/SessionHandler.php
@@ -46,6 +46,7 @@ public function __construct(RequestStack $request_stack, Connection $connection)
   /**
    * {@inheritdoc}
    */
+  #[\ReturnTypeWillChange]
   public function open($save_path, $name) {
     return TRUE;
   }
@@ -53,6 +54,7 @@ public function open($save_path, $name) {
   /**
    * {@inheritdoc}
    */
+  #[\ReturnTypeWillChange]
   public function read($sid) {
     $data = '';
     if (!empty($sid)) {
@@ -67,6 +69,7 @@ public function read($sid) {
   /**
    * {@inheritdoc}
    */
+  #[\ReturnTypeWillChange]
   public function write($sid, $value) {
     // The exception handler is not active at this point, so we need to do it
     // manually.
@@ -99,6 +102,7 @@ public function write($sid, $value) {
   /**
    * {@inheritdoc}
    */
+  #[\ReturnTypeWillChange]
   public function close() {
     return TRUE;
   }
@@ -106,6 +110,7 @@ public function close() {
   /**
    * {@inheritdoc}
    */
+  #[\ReturnTypeWillChange]
   public function destroy($sid) {
     // Delete session data.
     $this->connection->delete('sessions')
@@ -118,6 +123,7 @@ public function destroy($sid) {
   /**
    * {@inheritdoc}
    */
+  #[\ReturnTypeWillChange]
   public function gc($lifetime) {
     // Be sure to adjust 'php_value session.gc_maxlifetime' to a large enough
     // value. For example, if you want user sessions to stay in your database
diff --git a/core/lib/Drupal/Core/Session/WriteSafeSessionHandler.php b/core/lib/Drupal/Core/Session/WriteSafeSessionHandler.php
index fadf29bffd..d18340d754 100644
--- a/core/lib/Drupal/Core/Session/WriteSafeSessionHandler.php
+++ b/core/lib/Drupal/Core/Session/WriteSafeSessionHandler.php
@@ -43,6 +43,7 @@ public function __construct(\SessionHandlerInterface $wrapped_session_handler, $
   /**
    * {@inheritdoc}
    */
+  #[\ReturnTypeWillChange]
   public function close() {
     return $this->wrappedSessionHandler->close();
   }
@@ -50,6 +51,7 @@ public function close() {
   /**
    * {@inheritdoc}
    */
+  #[\ReturnTypeWillChange]
   public function destroy($session_id) {
     return $this->wrappedSessionHandler->destroy($session_id);
   }
@@ -57,6 +59,7 @@ public function destroy($session_id) {
   /**
    * {@inheritdoc}
    */
+  #[\ReturnTypeWillChange]
   public function gc($max_lifetime) {
     return $this->wrappedSessionHandler->gc($max_lifetime);
   }
@@ -64,6 +67,7 @@ public function gc($max_lifetime) {
   /**
    * {@inheritdoc}
    */
+  #[\ReturnTypeWillChange]
   public function open($save_path, $session_id) {
     return $this->wrappedSessionHandler->open($save_path, $session_id);
   }
@@ -71,6 +75,7 @@ public function open($save_path, $session_id) {
   /**
    * {@inheritdoc}
    */
+  #[\ReturnTypeWillChange]
   public function read($session_id) {
     $value = $this->wrappedSessionHandler->read($session_id);
     $this->readSessions[$session_id] = $value;
@@ -80,6 +85,7 @@ public function read($session_id) {
   /**
    * {@inheritdoc}
    */
+  #[\ReturnTypeWillChange]
   public function write($session_id, $session_data) {
     // Only write the session when it has been modified.
     if (isset($this->readSessions[$session_id]) && $this->readSessions[$session_id] === $session_data) {
diff --git a/core/lib/Drupal/Core/Template/Attribute.php b/core/lib/Drupal/Core/Template/Attribute.php
index cbbe1657f6..9d0bcc16c0 100644
--- a/core/lib/Drupal/Core/Template/Attribute.php
+++ b/core/lib/Drupal/Core/Template/Attribute.php
@@ -369,6 +369,7 @@ public function storage() {
    * @return string
    *   The safe string content.
    */
+  #[\ReturnTypeWillChange]
   public function jsonSerialize() {
     return (string) $this;
   }
diff --git a/core/modules/migrate/src/Audit/AuditResult.php b/core/modules/migrate/src/Audit/AuditResult.php
index d5260775e1..70252043c4 100644
--- a/core/modules/migrate/src/Audit/AuditResult.php
+++ b/core/modules/migrate/src/Audit/AuditResult.php
@@ -139,6 +139,7 @@ public function __toString() {
    *
    * @return string[]
    */
+  #[\ReturnTypeWillChange]
   public function jsonSerialize() {
     return $this->reasons;
   }
diff --git a/core/modules/system/tests/modules/session_test/src/Session/TestSessionHandlerProxy.php b/core/modules/system/tests/modules/session_test/src/Session/TestSessionHandlerProxy.php
index 2d2999e335..a4e28b640a 100644
--- a/core/modules/system/tests/modules/session_test/src/Session/TestSessionHandlerProxy.php
+++ b/core/modules/system/tests/modules/session_test/src/Session/TestSessionHandlerProxy.php
@@ -37,6 +37,7 @@ public function __construct(\SessionHandlerInterface $session_handler, $optional
   /**
    * {@inheritdoc}
    */
+  #[\ReturnTypeWillChange]
   public function open($save_path, $name) {
     $trace = \Drupal::service('session_test.session_handler_proxy_trace');
     $trace[] = ['BEGIN', $this->optionalArgument, __FUNCTION__];
@@ -48,6 +49,7 @@ public function open($save_path, $name) {
   /**
    * {@inheritdoc}
    */
+  #[\ReturnTypeWillChange]
   public function close() {
     $trace = \Drupal::service('session_test.session_handler_proxy_trace');
     $trace[] = ['BEGIN', $this->optionalArgument, __FUNCTION__];
@@ -59,6 +61,7 @@ public function close() {
   /**
    * {@inheritdoc}
    */
+  #[\ReturnTypeWillChange]
   public function read($session_id) {
     $trace = \Drupal::service('session_test.session_handler_proxy_trace');
     $trace[] = ['BEGIN', $this->optionalArgument, __FUNCTION__, $session_id];
@@ -70,6 +73,7 @@ public function read($session_id) {
   /**
    * {@inheritdoc}
    */
+  #[\ReturnTypeWillChange]
   public function write($session_id, $session_data) {
     $trace = \Drupal::service('session_test.session_handler_proxy_trace');
     $trace[] = ['BEGIN', $this->optionalArgument, __FUNCTION__, $session_id];
@@ -81,6 +85,7 @@ public function write($session_id, $session_data) {
   /**
    * {@inheritdoc}
    */
+  #[\ReturnTypeWillChange]
   public function destroy($session_id) {
     return $this->sessionHandler->destroy($session_id);
   }
@@ -88,6 +93,7 @@ public function destroy($session_id) {
   /**
    * {@inheritdoc}
    */
+  #[\ReturnTypeWillChange]
   public function gc($max_lifetime) {
     return $this->sessionHandler->gc($max_lifetime);
   }
diff --git a/core/tests/Drupal/Tests/StreamCapturer.php b/core/tests/Drupal/Tests/StreamCapturer.php
index 9b8925723a..4d71bc7505 100644
--- a/core/tests/Drupal/Tests/StreamCapturer.php
+++ b/core/tests/Drupal/Tests/StreamCapturer.php
@@ -9,6 +9,7 @@ class StreamCapturer extends \php_user_filter {
 
   public static $cache = '';
 
+  #[\ReturnTypeWillChange]
   public function filter($in, $out, &$consumed, $closing) {
     while ($bucket = stream_bucket_make_writeable($in)) {
       self::$cache .= $bucket->data;
