Re: [RFC][Dynamic class constant fetch]
| From: | Bruce Weirdan | Date: | Fri, 04 Nov 2022 20:05:48 +0000 |
| Subject: | Re: [RFC][Dynamic class constant fetch] | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-118970@lists.php.net to get a copy of this message | ||
On Fri, Nov 4, 2022 at 10:49 AM Marco Pivetta <ocramius@gmail.com> wrote:
> What's convenient about
Foo::{$bar} vs
> `constant(Foo::class . '::' .
> $bar)`? I'm a bit confused by this :|
From the static analysis POV Foo::{$bar} is way better, as we can immediately
see that the code is trying to access a constant of a specific class,
and we can,
e.g., flag those operations that did not validate that $bar actually exists
as a Foo constant.