Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117139 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 23347 invoked from network); 25 Feb 2022 21:37:25 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 25 Feb 2022 21:37:25 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 95D54180505 for ; Fri, 25 Feb 2022 14:57:43 -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=0.8 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,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-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-qk1-f173.google.com (mail-qk1-f173.google.com [209.85.222.173]) (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 ; Fri, 25 Feb 2022 14:57:43 -0800 (PST) Received: by mail-qk1-f173.google.com with SMTP id f21so5765304qke.13 for ; Fri, 25 Feb 2022 14:57:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ufsm-br.20210112.gappssmtp.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=ASGz+PIlSR+Pfojagq5tV19Ql01d5p3RLWWh2CVmM0Y=; b=pM6F5KTaqRorjCV+X4WmA1C+QXGnLc9qXOGqSQoBFzsERfUIa2chqKBz3YTb5l2dcK Ns/lrJsrEz6b5bghLKmitnV2GTImnDJhzW9/H498KH+bmuovgBfA0K2YBuQR6qJGoeX1 65Fun93EWKLdc1efEeucpRTUqfmyM6IvWsfmeGnyPNdMX4aIg5spozpl3oEFWKSgvWJS AGcS0/5SIO3S0HM/mhdcncFuOI4m5ydOrJ75oM8QkZ3TW0fTe/k92yZ/d18pAy+RMZZj 6VW/q4hNWSMjLDH721eZE9rOLZtKlg5gUvwQI7JW+wzXVzF0Mutb0s4TZidoOGLuYun2 RoDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=ASGz+PIlSR+Pfojagq5tV19Ql01d5p3RLWWh2CVmM0Y=; b=bGVyIkeDrGrZ5DWX1Avw5s1RU40W2wVo+D9YJ6KjKF79xd6WXNKj2X4VI0C62oSajI G7tcYW0HHdKcQjIH747DcaeUFDvwDyjqKpkT/Ed1iQi/Q1k4d8ikBjY4ojRJkvQNgS0P 5/CnSkXnBOsLYWSXSww4HNyXdlQs6d22Qey0qNPkO0DPlJRDkdSozCqrD0FClZ9l8sWt O2Mcwhs5KgcPkjXxjdsqZ6JLrurxoYuPpjjNs2cvgutxh2n/xma2ZV4fCL+ebO3zG4TY STFIU/0mlCs9AyCizugxTxmr04wDyuVgmpzEPNfo6mJlluAMmKhEArhoIdfYoqvDtg76 19Kg== X-Gm-Message-State: AOAM531gVCLtKJBbjZIRqLQ3RCa35JvULu9D7xxYkTCC1dkhRnHPuJvi soU4YeNxlPGA990HSXX5kD3d7MMo/NH/CtoNplktdaq9IbfL+w== X-Google-Smtp-Source: ABdhPJy+dCoeVrvAL23TPd0Mgfy0gs599pNu2bsF6kDVuxLEBaN9QwdD5cOzoCpzmO7dJX3ppNdX8xCUKZZ4cvr33bI= X-Received: by 2002:a37:e303:0:b0:47d:7548:23fa with SMTP id y3-20020a37e303000000b0047d754823famr6406724qki.152.1645829862435; Fri, 25 Feb 2022 14:57:42 -0800 (PST) MIME-Version: 1.0 Date: Fri, 25 Feb 2022 19:57:31 -0300 Message-ID: To: internals@lists.php.net Content-Type: multipart/alternative; boundary="0000000000004ff24305d8dfa0dd" Subject: Interface for reflection entities who implements getAttributes method From: daniel.muccillo@ufsm.br (DANIEL VARGAS MUCCILLO) --0000000000004ff24305d8dfa0dd Content-Type: text/plain; charset="UTF-8" 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 --0000000000004ff24305d8dfa0dd--