Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112298 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 50885 invoked from network); 26 Nov 2020 17:04:27 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 26 Nov 2020 17:04:27 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4CA2B180511 for ; Thu, 26 Nov 2020 08:30:40 -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=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-oi1-f176.google.com (mail-oi1-f176.google.com [209.85.167.176]) (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 08:30:39 -0800 (PST) Received: by mail-oi1-f176.google.com with SMTP id o25so2840577oie.5 for ; Thu, 26 Nov 2020 08:30:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=5F859jk6Pj0b6JGaNyfe7H9nQVoyl01v1mSgbAwNGUE=; b=hnnPJ6h3rUJ8hP18ZCTepfT7pcvrkV2hM2RFnSS3c3H82pLmWlhFKeF4V7JLkKDPu/ yRYbI0VjXmu6Fcg80RTmqgzLULf78wpfyu+eRWFflpyxoVXnQx3exL/NoSNEOjuxY3HI rmriFhn5b1rbCMxFrdVAd2aVa22qq5iYC0eJrdH20gugElHL/LWrRSPpM5k4ayEDw2cu ESIibr8Gq8qehRjkNZ3zpkph5Y1vkz4A3qG/V4ZbOvaUXJmL5s1KFwlwx5p9+d6ynpHO OosHkeoBWdbbFdHlD0rQ90nMhUr36TkVchbnIoEevXA7BiHFkpHomLzvs7/QWgS8kNRG L71g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=5F859jk6Pj0b6JGaNyfe7H9nQVoyl01v1mSgbAwNGUE=; b=JUKNmswNZuqEJ9ZnqECgvYkC+xBJVUW22WC6NF8hLtJ/Yxkm7RyNEKsUgUGZ/3nKjM t1Nvb+z3KTXWUWxYwgaLQKY61hEm99VpW9kFO9xmQ2NdHF3lboF81DvlXrXN4M0vuOjL 6KYJRmJUJeVTihdb3mu5XdL3hlBgeH6ZoRTaxs7ZlzjtJJNRrDvAjiUfw2kTJCJp/R73 YZTtD8VqnsNBZzx5pfVfENdWvNHl+lnL3BQtUgfQf7x8WJ4Gw0H41qLyULyEon7VFjgv DY9aUp2+UmigwuwxebzdnbbllPre+I0Rtb0Ru82ROMiISlq+kKO99WujQjTCGlwCWeuJ kt4g== X-Gm-Message-State: AOAM530hEHtAryocVkwnvGUkIsXPG9ER0xAtbn463X3wM4zDXQ2t75nb sYwAQxRpylmqtuu4p7ymo67kUvAXMh+Ih7AFDZlUHd2UWJrWNw== X-Google-Smtp-Source: ABdhPJyHPNe0aziEWT3kv4QdSDxvGlQNFxSAsCHtj5WBtF3C5tQuigfGMakKaGDPiJo4JU4FG5zLpWSn0irjGXGVpN8= X-Received: by 2002:aca:ad89:: with SMTP id w131mr2425913oie.112.1606408236227; Thu, 26 Nov 2020 08:30:36 -0800 (PST) MIME-Version: 1.0 Date: Thu, 26 Nov 2020 13:30:23 -0300 Message-ID: To: PHP Internals Content-Type: multipart/alternative; boundary="00000000000048de7005b505100b" Subject: Method parameter promotion support From: david.proweb@gmail.com (David Rodrigues) --00000000000048de7005b505100b Content-Type: text/plain; charset="UTF-8" Hello! 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) {} === private int $age; public function setAge(int $age) { $this->age = $age; } The only problem I can see would be the difficulty of identification of the possible properties, since it would be necessary to check all method signatures to know about all possible properties. In this case, perhaps, it would be enough to allow the promotion only if the property already exists. private int $age; // Required. public function setAge(private int $age) {} Just to think about whether it is possible to think of something along these lines, but I'm still not sure if it's a good option. Atenciosamente, David Rodrigues --00000000000048de7005b505100b--