Re: [RFC] Undefined Property Error Promotion
| From: | Guilliam Xavier | Date: | Wed, 06 Apr 2022 12:53:06 +0000 |
| Subject: | Re: [RFC] Undefined Property Error Promotion | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-117483@lists.php.net to get a copy of this message | ||
Hi Mark,
https://wiki.php.net/rfc/undefined_property_error_promotion
>
[note: the RFC Date has a +1 on the year]
I'm in favor for "fixed" classes (with all properties declared and no
__get() magic method),
but somewhat mixed for stdClass: as you said, it can come from a
json_decode() by default or an (object)$array cast, and is kind of
"interchangeable" with array (which can come from a
json_decode() with
associative: true / flags: JSON_OBJECT_AS_ARRAY or an
(array)$object
cast);
as such, I wonder if it wouldn't make more sense to rather handle undefined
properties *on stdClass* together with undefined *array keys*?
(the reasoning could even be extended to classes annotated with the
#[AllowDynamicProperties] attribute...)
Regards,
--
Guilliam Xavier