Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108928 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 84001 invoked from network); 9 Mar 2020 22:41:20 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 9 Mar 2020 22:41:20 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id DF0F21804D3 for ; Mon, 9 Mar 2020 14:02:02 -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.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS62371 185.70.40.0/24 X-Spam-Virus: No X-Envelope-From: Received: from mail-40130.protonmail.ch (mail-40130.protonmail.ch [185.70.40.130]) (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 ; Mon, 9 Mar 2020 14:02:01 -0700 (PDT) Date: Mon, 09 Mar 2020 21:01:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=default; t=1583787719; bh=SWXS6qOIQmAGM8mxZeRsvTk/yWvIymb0QtxyJRRDkxc=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References: Feedback-ID:From; b=sahgWmgsbqz8Hkw9JUSlIpvX4ds0aCu2h4fCbm/3Z1Eip3dLvZ3dni2mXP7Vs613u 8Um1LMD8RSK1YLS71HrXf4mRPz81eCqVGYcbNrJaoAVo9KF+0I8vJyoizQ3V7WrQ4X 1YnN6gK9oo49cjKZC/5XnkBMO24PY1dPzN0+5B38= To: Benjamin Eberlei Cc: PHP Internals Reply-To: Saif Eddin Gmati Message-ID: In-Reply-To: References: Feedback-ID: 2QbNVvXqZX7F9J8FTDAv0u3ryua4T0_lfklxZ8hRMzvBUxf8m8U50Gi9tVWG9V2LePU31MFOrVnxPKYLJjZPXw==:Ext:ProtonMail MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] Attributes v2 From: azjezz@protonmail.com (Saif Eddin Gmati) Really excited to see the discussion about this feature being brought up ag= ain, thanks for working on this :) One thing I would suggest is to add a base interface `Attribute` and multip= le sub-interfaces such as `ClassAttribute`, `MethodAttribute`, and `Propert= yAttribute` just like hack lang ( https://docs.hhvm.com/search?term=3DHH%20= Attribute ) This allows one to declare attributes that can only be used with classes ( = e.g `ORM\Entity` ), so PHP and check against them at runtime and throws an = error when an attribute is used in the wrong place. ```php namespace ORM { class Entity implements \ClassAttribute { ... } } namespace Foo { use ORM; <> // <-- Error function bar(): void {} } ``` I also question whether the following syntax would be supported: ```php <> class Use {...} ``` I'm really looking forward to this since it can help bring more features in= to PHP such as : - https://docs.hhvm.com/hack/attributes/predefined-attributes#__entrypoint - https://docs.hhvm.com/hack/attributes/predefined-attributes#__memoize - https://docs.hhvm.com/hack/attributes/predefined-attributes#__sealed Regards.