Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111946 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 70313 invoked from network); 28 Sep 2020 13:57:22 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 28 Sep 2020 13:57:22 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E29A618050B for ; Mon, 28 Sep 2020 06:08:45 -0700 (PDT) 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.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (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 ; Mon, 28 Sep 2020 06:08:45 -0700 (PDT) Received: by mail-wm1-f42.google.com with SMTP id y15so1105274wmi.0 for ; Mon, 28 Sep 2020 06:08:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=beberlei-de.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=KgZiegX8KC5xBeaPyV4c4rbG0BwCUniWAAOVUP3c9Kg=; b=qS/rrXxtEjrRmrfPPPPlyCMi6ES2CewlcXcolE5hZSSU6gFqGcvPD/GRdc0v5ygH2+ dPZdWW7MUqAUYxVZZGufs6KUuoL9rt7ZXDfEKJRO2K2Y7Xg1NQtUeTiGi4ZXhrBhisAz gHxaiDpbMgfPEcUjGx3WRCSSSxlND5RXo9DI5/U55eHHb2jKQg7S26MdVzxwacLX4Frs N/4fzRfMnMnobf/uICnSM9YO8rtBAVZZM/0v2R2kO4KCxKqx/TLj/qPIeIBttkrIacHd 6cK8GEMlGo0f5pfEMqQ4lrbkz8XuryVf3JbpwZOM3ceWi7S8HYvNwwlUXytzWLN2AR9b uCFA== 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=KgZiegX8KC5xBeaPyV4c4rbG0BwCUniWAAOVUP3c9Kg=; b=duPc7KY+49TwJWxi3uec0FFj2AOiuxAhMvW+dXU/hQ3SqyCpxSpMY3IKZPcauibS+4 AoLzGr3hfGJXE7+QGnRv0P2C0OHiCel55dTGK8prvuaa03+6uq3ojerT6JaB+IMBTmuI TD6DsNwQk6gp92YIBsDjZgA3cJ1kDdsVus8VNvn9AexO1kwd7GmRN9tIeKQzJVUIz1CN Z/LF6AptbvYfi+Ym47Pxh6geJKY6za1V6+zKJHl76zVDO4xwQkYpedf2Cr75QL6moJcx DT9Y2rcddtLU+Z54ZOFnvwsLOJxoDqCf0BF+8l9kxrK5DZSNgf7ep8bSLxUlIdEsHE8w qEJQ== X-Gm-Message-State: AOAM531tW/A4UiHoZ7D/jD9Iox0OodRp3yj5914EygBtDB76Tsy0RwmO V0lQZ1G+ilSM5aFclocp4aKVy0ZRXvyqNsIWwKA6Ww== X-Google-Smtp-Source: ABdhPJx0qipZrWvDICCLMZ+n8VoMwiFjOCOiCjdMEYrnQoFxLrZm7k4F/rTm5jfzCLCwZmsrXgYPzue1Pz4ItOyNpoQ= X-Received: by 2002:a7b:c14d:: with SMTP id z13mr1547730wmi.107.1601298520978; Mon, 28 Sep 2020 06:08:40 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 28 Sep 2020 15:08:30 +0200 Message-ID: To: Benjamin Morel Cc: Nikita Popov , PHP internals Content-Type: multipart/alternative; boundary="00000000000085cc2f05b05f5d71" Subject: Re: [PHP-DEV] Re: Attributes and constructor property promotion From: kontakt@beberlei.de (Benjamin Eberlei) --00000000000085cc2f05b05f5d71 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Sep 28, 2020 at 2:25 PM Benjamin Morel wrote: > On Mon, 28 Sep 2020 at 13:56, Benjamin Eberlei > wrote: > > >> imho, we should pick the 80% use-case and advise to desugar the code if >> other behavior is desired. For me the 80% case is that the attribute onl= y >> applies to the property, not to the parameter. > > > +1 for the desugaring advice in this case, however as a matter of > consistency I'd rather have it either apply to both the property and the > parameter, or just throw an exception if used on promoted properties, > whatever the 80% use-case is (source?) > We should assume that there are very few attributes that make sense to apply to *both* a property and an argument. I can't find any good example where this makes sense. Library developers shouldn't be forced to allow target argument only that it works in the ctor promotion case. I assume the 80% case is properties, because attributes did not have docblock annotations yet, that means this use-case isn't even possible at the moment. Yet annotations on properties are widespread (Doctrine ORM, symfony validator, ...). > Kind regards, > =E2=80=94 Benjamin > --00000000000085cc2f05b05f5d71--