Benjamin said:
(...) Regarding your suggestion, unfortunately not, (array) also returns
> default values for properties:
Marco said:
Yes, but that's where you should unset all properties upfront:
> class A {
> protected $a = 1;
> }
> $r = new ReflectionClass('A');
> $a = $r->newInstanceWithoutConstructor();
> (function (A $a) { unset($a->a); })->bindTo(null, A::class)($a);
> print_r((array) $a);
> Array
> (
> )
Ah, genius! I did not think we could already use Closures for this.
Scratch that then, there is no need for an extra feature 👍
<https://emojipedia.org/thumbs-up-sign/>
Thanks Marco.
On Thu, 13 Dec 2018 at 16:54, Marco Pivetta <ocramius@gmail.com> wrote: