Conversation
…eter check Remove set_error_handler(null)/restore_error_handler() and use ReflectionMethod::getNumberOfRequiredParameters() to skip getters that require arguments. Real errors now propagate instead of being silently swallowed. Closes #60
…nProperty] attribute - Fix CaseConverter::toCamelCase() to lowercase first character of PascalCase input - Add #[JsonProperty] attribute for explicit name override on getters and properties - Add nameIsExplicit flag to Property to prevent style conversion on explicit names - Check for #[JsonProperty] in objectToJson() for both getters and public properties Style 'none' preserves backward-compatible PascalCase getter names. Other styles now properly normalize (e.g. getName() -> 'name' in camel). Closes #58
…ects Add isIndexedArr() check in arrayToJsonString() to automatically treat arrays with non-integer keys as JSON objects. The $asObject parameter remains as an explicit override. This aligns encoding behavior with json_encode() and prevents silent data loss when associative arrays are passed without $asObject = true. Updated test expectations to reflect the new correct behavior. Closes #56
Add Json::setDefaults() and Json::resetDefaults() static methods for application-wide configuration of style, case, and formatted output. Static defaults take priority over global constants. Constructor parameters override both. Global constants (JSON_STYLE, JSON_CASE, WF_VERBOSE) now trigger E_USER_DEPRECATED notices when used. Closes #61
Add Json::decodeAs() for deserializing JSON strings into typed objects. Add JsonDeserializer class implementing the hydration algorithm: 1. Static fromJSON(Json) factory method (custom deserialization) 2. Constructor parameter reflection with recursive type resolution 3. Setter/public property fallback for remaining keys Add #[JsonType] attribute for annotating array-of-objects parameters where PHP's type system is insufficient. Add Json::setTypeMap() for runtime type mapping on decoded instances, enabling typed returns from get() without attributes. Closes #59
Restructure README to match the WebFiori ecosystem standard: - Centered badges block (matching webfiori/collections style) - Table of Contents - composer require installation - Contributing, License, Support, and Changelog sections - Updated content to reflect all v5 features Closes #63
…ures Updated: - 02-arrays.php: show auto-detection of associative arrays (no $asObject flag) - 04-object-auto-mapping.php: show #[JsonProperty], #[JsonIgnore], normalization Added: - 08-json-property-attribute.php: explicit name override immune to style conversion - 09-typed-deserialization.php: decodeAs(), nested hydration, #[JsonType], setTypeMap() - 10-set-defaults.php: Json::setDefaults() and resetDefaults() - Updated examples/README.md with new entries
Add JsonDeserializerTest covering: - decodeAs() basic, nested, deep nesting - fromJSON factory method support - #[JsonType] attribute on constructor params and properties - setTypeMap() runtime type registry - setDefaults/resetDefaults - #[JsonProperty] encoding behavior - Associative array auto-detection - Property nameIsExplicit flag - CaseConverter camelCase fix Add JsonCoverageTest covering: - Setter-based hydration with typed params - hydrateByJsonType edge cases - Getter with required params skipped - toJsonFile error paths - addBoolean type guard Coverage: 78% → 97.8% (remaining lines are constant-deprecation branches, filesystem failure edges, and dead type guards)
feat!: v5.0.0 release
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #70 +/- ##
============================================
- Coverage 98.97% 98.05% -0.93%
- Complexity 250 342 +92
============================================
Files 4 7 +3
Lines 587 771 +184
============================================
+ Hits 581 756 +175
- Misses 6 15 +9
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Release v5.0.0 — major version with breaking encoding changes, new attribute system, typed deserialization, and static configuration API.
Motivation
All planned v5 enhancements implemented and merged to dev. Ready for production release.
Changes
#[JsonProperty]attributeJson::setDefaults()/Json::resetDefaults()with constant deprecationJson::decodeAs(),JsonDeserializer,#[JsonType],setTypeMap()How to Test / Verify
composer install composer testBreaking Changes and Migration Steps
addArray()now encodes associative arrays as JSON objects. Remove explicit$asObject = true(still works, just redundant).none,getName()→name(camel),name(snake). Stylenoneunchanged.JSON_STYLE,JSON_CASE,WF_VERBOSEtriggerE_USER_DEPRECATED.Checklist
Related issues
Closes #56, #58, #59, #60, #61, #63