Changelog 0.14.0 — 1st of September 2022¶
Notable changes¶
Until this release, the behaviour of the date objects creation was very opinionated: a huge list of date formats were tested out, and if one was working it was used to create the date.
This approach resulted in two problems. First, it led to (minor) performance issues, because a lot of date formats were potentially tested for nothing. More importantly, it was not possible to define which format(s) were to be allowed (and in result deny other formats).
A new method can now be used in the MapperBuilder
:
(new \CuyZ\Valinor\MapperBuilder())
// Both `Cookie` and `ATOM` formats will be accepted
->supportDateFormats(DATE_COOKIE, DATE_ATOM)
->mapper()
->map(DateTimeInterface::class, 'Monday, 08-Nov-1971 13:37:42 UTC');
Please note that the old behaviour has been removed. From now on, only valid timestamp or ATOM-formatted value will be accepted by default.
If needed and to help with the migration, the following deprecated constructor can be registered to reactivate the previous behaviour:
(new \CuyZ\Valinor\MapperBuilder())
->registerConstructor(
new \CuyZ\Valinor\Mapper\Object\BackwardCompatibilityDateTimeConstructor()
)
->mapper()
->map(DateTimeInterface::class, 'Monday, 08-Nov-1971 13:37:42 UTC');
⚠ BREAKING CHANGES¶
- Introduce constructor for custom date formats (f232cc)
Features¶
- Handle abstract constructor registration (c37ac1)
- Introduce attribute
DynamicConstructor
(e437d9) - Introduce helper method to describe supported date formats (11a7ea)
Bug Fixes¶
- Allow trailing comma in shaped array (bf445b)
- Correctly fetch file system cache entries (48208c)
- Detect invalid constructor handle type (b3cb59)
- Handle classes in a case-sensitive way in type parser (254074)
- Handle concurrent cache file creation (fd39ae)
- Handle inherited private constructor in class definition (73b622)
- Handle invalid nodes recursively (a401c2)
- Prevent illegal characters in PSR-16 cache keys (3c4d29)
- Properly handle callable objects of the same class (ae7ddc)