From d04d1adce2c2a80172b5188c43039c9805da1ea5 Mon Sep 17 00:00:00 2001 From: lacatoire Date: Thu, 10 Sep 2026 16:20:56 +0200 Subject: [PATCH] cloning: visibility applies to all properties, readonly is orthogonal --- language/oop5/cloning.xml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/language/oop5/cloning.xml b/language/oop5/cloning.xml index 91e31b4b1551..fde59faeb549 100644 --- a/language/oop5/cloning.xml +++ b/language/oop5/cloning.xml @@ -168,10 +168,11 @@ echo (clone $dateTime)->format('Y'); The overrides are applied after __clone() has run, and they honour the - visibility of the properties: a - readonly - property can only be overridden from a scope that is allowed to write it, - which makes the function suited to methods returning a modified copy. + visibility of all properties. + Readonly + properties can be updated on the copy even if they were already set on the + original object, which makes the function suited to methods returning a + modified copy.