Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:130011 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 6B10F1A00BC for ; Wed, 4 Feb 2026 16:03:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1770221009; bh=iAPxrx491byNRqYTzOj63l3UBBzHDzoJYaCuEFEYbgk=; h=Date:From:To:In-Reply-To:References:Subject:From; b=gTYud5kRNGO94m4cQ/q/2c7GrfTf5uQ0Y0p8OBgXopu12YDzFM12HpA94YGODdibc ebJ+ZZvldPIDE8e6d4ov2dHsyrSB10Qa26o1L1UV47E6SQwxM4NlxIMO5jCvGIVjUd 6ZlkZLk9CuXYBGBqSTRPmY2w6szaE+A4bFMOtKO+ybhu1FJe6X+QoGMuFKUsJW8bq8 Ts76GkRF/67WgzbsZHdv6+3TwwYIBqbZPwLMh0n7MYQTTO1uDfuQLhn9AqU5CLEnIi EkVl7S27J2zB2rsQU9NwvZGbXMBUSmHqGfRycSG2cFlCrIEuuy6b/t7f9UlsZcO3Wl nzb2Q17hw0Aag== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4CFA118007E for ; Wed, 4 Feb 2026 16:03:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from fhigh-a2-smtp.messagingengine.com (fhigh-a2-smtp.messagingengine.com [103.168.172.153]) (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 ; Wed, 4 Feb 2026 16:03:28 +0000 (UTC) Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfhigh.phl.internal (Postfix) with ESMTP id 907A014001E6 for ; Wed, 4 Feb 2026 11:03:22 -0500 (EST) Received: from phl-imap-02 ([10.202.2.81]) by phl-compute-04.internal (MEProxy); Wed, 04 Feb 2026 11:03:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to; s=fm3; t=1770221002; x=1770307402; bh=4uh+2Sy7YfQJnZree4x+1 d+v7xdJu2roD/JXT2gRelw=; b=ZdRuPB/+EKzmw7LpRULUX+x9xF2IZgihEw/rn 4NvqN7WeCV48SVykYOKUSWNniMo4ogC+tL7dv8rfVeURhulVlL6lYj5XuXqr0r9U XmhYWOZfCJd6G6hTZov7BlzC9Aqm3AhHwMRMkGcTSE2pS7NlEc8VtF1ECBNr+n9x Lrc7PSmC8fyiAGeN6kLbDFpXHxSEeGQ0qwnBXRUQvEFcOYPqDQZh/MzgRf+EUgGF bHPGdzADsSi/f2c4N458rJIj4mDVu5WIyQNxmVftefE9D37SteCl4Cs7YOwN4Ld9 u0xUC0vltPO+8SrMTRbzGUEHmtH+l0cuEoDJAlptOMOeiD2VA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1770221002; x=1770307402; bh=4 uh+2Sy7YfQJnZree4x+1d+v7xdJu2roD/JXT2gRelw=; b=RtevugQWFAA0JzXV2 LO4c/1PuUrK1TKxHqyOo6GnIEQguWpCqnyHDXH2Lk23rUIHEkzldSe+mkZX9LSvB BZzm5t7I7l6HmRHUWxHGYv3Wbt89OK+kr2xZ/wgfQjvO+L67Igm0fmKqq3sqbGbf XKDi4y9fm6GYHv0iSZwQZLVUDs9XaBa3roKxFBngVPlc7fxxlmuqA2FUOfvtgoid K5JIFNE8Cdv5e9xfCAgLqjzBloQjbwKcQoDEKhZxVkBd78E56OGcJE2HZhTlKOS0 vgkd4GJQtUjPl/zn+QdD81hVLzy7SWSh9ue38lNIFT8ln51ObLkgk9q0ISJWn0x1 2sFPw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddukedvkeejucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepofggfffhvffkjghfufgtgfesthhqredtredtjeenucfhrhhomhepfdfnrghrrhih ucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhmqe enucggtffrrghtthgvrhhnpeeugfetieejueevffdulefhhfethfekvedtueevgfffvdef iedvtefgheevteelffenucffohhmrghinhepphhhphdrnhgvthenucevlhhushhtvghruf hiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehlrghrrhihsehgrghrfhhivghl ughtvggthhdrtghomhdpnhgspghrtghpthhtohepuddpmhhouggvpehsmhhtphhouhhtpd hrtghpthhtohepihhnthgvrhhnrghlsheslhhishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 5E85D700069; Wed, 4 Feb 2026 11:03:22 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 X-ThreadId: AfZXaYjx4nV3 Date: Wed, 04 Feb 2026 10:03:01 -0600 To: "php internals" Message-ID: In-Reply-To: <49ea913a-abdc-4af2-8335-65cb2d5805ab@gmail.com> References: <49ea913a-abdc-4af2-8335-65cb2d5805ab@gmail.com> Subject: Re: [PHP-DEV] Suggest new operator like with in c# Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: larry@garfieldtech.com ("Larry Garfield") On Wed, Feb 4, 2026, at 9:50 AM, Ivan Borzenkov wrote: > Hello > > As i read in https://wiki.php.net/rfc/howto write here =E2=80=9Cconcep= t=E2=80=9D. > > For fill dto and other same objects need assign to many fields of on=20 > object, before properties was be use return $this=C2=A0 in setters and= code=20 > loos like this > > $item > =C2=A0 =C2=A0 ->setType(Item::TYPE_CLOUT) > =C2=A0 =C2=A0 ->setProduct($product) > =C2=A0 =C2=A0 ->setPrice($price) > > and it was single operator, but it not work with simple property or=20 > get-set function need write > > $item->type =3D Item::TYPE_CLOUT; > $item->product =3D $product; > $item->price =3D $price; > > suggest add operator like with in c# which do action and back context=20 > back and use for example :> > same assign will be look like this > > $item > =C2=A0 =C2=A0 :>type =3D Item::TYPE_CLOUT > =C2=A0 =C2=A0 :>product =3D $product > =C2=A0 =C2=A0 :>price =3D $price > ; These days, such objects usually have promoted properties in their const= ructor, and we have named arguments, which allows this already: readonly class Item { public function __construct( public int $type, public Product $product, public float $price, ) {} } $item =3D new Item( type: Item::TYPE_CLOUT,=20 product: $product,=20 price: $price ); In what way is that insufficient? True it only works on the constructor= , but commonly such objects are only assigned to in the constructor. --Larry Garfield