Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111948 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 78732 invoked from network); 28 Sep 2020 15:23:49 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 28 Sep 2020 15:23:49 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 6952D1804E3 for ; Mon, 28 Sep 2020 07:35:12 -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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,FREEMAIL_REPLY, 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-f175.google.com (mail-oi1-f175.google.com [209.85.167.175]) (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 07:35:11 -0700 (PDT) Received: by mail-oi1-f175.google.com with SMTP id z26so1507858oih.12 for ; Mon, 28 Sep 2020 07:35:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=v+k5FyNF8kNyFriExmlmygO7tFOanJ8/COheR7p+vVs=; b=GeVRUWnHKPi0MaJE8bP9z2o0T4cjAntoV543ArsKHCWnWYMWXp/Sq2oWqTiUP8RCaK nxhdTLzlzJ+D/fM81S6SStU+jL0h/B8FRWlIRqr7+2hL6g8aPK/bmTyXeiifPf/jHwT3 ruQvZ2WJnxb9CyN05sJbmhPfTsPSd1LDvegYyQ3tFybII9cVF0UD2hCMV6TAFM1TNiM2 Z2PZlXPC7+gBDevnaRORlEtyBSEAApp17Pv39w4Qb3LkaM25IMMFen3jv4IukiJ6G0aM wm8Y8l/VhN492ubQHJFRbQ9LxSb87p4CMLA73xtzz6J4S+RtdnvYq0ZpoZTVs4Pk+3Jt dIjA== 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=v+k5FyNF8kNyFriExmlmygO7tFOanJ8/COheR7p+vVs=; b=KZTw4315XfztylWVi3wxW18d7nILPqTSKnKcEpcrzXyvCBIOxvzxbih/gwmhVDUUCE sCp4LzQKx7HTMDvdW8pI6EG3bv9OEMmn2s21kD0Zu27OtVneeITumPNaFPyR0lN6V/dv 3wmGR8vC9M4So+8g9qpBnTl66kxIZQRA8qC2W/FAXDsNYx5r8zJjfktrAcoir6UrW5UI smyxNNyIMpLXRFo5fISdpbndeOSjZFkPKeq+I6hOVwaCSQDDJF2b0kl7/Rah4GRz3rjc B/W3nmhCD637nkSR8EdQPuOMmRtBeouezbfmreRjVe8nLTJ7bg8B570LxJelfzCiD/NE 46lw== X-Gm-Message-State: AOAM5304VNjeELicujUtRhT7+z9HLd9iVJuRMNj94yGci/kNh7PHirVw dWU1urp4Mk0jxcI2vmUBC7rObKpdloHV/iBL7Sk= X-Google-Smtp-Source: ABdhPJy8IOj8+t1GGUO88EudtrDn362SbbjeZ3GHAjkoa/VhAPa6FSylrenQt7RJzZPQADI1zrKIEfjWYM4xprgRtjs= X-Received: by 2002:aca:d493:: with SMTP id l141mr1121144oig.142.1601303706418; Mon, 28 Sep 2020 07:35:06 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 28 Sep 2020 16:34:55 +0200 Message-ID: To: Nicolas Grekas Cc: Benjamin Eberlei , Nikita Popov , PHP internals Content-Type: multipart/alternative; boundary="0000000000009944be05b060921c" Subject: Re: [PHP-DEV] Re: Attributes and constructor property promotion From: benjamin.morel@gmail.com (Benjamin Morel) --0000000000009944be05b060921c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, 28 Sep 2020 at 15:17, Nicolas Grekas wrote: > I assume the 80% case is properties, because attributes did not have >> docblock annotations yet, that means this use-case isn't even possible a= t >> the moment. Yet annotations on properties are widespread (Doctrine ORM, >> symfony validator, ...). >> > > I'm 100% with Benjamin here, this is what will be the most useful to me > also. > To be clear, I don't have a strong opinion against yours, I'm just pointing out the fact that even though it might be useful, it might also be confusing and create yet another WTF moment in PHP for developers. Sure, it might make more sense to apply to the property. Sure, so far annotations weren't possible on parameters. But is that obvious to the average developer writing the attribute? A few years down the road, DI containers may have broad support for annotating parameters for injection. Will it still be obvious then that an attribute on a promoted property applies to the property only? I do agree that applying the attribute to both the property and the parameter will probably never be useful, though. So, throwing an exception and forcing the de-sugaring feels like the most sensible thing to do for me in this case! =E2=80=94 Benjamin --0000000000009944be05b060921c--