On Thursday, 21 November 2024 at 10:05, Christian Schneider
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
Am 14.11.2024 um 22:27 schrieb Gina P. Banyard :
> 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 ArrayAcces
I absolutely agree that unpacking objects to functions is a bad idea,
my use case for this is different.
Take for example that you have API endpoint that returns user balance
```php
readonly class Balance
{
public function __construct(
public float $debt,
public float $credit,
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
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,
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
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
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