Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112303 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 60485 invoked from network); 26 Nov 2020 18:01:03 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 26 Nov 2020 18:01:03 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D08D01804C6 for ; Thu, 26 Nov 2020 09:27:16 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: * X-Spam-Status: No, score=1.4 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_SOFTFAIL autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 26 Nov 2020 09:27:15 -0800 (PST) Received: by mail-lf1-f50.google.com with SMTP id j205so3524656lfj.6 for ; Thu, 26 Nov 2020 09:27:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=EG6z4+PEdwlWe1R1lrnIwy5uewxd94wHFr5C3QkSeX4=; b=bsWra7BIrLtSvx3fJ61BD8y9vxHEUClycEgO0z05INSki0YdZI+YjHtOgTGOnCcQ1v IVwcUmsexYQIad4QqHKIESHuH3PCTOCUi3dLQGM9N6RQghO6CFB5fcfzAncQx5MIq8tC HvdPi4ztTfOGNDeV9Zg54iVTQAncz3/BWxqkYnJRhZZSWh3bG6G8MuDRHFU/Seo/J2pq tmyH35ZVuCffJcT3UKoOWyl3q9Yr39E3BvMxF3C+Y0EGoh792+Y3iAf572JocoTOD1et QmBmbCFuS3CiPkQKybeJmkmOls0C+oWoElM1U0AsuWebrKUGQsIxajq4pCYTZYbX3KbP XiAA== X-Gm-Message-State: AOAM531YlMmjavNWU3BkvWT+sV/nI0vQcKduURmZ07ITtCuPDLtHF1SY 0TnYlIwC6A06x5mt3a2xb9fnzD/qzGIn1M2/o3pdmiXNVbjnnQ== X-Google-Smtp-Source: ABdhPJxv/e9vzL5bSrWUrFs9lY1h94K8Rs0JIxEU+5sskBjowmABL8QkrxRsIlq9Qf3Wc/lAi2uKMvWJVTVvC1fxOyc= X-Received: by 2002:a19:80c7:: with SMTP id b190mr1886203lfd.208.1606411631672; Thu, 26 Nov 2020 09:27:11 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 26 Nov 2020 11:27:00 -0600 Message-ID: To: "Pierre R." Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000ab551005b505dab5" Subject: Re: [PHP-DEV] Method parameter promotion support From: pollita@php.net (Sara Golemon) --000000000000ab551005b505dab5 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Nov 26, 2020 at 10:43 AM Pierre R. wrote= : > Le 26/11/2020 =C3=A0 17:30, David Rodrigues a =C3=A9crit : > > It is just an idea to discuss. PHP 8 now supports parameter promotion via > > constructor. Could this idea also work for common methods? > > > > public function setAge(private int $age) {} > > =3D=3D=3D > > private int $age; > > public function setAge(int $age) { $this->age =3D $age; } > > It sounds weird for me, Same. I'd also add that for solving this problem (boilerplate accessors), I'd much rather see us adopt C# like accessor methods and/or offer something like the expressive methods that Larry suggested a couple weeks ago. Both of those have a more generalized path to addressing this, IMO. -Sara --000000000000ab551005b505dab5--