On Thursday, 21 November 2024 at 10:05, Christian Schneider <cschn...@cschneid.com> wrote:
> Am 14.11.2024 um 22:27 schrieb Gina P. Banyard intern...@gpb.moe: > > > Agreed, this bites us constantly when needing to reason about what an > > "object" is in PHP. > > Similar to array it mixes the concept of a struct, with that of a reference > > value, and "overloading" various behaviours (e.g. iterators and > > ArrayAccess). > > It is extremely simple to go from foreach ($object as $prop) {} to > > forearch(get_object_vars($object) as $prop) {} > > and mandating this would resolve a lot of complexity, be that from the > > perspective of what is "possible" or not to do, and from an engine PoV. > > > Is there (currently) a difference between > foreach ($obj ...) > and > foreach (get_object_vars($obj) ...)? > > If there is then the migration is not always "extremely" simple, no? > If there isn't then we can simply define that from now on the former is > equivalent to the second one and ignore future changes to visibility, hooks > etc. > > My main point is that over the last years a lot of (for our code unnecessary) > complexity was added but I hardly complained because other people have other > needs. I just ask for similar consideration in return when stripping stuff. There is not, see: https://3v4l.org/T7tSu/rfc#vgit.master Best regards, Gina P. Banyard