Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108938 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 73358 invoked from network); 10 Mar 2020 08:07:16 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 10 Mar 2020 08:07:16 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 877B81804E6 for ; Mon, 9 Mar 2020 23:28:04 -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 23:28:02 -0700 (PDT) Date: Tue, 10 Mar 2020 06:27:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=default; t=1583821680; bh=SWXS6qOIQmAGM8mxZeRsvTk/yWvIymb0QtxyJRRDkxc=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References: Feedback-ID:From; b=C/OK5skupoUBZTJBQ2A6sFQ7EWMh3KEe5E5IcGR5/5KEpHWIGzj9sEoY8WS38SVEv KNVmLJp0RtHJ1AT0T2ldMXSroShS9v7O1LiIRnFM16a1IOKBHoes/yIBWX7KJNzoxi gdeB/Q5gROCI3EPhm2+xP+eonmnJ1blnBTS9hf84= 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.