hirethunk / verbs

Verbs is an event sourcing package for PHP artisans
https://verbs.thunk.dev
MIT License
412 stars 32 forks source link

Don't hydrate unset properties #141

Closed DanielCoulbourne closed 4 months ago

DanielCoulbourne commented 4 months ago

Imagine the following object:

class Foo 
{
    string $bar;
    int $baz;
}

serializing an object where $baz had not been set yet (even though it's not nullable, i know, I'm bad) would result in rehydrating it with a value of null, which would blow up because it isn't typehinted to null

This fixes that, so we only rehydrate values that are instantiated.