Re: [RFC][Under discussion] Fetch properties in const expressions
| From: | Ilija Tovilo | Date: | Wed, 15 Jun 2022 15:58:46 +0000 |
| Subject: | Re: [RFC][Under discussion] Fetch properties in const expressions | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-117953@lists.php.net to get a copy of this message | ||
Hi
> Just a question.
> Would this also be allowed?
>
> https://3v4l.org/RGdIA
> <?php
>
> class A {public int $i = 42;}
> const BARE_CONSTANT = new A;
> class B {
> const ClassConstant = BARE_CONSTANT;
> }
> class C {
> const ClassConstantViaPropertyFetching1 = BARE_CONSTANT->i;
> const ClassConstantViaPropertyFetching2 = B::ClassConstant->i;
> }
Yes, that would work fine.
Ilija