I was wondering why the DateTimeFormatterStrategy allows the empty string during hydration:
|
if ($value === '' || $value === null || $value instanceof DateTimeInterface) { |
Since we are hydrating a DateTime|null property, shouldn't we hydrate an empty datetime string with null?
Or we could add a constructor option to let the developer choose in those cases (private $hydrateEmptyStringToNull = false; to avoid BC)
kind regards
I was wondering why the DateTimeFormatterStrategy allows the empty string during hydration:
laminas-hydrator/src/Strategy/DateTimeFormatterStrategy.php
Line 112 in cd865fc
Since we are hydrating a
DateTime|nullproperty, shouldn't we hydrate an empty datetime string withnull?Or we could add a constructor option to let the developer choose in those cases (
private $hydrateEmptyStringToNull = false;to avoid BC)kind regards