PhpGt / DomTemplate

Bind dynamic data to reusable HTML components.
https://www.php.gt/domtemplate
MIT License
17 stars 4 forks source link

BindableCache: nested nullable objects fail converting to key-value-pair #474

Closed g105b closed 1 year ago

g105b commented 1 year ago

When there's an object that has a nullable public property, like so:

class Customer {
  public function __construct(
    public string $name,
    public ?Address $address,
  ) {}
}

If the Customer's address is null, BindableCache::convertToKvp() will try to use getAddress() instead of being happy with a null value.

g105b commented 1 year ago

Before closing, it would be good to link the unit test here, as this latest merge is becoming a bit confusing :S