Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115318 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 49934 invoked from network); 6 Jul 2021 11:07:36 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 6 Jul 2021 11:07:36 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 98A811804DB for ; Tue, 6 Jul 2021 04:29:20 -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=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (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 ; Tue, 6 Jul 2021 04:29:20 -0700 (PDT) Received: by mail-wr1-f53.google.com with SMTP id v5so25670590wrt.3 for ; Tue, 06 Jul 2021 04:29:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=beberlei-de.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=UTPw6RAKbB4FNDG+IVDUcjQKram2ABJFodwabnlT+oA=; b=L87PmSuwi5MzgGkpgu7/dF4W7vxlaTxUunPhjJ7+xBUflPkcPNThWWRpOvDz97kzVO 2Btqb8wP84fmRPkSV4QHtpYKWdpYQSmzMiVNuy+yRLef6Sct6Xz18aJ4nv+7aT9gqYDj dUj9nuIa7oJUbmC4DTV1mlPzk3spFL2DQF7kD243O8FoKHC1NxLtXEk2l1cPBk35ntNj IWJIIGWDrUgC8FSLWYoKBqJYCzmbxgtn9bUNrJiBJKXI3XZszY9wTdxv0jPgIcoG5fkE 8Q2+rDdZhbxOXUeftbUZ2hBcMRkwgJ0PQ0gulguL8v091s0QgbiafIA/I59HNKccM4+8 Xsvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=UTPw6RAKbB4FNDG+IVDUcjQKram2ABJFodwabnlT+oA=; b=VqmDBnxml++cgyTZI+7DMXOjGsym1lHPiObM1/4jF0I8OLgI5acN83ya36W0yau5UD HBKPYDuMjuIDwDJLD4o9EKIcAuElNAwRuTTjs0ILm+60P9bDrRlxoROsTzd3VXUWrU7D omyUP6ez9+YYNFh284ohguqdyMYL7mmTN0Zk6gLAs+mHqTktdgthXZSOuVroN16pgLuu uCa2vP3pZUpU9S9es04WEzwtW5poje02hs1UJW0EinYP+QMd6h85fUixgS7kTtRucxt7 H4RFtnOg3zQt+Qc0QSj00usTNs+02Sm7fvHatW1ZIFpVC0h0WUwHXzNJFS7tZOoUytWP hb7g== X-Gm-Message-State: AOAM5309qo2LugX2HXJZqXS/P6RvsA54Lksb8JEWVz8bOps3ov5vzmzN 2/J+22H4qnGOyabT/JCFOC44bzADearGn86SAx8a4w== X-Google-Smtp-Source: ABdhPJwuKjXXwKI2BeD3SZt0AVXslVo/2sVyI3vJkgRGJuKqtWAvzFSXbQQbLm8v2bvUu7FEOrFEAHhCOY/i8Yb91I8= X-Received: by 2002:a5d:6a51:: with SMTP id t17mr21404241wrw.255.1625570959174; Tue, 06 Jul 2021 04:29:19 -0700 (PDT) MIME-Version: 1.0 References: <34e76830-043f-3bae-4d60-9871010da0ed@gmail.com> In-Reply-To: <34e76830-043f-3bae-4d60-9871010da0ed@gmail.com> Date: Tue, 6 Jul 2021 13:29:08 +0200 Message-ID: To: Rowan Tommins Cc: PHP Internals Content-Type: multipart/alternative; boundary="000000000000943c1605c672bb62" Subject: Re: [PHP-DEV] [Vote] New in initializers From: kontakt@beberlei.de (Benjamin Eberlei) --000000000000943c1605c672bb62 Content-Type: text/plain; charset="UTF-8" On Tue, Jul 6, 2021 at 12:58 PM Rowan Tommins wrote: > On 06/07/2021 11:31, Benjamin Eberlei wrote: > > This is not 100% correct, you can have an attribte #[Foo(Foo::class)] and > > then calling ReflectionAttribute::getArguments would also require to > > resolve the type Foo. So this is not different than what could happen > right > > now already. > > > Despite its name, "::class" doesn't care about class definitions, it > just performs a string substitution based on the "namespace" and "use" > statements in the current file. > > In most cases, that happens entirely at compile time, so the following > two source files compile identically: > Hah, I realized after sending the example was bad :) I should have used an example using actual constants (vs magic ones): #[Foo(Foo::BAR)] This would trigger autoloading and resolving during getArguments() > > Short form: > > namespace Somebody\Something; > #[ Foo( Foo::class ) ] > class Whatever {} > > Expanded form: > > namespace Somebody\Something; > #[ \Somebody\Something\Foo( '\Somebody\Something\Foo' ) ] > class Whatever {} > > > There is no need for the class \Somebody\Something\Foo to actually exist > in either case, the argument is just a string: > https://3v4l.org/bgNa2#v8.0.8 > > > Regards, > > -- > Rowan Tommins > [IMSoP] > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > > --000000000000943c1605c672bb62--