This release mainly focuses on improving type safety, handling complex JSON structures, and extending the functionality of JsonDocument and related classes.
- Add JetBrains sponsorship to README with H1 heading by @g105b in #60
- Schema object and json document builder by @g105b in #61
Full Changelog: v2.1.0...v2.2.0
In JsonKvpObject.php:
- Adjusted validation logic to add support for potential null key in valid() method.
In JsonObjectBuilder.php:
- Enhanced JSON structure validation during decoding.
- Improved handling of complex JSON structures, including proper treatment of scalar values, associative arrays, and indexed arrays.
- Streamlined code by replacing verbose conditional branches with modern match() syntax.
- Introduced helper methods to process arrays and nested elements cleanly.
New File:
- Added JsonTypeException.php to provide specific exception handling for JSON type-related errors.
In JsonDocument.php:
- Added set() and get() methods to support dot notation for accessing and modifying nested keys.
- Refactored code to ensure support for JsonKvpObject transformations while handling nested objects effectively.
- Ensured proper type handling and safe traversal for nested structures with utility methods.
In JsonDocumentTest.php:
- Refactored existing tests and added new tests to validate setObject, set() functionality (including nested keys), and construction of JSON objects from associations.
These improvements aim to make the library more robust, reduce vulnerabilities with incorrect type handling, and improve test coverage for better reliability.