Re: [PHP-DEV] [Discussion] Make objects unpackable by default

2024-11-14 Thread MrMeshok
I do know about get_object_vars, but for me foreach ($object as $prop) {} looks nicer and a little bit faster (probably because there are no function calls). Also it's more flexible because in future you can implement an Iterator on class and alter iteration behavior. But after reading through http

Re: [PHP-DEV] [Discussion] Make objects unpackable by default

2024-11-14 Thread Gina P. Banyard
On Thursday, 14 November 2024 at 17:24, Larry Garfield wrote: > On Thu, Nov 14, 2024, at 7:37 AM, Christian Schneider wrote: > > > Am 14.11.2024 um 10:59 schrieb Marco Pivetta ocram...@gmail.com: > > > > > On Thu, 14 Nov 2024, 11:29 MrMeshok, ilyaorlov...@gmail.com wrote: > > > > > > > Hello,

Re: [PHP-DEV] [Discussion] Make objects unpackable by default

2024-11-14 Thread Larry Garfield
On Thu, Nov 14, 2024, at 7:37 AM, Christian Schneider wrote: > Am 14.11.2024 um 10:59 schrieb Marco Pivetta : >> On Thu, 14 Nov 2024, 11:29 MrMeshok, wrote: >>> Hello, Internals! >>> >>> As you know if you try to unpack a regular object (`...$object`) you will >>> get an error: Only arrays and T

Re: [PHP-DEV] [Discussion] Make objects unpackable by default

2024-11-14 Thread Christian Schneider
Am 14.11.2024 um 10:59 schrieb Marco Pivetta : > On Thu, 14 Nov 2024, 11:29 MrMeshok, wrote: >> Hello, Internals! >> >> As you know if you try to unpack a regular object (`...$object`) you will >> get an error: Only arrays and Traversables can be unpacked. >> I don't really see a reason for this

Re: [PHP-DEV] [Discussion] Make objects unpackable by default

2024-11-14 Thread Marco Pivetta
On Thu, 14 Nov 2024, 11:29 MrMeshok, wrote: > Hello, Internals! > > As you know if you try to unpack a regular object (`...$object`) you will > get an error: Only arrays and Traversables can be unpacked. > I don't really see a reason for this restriction, because foreach on > objects works perfec

[PHP-DEV] [Discussion] Make objects unpackable by default

2024-11-14 Thread MrMeshok
Hello, Internals! As you know if you try to unpack a regular object (`...$object`) you will get an error: Only arrays and Traversables can be unpacked. I don't really see a reason for this restriction, because foreach on objects works perfectly fine, so I made a feature request on GitHub to change