Skip to content

4.0.0

Latest

Choose a tag to compare

@magicsunday magicsunday released this 05 Oct 12:57
· 1 commit to main since this release
4.0.0
15f5f99

⚠️ Breaking changes

  • A new encoder is strict by default. new XmlEncoder($extractor) now throws UnmappableValueException for a value it cannot map, instead of dropping it without a signal. The message names the property path and the type of the value. A null stays empty and a Stringable object is written as its text in both modes.
  • Raised the PHP floor to ^8.4. PHP 8.3 is no longer supported.
  • XmlEncoder::$nameConverter is private and read-only. It was protected. A subclass that read the property has to change.
  • CamelCasePropertyNameConverter is a final read-only class. It can no longer be extended. Implement PropertyNameConverterInterface instead.

🔧 Internal

  • Property hooks are read through the reflection API directly, the PHP 8.3 fallbacks are gone.
  • A property with a stored value and a get hook is pinned by a test, the encoder writes what the hook returns.
  • Copy-paste detection runs through the shared workflow, with jscpd pinned in package.json. Run npm ci once before the local ci:test.

🧭 Migration

  • To keep dropping an unmappable value silently, pass false as the third constructor argument: new XmlEncoder($extractor, $nameConverter, false).
  • Move to PHP 8.4 or newer.
  • Replace a subclass of the converter by an implementation of the interface.

The 3.x line (PHP 8.3, lenient default) is maintained on the 3.x branch.