Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110461 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 48873 invoked from network); 10 Jun 2020 16:13:37 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 10 Jun 2020 16:13:37 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8338B1804CB for ; Wed, 10 Jun 2020 07:57:35 -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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS8075 40.80.0.0/12 X-Spam-Virus: No X-Envelope-From: Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11olkn2087.outbound.protection.outlook.com [40.92.20.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 10 Jun 2020 07:57:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XnKzbxx3bd1xpxl7I3kLJ/fSOlXFnpTcaWs5sAn8WqbvfA7QiZvMynVd0qv/+FWKxLCnk8o2JJaqVdoaVNJOII51sKHA3FdbzxNpLbts4xpTzVEjYSDGMlEI7+P3GH83aEsIiOt7dDo6OHZTwlRx+jevxjndmU/D0uzyzEN+qYUiEgYh1O9IxLOUH/mAyGUzM0iJYFPHj6llH684MfDkytS9toUOmp3ugBv64+rA2xiotN9eq4EEYbxUje8FZeto8nNeRR8EzYCjm8rz3wG0poC/axIsz39txa6pVcdA4dJegZSdzTA1y+RuveKrRhCQi0NfhE0EBbrMc0HbilryVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=r/aFHyWxmCPUTFzjGjUH8G3HpacWBGK1sK5HusEhiC0=; b=U0OY79e0GBSo0V1Ztg+5HmYBbD/AsIaUP/cz7n4w8bAYCzzELncLNpopJaKAZ9lZYwryTiT5yXxTr3PX+pAEGBckK2CfvJhhOu6B/EuPLuVIsP8hwMBXeqMPWLvdXMk9BWcHRQngnK8pJbr4+esjgfZxnvsE/OXzfshGi5vJw63FqMeiiOfxzZ2Sq2S3JoO1ntUDFj/oiBoQAUkmb2OpgkvIsyEdo7NKYtSj0xuph9u/KSG4gEO9dRI4DtjZ0RnDw7fKACuFqvLNtiamyGbeqCXKETDvLpv2NVcMTybrxK9t17pG0pcBW+j61aY9xFVN1DAnUDDtiJTWeLtAHe+eeQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=r/aFHyWxmCPUTFzjGjUH8G3HpacWBGK1sK5HusEhiC0=; b=LoS+ldsehGT7eJccfGKo4ggZuHsEw/l3fq13f4QKOmdT5hYbphyelzF6QUQG7uk5FpjusfvncLemukUo4NExStUnLrDjaOr5aSYCI0tdb4jFd0BDrwZk8WloEiEmtt93J5KMIgclYkuucmU1/apfnV/hC36R/zphjSmgj4TvrKENn2wvGGWKyPhUTFZg9v33LStq4pDLmk9Y21v3HVTlCPidUCnPWSjhZnEcCLEC4YjlkK4RABj3qvgU+Ig8GJroVX94YK+Dagr+eu1gdJF5VMqBAHh91reIIIbBPTmmWCH4WdIQXmgrZ4pYGuxb8JUAOgH+QQKBlz9yNZULAn0ocA== Received: from BN8NAM11FT040.eop-nam11.prod.protection.outlook.com (2a01:111:e400:fc4b::4d) by BN8NAM11HT030.eop-nam11.prod.protection.outlook.com (2a01:111:e400:fc4b::268) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18; Wed, 10 Jun 2020 14:57:33 +0000 Received: from BYAPR05MB6535.namprd05.prod.outlook.com (2a01:111:e400:fc4b::51) by BN8NAM11FT040.mail.protection.outlook.com (2a01:111:e400:fc4b::422) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18 via Frontend Transport; Wed, 10 Jun 2020 14:57:33 +0000 Received: from BYAPR05MB6535.namprd05.prod.outlook.com ([fe80::54e2:1eeb:fc5d:8c21]) by BYAPR05MB6535.namprd05.prod.outlook.com ([fe80::54e2:1eeb:fc5d:8c21%3]) with mapi id 15.20.3088.018; Wed, 10 Jun 2020 14:57:33 +0000 To: "internals@lists.php.net" Thread-Topic: [PHP-DEV] [RFC] Shorter attribute syntax Thread-Index: AQHWOgIv0rCwDWp4oECJgOMrWx9MxKjQNb8AgABDMVCAAOWKgIAAim+/ Date: Wed, 10 Jun 2020 14:57:33 +0000 Message-ID: References: ,<87fd9cef-1b54-2c8d-363b-f0d0535967e8@php.net> In-Reply-To: <87fd9cef-1b54-2c8d-363b-f0d0535967e8@php.net> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:2ED2BA79A242620704AC355D1288F45419A0D3199E973B77D1E94DFCB83E4739;UpperCasedChecksum:7562736BE3E214A1ED5AA620251CCE71004A331833246C04EB847AC6FB1CE249;SizeAsReceived:7080;Count:44 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [TX5cr5g71n0CF4Dt3bpeazK9UZ4nQ+Tl] x-ms-publictraffictype: Email x-incomingheadercount: 44 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: d751d381-34aa-4202-5602-08d80d4e9b33 x-ms-traffictypediagnostic: BN8NAM11HT030: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: dIHn5htBIpCOvtaOEf0TcRwF4xDlE1RVauuksjwODO8XDHeNPDJ5FRY7rH+AGzarkJhVD3NC+3XUjJRo2gnmaw4jmsb2a5AI9At2iMceJuhNcdhnpB24Am/pdPWURIT41xlhjx2OIM0Oh1wj2c7HaZF6CITWjOfWSRn/G8dw4WIUE8L6GUrd/A4NSN26z4eeJHZUAuYTIy5rCl9sgT2tgg== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:0;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR05MB6535.namprd05.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:;DIR:OUT;SFP:1901; x-ms-exchange-antispam-messagedata: fSLipamusBltgzEytKgqA/WQNporUPTFm58OJs2c8pWNL4P6szC03hcsX5KQL1SJRG12t3/DZvkUfLa+ujl9TmqJAptYgi99I+N5Z8nJCJ8tKaaGMwbxid4OjfMNVRWFBOflT+jnESU+r8TEt+KUhg== x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: d751d381-34aa-4202-5602-08d80d4e9b33 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Jun 2020 14:57:33.4508 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8NAM11HT030 Subject: Re: [PHP-DEV] [RFC] Shorter attribute syntax From: theodorejb@outlook.com (Theodore Brown) Hi Sebastian,=0A= =0A= On Wed, June 10, 2020 at 12:37 AM Sebastian Bergmann wr= ote:=0A= =0A= > Am 09.06.2020 um 17:57 schrieb Theodore Brown:=0A= > > That's an interesting argument. After thinking about it more, though,= =0A= > > I'm not sure I understand what the benefit would be. The docblock=0A= > > annotation needed for PHP 7 is *already* forward compatible with PHP 8.= =0A= > > So wouldn't this just be duplicating the attribute and opening the=0A= > > possibility for them to be out of sync for no benefit?=0A= > =0A= > This would allow the introduction of classes into PHPUnit such as=0A= > =0A= > namespace PHPUnit\Attribute;=0A= > =0A= > #[Attribute]=0A= > final class Covers=0A= > {=0A= > private string $coverageTarget;=0A= > =0A= > public function __construct(string $coverageTarget)=0A= > {=0A= > $this->coverageTarget =3D $coverageTarget;=0A= > }=0A= > =0A= > // ...=0A= > }=0A= > =0A= > that can be used to encapsulate information that may come from a ...=0A= > =0A= > /**=0A= > * @covers \Foo\Bar\Baz=0A= > */=0A= > =0A= > ... DocBlock-style annotation in PHP 7 but may also come from an ...=0A= > =0A= > #[Covers(Baz::class)]=0A= > =0A= > ... attribute when PHP 8 is used.=0A= > =0A= > This would make forward compatibility possible in code such as PHPUnit's = =0A= > that currently supports DocBlock-style annotations but wants to support= =0A= > PHP 8 attributes and to deprecate (and later remove) support for=0A= > DocBlock-style annotations.=0A= =0A= So is the idea that PHPUnit 10 would still run on PHP 7.x, but would=0A= also support native attributes for people running PHP 8? Maybe I'm=0A= missing something, but wouldn't this be possible with the `@@` syntax=0A= as well? The new `Covers` class would only be loaded if someone is=0A= using attributes on PHP 8, so it's fine if it uses new PHP 8 syntax.=0A= A parent class could be used to encapsulate coverage info for PHP 7.x.=0A= =0A= To me it seems like the benefit of having (single-line-only) PHP 8=0A= attributes treated as comments in PHP 7.x is being overblown. There=0A= is already an upgrade path for docblock annotations to attributes.=0A= Docblocks will continue working perfectly fine in PHP 8, so projects=0A= and libraries can wait as long as needed before migrating to the=0A= native attribute syntax.=0A= =0A= Using `#[]` as the attribute syntax actually runs the risk of making=0A= it *harder* for users to upgrade to PHP 8, since existing code that=0A= uses hash comments starting with a left bracket would break.=0A= =0A= Anyway, our plan is to hold a ranked-choice vote in the RFC between=0A= `@@`, `#[]`, and `<<>>` syntax options, so if people prefer the=0A= tradeoffs of borrowing Rust's syntax they can vote for it.=0A= =0A= Best regards, =0A= Theodore=0A=