Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117153 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 23486 invoked from network); 27 Feb 2022 14:01:22 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 27 Feb 2022 14:01:22 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id ED7631804D9 for ; Sun, 27 Feb 2022 07:22:06 -0800 (PST) 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.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS19151 66.111.4.0/24 X-Spam-Virus: No X-Envelope-From: Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) (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 ; Sun, 27 Feb 2022 07:22:06 -0800 (PST) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 04C085C0108 for ; Sun, 27 Feb 2022 10:22:06 -0500 (EST) Received: from imap43 ([10.202.2.93]) by compute5.internal (MEProxy); Sun, 27 Feb 2022 10:22:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=RIGuduyVcwVkRL9ei Kax7Bfmk+JCG8kciWLchFjIbck=; b=HbbAkPmX1PgBs7hVP58+/9D/mV8jJT9Lk W0G/Ybb0CjMYEFegRom02ntPG97gx0cwVWS4qWHGJoQ7UDtA8GppMkXgWUVw7w0m Vf1kST09/s95O8u36NkOdJj4vyA8KHB2nUTbHl3hFOOjvVoF0sHnYkEExfnJlN4D m38JV1tnnaJKeBo3VAzOmxWLKUwjIvPMU20yeVW74cyGhMFiX70zqnmcp4/q+yTU pOCfV5tnjd8fTsmy4Fh4XMKDlB1qj0O+RzlKm6oPKGTJGmH4AzfTrpKA3VWcgYGo uofZZJMqb3Km92n/FkEfKX1sbVplXS3WLPTi3Gzv+8L6IJo6a+Qjg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrleekgdejgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvufgtsehttdertderredtnecuhfhrohhmpedfnfgrrhhr hicuifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomh eqnecuggftrfgrthhtvghrnhepgeelgfekudeivddvteffueejffdthfejieevhefgffek udevkedtvdelvddvffefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomheplhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhm X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id AFC03AC0E99; Sun, 27 Feb 2022 10:22:05 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-4778-g14fba9972e-fm-20220217.001-g14fba997 Mime-Version: 1.0 Message-ID: In-Reply-To: References: Date: Sun, 27 Feb 2022 09:21:43 -0600 To: "php internals" Content-Type: text/plain Subject: Re: [PHP-DEV] Interface for reflection entities who implements getAttributes method From: larry@garfieldtech.com ("Larry Garfield") On Fri, Feb 25, 2022, at 4:57 PM, DANIEL VARGAS MUCCILLO wrote: > Hi Internals, hope you are all well. > > I've been playing around with Attributes and found that the only > way for safely type hint for reflection entities who implement the > getAttributes method is the following union: > > ReflectionClass|ReflectionClassConstant|ReflectionFunctionAbstract|ReflectionParameter|ReflectionProperty >> $reflectionEntity > > > For a single use case this was ok, but i would like to survey if > people here would be interested in the introduction of a interface > against which we could correctly ensure, with less effort, that > getAttribute is available. > > I believe that it would be something along the lines of: > >> interface AttributeReflector { > > public function getAttributes(?string $name = null, int $flags = 0): >> array; > > } > > > I have no experience with the PHP's source code, but if you think > that it's a good idea I would like to propose an RFC along with a PoC > patch to make this adition. > > Thanks for your time until now and all the good work I've seen here. > > -- > Daniel Vargas Muccillo I've run into this problem as well. I *think* all Reflector children support attributes, so it may not need a separate interface. However, the entire Reflection class hierarchy is a mess and needs a number of additional interfaces added to it generally. It makes sense to overhaul it holistically to make sure it all fits together. I have zero availability until mid-March, but I'm open to helping at that point. --Larry Garfield