Re: [RFC][Under discussion] Fetch properties in const expressions
| From: | Côme Chilliet | Date: | Mon, 30 May 2022 21:28:59 +0000 |
| Subject: | Re: [RFC][Under discussion] Fetch properties in const expressions | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-117839@lists.php.net to get a copy of this message | ||
Le 28 mai 2022 11:44:13 GMT+02:00, Ilija Tovilo <tovilo.ilija@gmail.com> a écrit :
>Hi everyone
>
>I'd like to start a discussion on a simple RFC to allow fetching
>properties in constant expressions.
>https://wiki.php.net/rfc/fetch_property_in_const_expressions
>
>The RFC proposes adding support for fetching properties in constant
>expressions using the -> operator. I'm looking forward to your
>feedback.
It is not clear to me why this allows using -> on enums but not on other objects.
Can you clarify why the following is not allowed:
<?php
$a = new Thing();
class C
{
protected $b = $a->var;
static $staticobj = new Thing();
function f($p = self::$staticobj->var) {}
}