Releases: brianlmoon/value-objects
Release list
v2.4.1 Fix error when null values are passed in to fromArray
What's Changed
- Skip nested-object handling in fromArray() when value is null by @brianlmoon in #8
Full Changelog: v2.4.0...v2.4.1
Lazily instantiate nullable typed-object properties in fromArray()
Removes the requirement to eagerly initialize nested ValueObject properties in __construct() when they are nullable; fromArray() now creates the instance on demand based on the property's declared type.
Bug fixes
When REQUIRED_TYPE lists more than one class and a value passed in is already an instance of one of them, filterType() only recognized a match if the instance happened to be of the last-listed type, since the default case only handled converting raw arrays into instances. Instances of any other listed type were wrongly rejected.
Expose parent getArrayCopy
Merge pull request #5 from brianlmoon/expose_arrayobject_getarraycopy Expose the original version of ArrayObject's getArrayCopy
Bug fix with nested objects
Fixed Bug: Objects in plain arrays would not be exported to array properly.
PHP Updates and more
- Updated to minimum PHP 8.2
- PHP 8.4 fixes
- Updated PHPUnit to 11
- Fixed null handling for non-nullable values in fromArray
Support overriding toArray
If an object does not support the Export interface, a child class may want to convert it before these base classes toArray is called. This also adds support for classes implementing the JsonSerializable interface.
Update namespace and add docs
- Simplified namespace to
\Moonspot\ValueObjects - Removed Builder base class. Use moonspot/builder.
- Added README
Initial Production Release
These objects have been used in production in a non open source application for several years. This is the first public release of them in hopes that others find them useful.