Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127380 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id 8241C1A00BC for ; Thu, 15 May 2025 15:32:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1747323004; bh=aYgq5fHHAYuiz9nPOLgxKHLCmS9j6ye6BGHAeC0tGLo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=izqLyGATOOb2r6gBWfyCsZ7NJ07LooIWORMhkLLEFp5l59kdxJv7X0cGoohfL+k3s vB6cdxVx55Ow4Wn270CNbrFuLvS49i/O+jfD7vims/gA/m4f0jsmbE8Bnf6N6HR9D+ T6PvdM/BGIbk+xpVAF5cjM5HDACIJPvbEUUpRb55YDYqzHoaXHpnnBEsB3D0DPy084 24EYY+ko1WIRL6Fb3d4TeRjhse7dcNjKPtFLnv0JQGXTbHEc7iv7QMtS9OvRCWgGtZ +lCNjknrl/CSZlDhevBp4aKcpnaMR0fjNvj/6cPXj+nu7sqPJqZi6x8skJ8bbiU1yD tjJ7HA0Tc6l0A== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 738321801D6 for ; Thu, 15 May 2025 15:30:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 15 May 2025 15:30:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1747323132; bh=DS90+UozhDYzzg0afc6kiU2RzAUfuNOqLpH7E7WzgS0=; h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References: Message-ID:Content-Type:from:to:cc:subject:message-id; b=ob2L4o08VaYAb5l2e0cnqmEGDmrLkpL1ARrL1QEGaadbXWXRnhSkvWLANxyvs3hR/ nbRWRCA8A+TnMGP8uRCAnzvcXOaL3cjRE9ujMS8/DFlIFb1dEuDSkUqi8F1WFIFhJx HGevpZbGiJY+IM6eM0VvPI4BTpIBB2J/P6U9nolZmhk5VZsGDTAO0z2QP5BhzBocEI PHnIgVB9ISqFoYjA8+DNChMMy0L6+Nv5eP2Njgu57lkTTh8ipvHd/JJBOOVfpqKizR 27iLfOO+ddU3Om9Loq2AGkE+TygPBPRHGkY3VRVvuwx4PInejUMW89jraNuJqfXznS 12OYEXqqkdWBQ== Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Date: Thu, 15 May 2025 17:32:11 +0200 To: Rob Landers Cc: Stephen Reay , Andreas Hennings , Volker Dusch , Matthew Weier O'Phinney , php internals Subject: Re: [PHP-DEV] [RFC] Clone with v2 In-Reply-To: <74fde04e-1cbf-423c-8b50-7d7eb156a056@app.fastmail.com> References: <266FA35A-15B0-435E-BBFE-1C6926EB0B7E@koalephant.com> <74fde04e-1cbf-423c-8b50-7d7eb156a056@app.fastmail.com> Message-ID: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=C3=BCsterhus?=) Hi Am 2025-05-15 14:14, schrieb Rob Landers: > For example, if you have a Money type, you'd want to be able to ensure > it cannot be negative when updating via `with()`. This is super > important for ensuring constraints are met during the clone. That's why the assignments during cloning work exactly like regular property assignments, observing visibility and property hooks. The only tiny difference is that an “outsider” is able to change a `public(set) readonly` property after a `__clone()` method ran to completion and relied on the property in question not changing on the cloned object after it observed its value. This seems not to be something relevant in practice, because why would the exact value of the property only matter during cloning, but not at any other time? Best regards Tim Düsterhus