From bb6220f832e9cc4c1c0878b479da3cdb5de40aa8 Mon Sep 17 00:00:00 2001 From: lacatoire Date: Thu, 5 Feb 2026 13:09:27 +0100 Subject: [PATCH] Clarify that exceptions cannot be cloned Fixes #3418 --- language/exceptions.xml | 2 +- language/predefined/exception/clone.xml | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/language/exceptions.xml b/language/exceptions.xml index 3e25163b1b3f..7b5bf7f070a8 100644 --- a/language/exceptions.xml +++ b/language/exceptions.xml @@ -419,7 +419,7 @@ class Exception implements Throwable public function __construct($message = '', $code = 0, ?Throwable $previous = null); - final private function __clone(); // Inhibits cloning of exceptions. + private function __clone(); // Inhibits cloning of exceptions. final public function getMessage(); // message of exception final public function getCode(); // code of exception diff --git a/language/predefined/exception/clone.xml b/language/predefined/exception/clone.xml index 527f9b90bd0f..a76b97ce4a83 100644 --- a/language/predefined/exception/clone.xml +++ b/language/predefined/exception/clone.xml @@ -12,10 +12,13 @@ private voidException::__clone - - Exceptions cannot be cloned, - and attempting to do so will throw an Error. - + + + Exceptions cannot be cloned. + Attempting to clone an exception will throw an + Error. + + @@ -51,7 +54,10 @@ 8.1.0 - Exception::__clone is no longer final. + Exception::__clone is no longer + final. However, exceptions still cannot + be cloned; the final modifier was removed + because private final is logically redundant.